/poetry-template

A python project template using poetry and a few useful features

Primary LanguageMakefileMIT LicenseMIT

poetry-template

Code style: black Pre-commit Semantic Versions License

A python project template using poetry and with a few useful features

Usage

First, install cookiecutter using pip:

$ pip install cookiecutter

Then, to create a new project, run:

$ cookiecutter gh:gabrielguarisa/poetry-template

Variables

  • project_name: The name of the project.
  • project_description: A short description of the project.
  • version: The version of the project.
  • author: The name of the author.
  • email: The email of the author.
  • github_name: The author Github username.
  • license: The license of the project.
  • minimal_python_version: The minimal Python version required.
  • line_length: The line length of the project.

Features

Setting up a development environment

If you don't have a local development environment, you can follow these steps to set one up.

First, if you have not already, install poetry:

pip install poetry

Now, initialize poetry and pre-commit hooks:

make install && make install-pre-commit

Running the tests

You can run the tests with:

make test

This will run the tests with pytest and show information about the coverage.

Formatting the code

To format the code, you can use the command:

make formatting

This will run the black, isort and )pyupgrade commands.

If you want to just check the formatting, use the command:

make check-formatting

Releasing a new version

To release a new version, you need to follow these steps:

  1. Update the version with poetry version <version> and commit the changes. This project follows Semantic Versioning, so the version number should follow the format <major>.<minor>.<patch>. Alternatively, you can also use the version as major or minor or patch, and the version number will be automatically incremented.

  2. Create a Github release with the new version number.

  3. (Optional) Publish the new version to PyPI with poetry publish --build.

Credits

Some projects that inspired this repo: