Poetry Template
This is a minimal Python 3.9 application that uses poetry for packaging and dependency management. It also provides pre-commit hooks (for isort, Black, Flake8 and mypy) and automated tests using pytest and GitHub Actions. Pre-commit hooks are automatically kept updated with a dedicated GitHub Action, this can be removed and replace with pre-commit.ci if using an public repo. It was developed by the Imperial College Research Computing Service.
To use this repository as a template for your own application:
-
Download and install Poetry following the instructions for your OS.
-
Click the green "Use this template" button above
-
Name and create your repository
-
Clone your new repository and make it your working directory
-
Replace instances of
myproject
with your own application name. Edit:pyproject.toml
tests/test_myproject.py
- Rename
myproject
directory
-
Set up the virtual environment:
poetry install
-
Activate the virtual environment (alternatively, ensure any python-related command is preceded by
poetry run
):poetry shell
-
Install the git hooks:
pre-commit install
-
Run the main app:
python -m myproject
-
Run the tests:
pytest