Skip to content

Building and Testing

Before starting building and testing package set up Developer's Environment first. From here and below we consider the shell's current directory matches the project's root directory.

Building Package

To test the package build run:

python -m build --sdist --wheel

Compiled packages will be available in the dist/ directory.

Running tests

Rebuild rust modules, if changed:

python -m pip install --editable .

To run the test suit:

pytest -vv

Running Lints

All lints are checked as part of GitHub Actions Workflow. You may run lints manually before committing to the project.

Check Formatting

Python Code Formatting is the mandatory requirement in our Code Quality standards. To check code formatting run:

ruff format --check examples/ src/ tests/

To fix formatting errors run:

ruff format examples/ src/ tests/

We recommend setting python code formatting on file saving (Done in VS Code Dev Container out of the box).

Python Code Lints

Python Code Linting is the mandatory requirement in our Code Quality standards. To check code for linting errors run:

ruff src/ tests/

Python Code Static Checks

Python Code Static Checks is the mandatory requirement in our Code Quality standards. To check code for typing errors run:

mypy src/

Python Test Code Coverage Check

To evaluate code coverage run tests:

coverage run -m pytest -vv

To report the coverage after the test run:

coverage report

To show line-by-line coverage:

coverage html

Then open dist/coverage/index.html file in your browser.

Building Documentation

To rebuild and check documentation run

mkdocs serve

We recommend using Grammarly service to check documentation for common errors.

Benchmarks

First, edit Cargo.toml, comment line in the section [lib]:

crate-type = ["cdylib"] # Comment for bench

and uncomment

# crate-type = ["cdylib", "rlib"] # Uncomment for bench

Then run bencmarks:

cargo bench

Revert Cargo.toml when you completed.