Centre for Net Zero's template for Python projects.
Tools:
- Pipenv for dependency management
- Pytest for testing
- Mypy for type checking
- Flake8 for linting
- isort and black for formatting
There are two Github Actions workflows:
test_and_lint.yaml
runs checks on a Ubuntu Github-hosted runner.container.yaml
runs the same checks but inside a Docker container and pushes images to Google Cloud Platform Artifact Registry.
If you want to use the Docker workflow, you need to set the following secrets:
GCP_ARTIFACT_REGISTRY
, e.g.LOCATION-docker.pkg.dev/PROJECT-ID
GCP_ARTIFACT_REGISTRY_SA_KEY
, the key for a service account with the roles to push and pull images.
You need to set up your Python environment first.
- Clone this repo.
- Run
make setup
in your terminal.
In step 2 this will:
- Run
pipenv sync --dev
to install dependencies. cp .env.template .env
to create your local.env
file - make sure you fill in any blanks.- Install your local pre-commit environment which will be used to maintain code standards
- Check the tests work by running
pipenv run pytest