Development#

TurboGraph uses the uv package manager for dependency management and packaging.

Setup#

First, install uv by following the official installation guide.

Once uv is installed, set up the project dependencies by running:

uv sync --all-extras --all-groups --no-install-project

This will install all dependencies, including development dependencies, inside a virtual environment located at .venv.

Running Tests#

TurboGraph uses tox for testing, with uv handling the virtual environments.

Install Tox#

Before running tests, install tox along with the tox-uv plugin:

uv tool install tox --with tox-uv

Available Test Commands#

  • Run all unit tests across multiple Python, networkx and igraph versions:

    tox
    
  • Run tests with coverage analysis:

    tox -e cov
    
  • Check code formatting and linting with isort and ruff

    tox -e lintcheck
    
  • Automatically fix linting and formatting issues with isort and ruff

    tox -e lintfix
    
  • Run static type checking with mypy

    tox -e typecheck
    
  • Check for spelling errors using codespell

    tox -e spellcheck
    
  • Fix spelling errors automatically

    tox -e spellfix
    
  • Build the documentation for the current branch

    tox -e docbuild
    

These checks are automatically run by the GitLab CI/CD pipeline.

Pre-commit Hooks#

Developers may use pre-commit to enforce code quality before commits, so that issues are caught early. The following checks are run:

  • isort \(\to\) Import sorting.

  • ruff \(\to\) Linting and code formatting.

  • mypy \(\to\) Static type checking.

  • codespell \(\to\) Spell checking.

  • Dependency exports \(\to\) Update requirement files in the requirements/ directory.

pre-commit is already installed as a development dependency. To run all checks manually, use:

pre-commit run --all-files

If you wish to install the pre-commit hooks, run:

pre-commit install