Skip to content

Latest commit

 

History

History
69 lines (52 loc) · 2.04 KB

DEVELOPMENT.md

File metadata and controls

69 lines (52 loc) · 2.04 KB

Development

Installation

To install the project, run

pip install .

To improve code quality, we run linters, type checkers, and unit tests. The tools can be run using nox. We recommend installing nox using pipx to have it available globally:

python -m pip install pipx
python -m pipx install nox
nox

You can invoke nox -s to run individual sessions. For example, to install your package into a virtual environment and run your test suite, invoke:

nox -s test

We also provide a nox session that creates an environment for development. The project is installed in editable mode into this environment along with linting, type checking and formatting tools. Activating it allows your editor of choice to access these tools for, e.g., linting and autocompletion. To create and then activate virtual environment run:

nox -s dev
source .nox/dev/bin/activate

Furthermore, we provide individual sessions to easily run linting, type checking and formatting via nox. These also create editable installs. So you can safely skip the recreation of the virtual environment and reinstallation of your package in subsequent runs by passing the -R command line argument. For example, to auto-format your code using [black], run:

nox -Rs format -- check
nox -Rs format

The former command allows you to inspect changes before applying them.

Note that editable installs have some caveats. In case there are issues, try recreating environments by dropping the -R option. If your project is incompatible with editable installs, adjust the noxfile.py to disable them.

We also provide a pre-commit config to automate this process. It can be set up using the following commands:

python -m pipx install pre-commit
pre-commit install

This blackens the source code whenever git commit is used.