/poetry_template_2

Template for a poetry-based project without docs and license information

Primary LanguagePython

Poetry Template

Test and build

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:

  1. Download and install Poetry following the instructions for your OS.

  2. Click the green "Use this template" button above

  3. Name and create your repository

  4. Clone your new repository and make it your working directory

  5. Replace instances of myproject with your own application name. Edit:

    • pyproject.toml
    • tests/test_myproject.py
    • Rename myproject directory
  6. Set up the virtual environment:

    poetry install
  7. Activate the virtual environment (alternatively, ensure any python-related command is preceded by poetry run):

    poetry shell
  8. Install the git hooks:

    pre-commit install
  9. Run the main app:

    python -m myproject
  10. Run the tests:

pytest