Python Development

pypi docs

Install Python

Install a Python version supported by automesh. Install Rust as well.

Create a Virtual Environment

Note: If a virtual environment folder automesh/.venv already exists from previous installs, then remove it as follows:

cd automesh                     # from the automesh directory
(.venv) deactivate              # if the virtual environment is currently active
rm -rf .venv                    # remove the virtual environment folder
                                # with `rm -rf .venv/`.

python -m venv .venv            # create the virtual environment

# activate the venv with one of the following:
source .venv/bin/activate       # for bash shell
source .venv/bin/activate.csh   # for c shell
source .venv/bin/activate.fish  # for fish shell
.\.venv\Scripts/activate        # for powershell

pip install --upgrade pip

pip install maturin

Build and Test the Source Code

maturin develop --features python --extras dev

pytest

pre-commit run --all-files

Build a '.whl` file release

maturin build --release --features python

Lint the Source Code

cargo clippy --features python

pycodestyle --exclude=.venv .  # exclude the .venv folder

Build and Open the API Documentation

pdoc automesh --math --no-show-source --template-directory docs/