Skip to content

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

Notifications You must be signed in to change notification settings

ImperialCollegeLondon/poetry_template_2

Repository files navigation

Poetry Template

Test and build

This is a minimal Python 3.12 application that uses poetry for packaging and dependency management. It also provides pre-commit hooks (for ruff 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.

Usage

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

Publishing

The GitHub workflow includes an action to publish on release. To run this action, uncomment the commented portion of publish.yml, and modify the steps for the desired behaviour (ie. publishing a Docker image, publishing to PyPI, deploying documentation etc.)

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages