Skip to main content

Tool to help manage the version of a Poetry project.

It updates the version of a Poetry project both in:

  • The pyproject.toml file: in the tool.poetry section.
  • All the __init__.py files of the packages registered in the tool.poetry.packages section of the pyproject.toml file.

The reason for having the version in both places is to be able to easily access the version at runtime by importing the package and reading the __version__ attribute in the __init__.py file, and still having the version in the pyproject.toml file for Poetry during the package build.

It is mainly made for being used in CI pipelines to automatically increment the versions at each deployment. But is also very helpful for manual usage, as it maintain consistancy between the versions in the pyproject.toml and the __init__.py files at all time.

Install

$ pip install poetry_incr_version # Easiest method for CI.

$ pipx install poetry_incr_version # Preferable in some cases, for exemple to install globally on your machine.

Usage

$ poetry-incr-version --minor . # Increment the minor version of the project in the current directory.

$ poetry-incr-version --set 1.2.3 path/to/project # Sets the version of the project inside path/to/project to '1.2.3'.

See .gitlab-ci.yml for a real use case.

Notes

  • No runtime dependencies: it is fast and easy to install.
  • Requires at least python 3.11: neeeded to parse the pyproject.toml.
  • Tested: checked by Pyright with strict mode, Ruff with all lint rules, Pytest with 100% test coverage and also by the CI pipelines of the project itself.

Metadata

Release files for poetry-incr-version 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for poetry-incr-version 0.1.9
File Size Uploaded
poetry_incr_version-0.1.9.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for poetry-incr-version 0.1.9
File Interpreter ABI Platform
poetry_incr_version-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / poetry_incr_version-0.1.9.tar.gz

Download URL poetry_incr_version-0.1.9.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
57392a91f73755ec69c525c89544e94e0f301829e10aa62a8b6e464c36aab441
BLAKE2b-256 checksum
How to use checksums
16460be05b78850777f3d48f7b6ba706859d5e3c84e3bc64696ef17c8af2efbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Linux/5.15.154+

Release files / poetry_incr_version-0.1.9-py3-none-any.whl

Download URL poetry_incr_version-0.1.9-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f01bb3826666c19873133b6fd7f831baab68f1b61704a8f31114d5009b3a3891
BLAKE2b-256 checksum
How to use checksums
347ddcae95844d1ec883a8bfb35111684a8c99a511a588d554a6e458a2dc0855
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Linux/5.15.154+

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page