From 36c14df5be8ccaf0fea8104431f3a9a994a46e86 Mon Sep 17 00:00:00 2001 From: Valentin Berlier Date: Sat, 17 Sep 2022 14:38:22 +0200 Subject: [PATCH] fix: strict type checking --- .gitignore | 2 +- README.md | 14 ++++++++++++++ pyproject.toml | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d24c97e..653988c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,5 @@ __pycache__/ dist/ # Cache -.pytest_cache/ .beet_cache/ +.pytest_cache/ diff --git a/README.md b/README.md index b13c90a..5dba291 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,20 @@ Create a new repository from this template by clicking the ["Use this template"] You can also clone or download this repository manually, and rename the package and substitute all the `fixme` by hand. Don't forget to reset the version number and remove the one-off workflow in `.github/workflows/template.yml`. +## Conventional commits + +The main workflow in `.github/workflows/main.yml` will take care of version bumps and releases automatically based on the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. This means that all commit messages must be prefixed with a type, such as `feat:`, `fix:`, `docs:`, etc. The type determines the version bump that will be applied to the package. + +This will save you hours of fiddling with version numbers and changelogs. + +To disable this feature, remove the "Release" step at the end of the main workflow. Then uninstall `python-semantic-release` with `poetry remove -Gdev python-semantic-release` and remove the `[tool.semantic_release]` section in `pyproject.toml`. + +## Type checking + +This template doesn't include a local static type checker, but if you use [Visual Studio Code](https://code.visualstudio.com/) the editor will directly report strong diagnostics thanks to the `typeCheckingMode = "strict"` option in `pyproject.toml`. + +If you're more familiar with static typing in Python, you're encouraged to install [Pyright](https://github.com/microsoft/pyright) in the project to pin it to a specific version and run it after `pytest` in the main workflow. + ## Publish on PyPI To enable automatic releases on PyPI, [create a PyPI API token](https://pypi.org/manage/account/token/) and add it to your repository secrets as `PYPI_TOKEN`. Next, add the token as an environment variable at the end of the main workflow in `.github/workflows/main.yml`. diff --git a/pyproject.toml b/pyproject.toml index 0e232c4..3d342d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,9 @@ python-semantic-release = "^7.31.4" [tool.pytest.ini_options] addopts = "tests --import-mode=importlib" +[tool.pyright] +typeCheckingMode = "strict" + [tool.black] target-version = ["py310"]