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.yamlruns checks on a Ubuntu Github-hosted runner.container.yamlruns 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-IDGCP_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 setupin your terminal.
In step 2 this will:
- Run
pipenv sync --devto install dependencies. cp .env.template .envto create your local.envfile - 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