Skip to content

Latest commit

 

History

History
69 lines (46 loc) · 1.75 KB

CONTRIBUTING.md

File metadata and controls

69 lines (46 loc) · 1.75 KB

Contributing

Project Setup

Configure your virtual environment of choice with Python >=3.11.

Install the project and its dependencies to your virtual environment with pip:

pip install -r requirements.txt
pip install -e '.[dev]'

Run pre-commit install to enable the pre-commit configuration:

pre-commit install

The pre-commit hooks will be run against all files during a git commit, or you can run it explicitly with:

pre-commit run --all-files

If for some reason, you wish to commit code that does not pass the pre-commit checks, this can be done with:

git commit -m "message" --no-verify

Start the swoop api by running:

uvicorn swoop.api.main:app --host 0.0.0.0 --port 8000 --reload

Testing

Tests are run using pytest. Put pytest python modules and other resource in the /tests directory. Run postgres for testing using the docker compose as documented in the database README.md. Ensure to source ./.env before running the tests.

Adding/updating dependencies

Updating requirements.txt to latest versions

All dependencies should be specified in the project's pyproject.toml. The frozen requirements.txt file is generated from that list using the pip-compile utility (from the dev dependency pip-tools). Simply run:

pip-compile

Updating package pinning

To change a package minimum or maximum version, edit the pinning specified in pyproject.toml then run pip-compile as above.

Adding a new package

To add a new package as a project dependency, edit the pyproject.toml and add it to the corresponding dependeny list. Run pip-compile as above to update requirements.txt with the new package.