Contributing¶
This repository's infrastructure features pinned dependency management, a documentation site, an automated release process, GitHub integration, VS Code integration, and much more.
Setup for Local Development¶
- Install tox
- Clone the repository
Tox¶
tox is used to automate and standardize testing across local development environments and CI/CD pipelines.
Tox Configuration¶
The tox configuration for this repository can be found in tox.ini.
Tox Environments¶
Each tox environment accomplishes a specific purpose.
List all tox environments and their descriptions with tox list.
Details about each environment are given below:
py*: for a particular python version,- checks if the package can be built (may be commented out), and
- runs tests and generates a coverage report source file
.coverage
check-release: checks that the package is ready to be releasedcoverage: converts.coverageto human readable formatshtml: used to create the Coverage Report pagejson: used to create the coverage badge in the README
dev: used to create a development environment with all dependencies installed- When in the development environment, the commands that are run in each environment can be run in your terminal
docs-build: builds the docs to ensure that they are in a valid statedocs-serve: runs the docs development serverformat: runs the formatterslint: runs the lintersupgrade: updates the dependencies
Running Tox Environments¶
tox -e <environment>will run a single environmenttoxwill run all the default environments as noted bytox list- To set an environment as default, add it to
envlistintox.ini
- To set an environment as default, add it to
Known issues running tox environments:
| Environment | Issue | Solution |
|---|---|---|
coverage |
coverage combine outputs "No data to combine" |
coverage cannot be run independently, as it needs .coverage from testenv: run tox instead. If you are still getting this error, remove .coverage and rerun. |
Tox Development Environments¶
The tox devenv command will create a virtual environment and install the environment's
dependencies in it.
- To create a virtual environment with all dependencies installed,
run
tox devenv -e dev .venv. - Using a virtual environment: activate Python virtual environments
Dependencies¶
Dependencies are defined in pyproject.toml.
They are pinned and managed using pip-tools.
The pinned dependencies can be found in requirements/.
How to Add or Update Dependencies¶
- To add a dependency, add it in
pyproject.toml; where you add the dependency depends on what type of dependency it is:- Add project dependencies to the
dependencieslist - Add environment-specific dependencies to the corresponding list
below
[project.optional-dependencies]
- Add project dependencies to the
- Run the
upgradetox environment:tox -e upgrade - Verify that the tests still pass:
tox - If you are using the development environment, recreate it:
tox devenv -e dev .venv - Commit and push the changes