Skip to main content

Tool to help manage the version of a Poetry project in CI pipelines

Project description

Description

Update 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

$ pipx install poetry_incr_version # Preferable for exemple to install 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 to install from scratch.
  • 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 by the CI pipelines of the project itself.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry_incr_version-0.1.4.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

poetry_incr_version-0.1.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file poetry_incr_version-0.1.4.tar.gz.

File metadata

  • Download URL: poetry_incr_version-0.1.4.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/5.15.154+

File hashes

Hashes for poetry_incr_version-0.1.4.tar.gz
Algorithm Hash digest
SHA256 838ac5dbed4d23134208702abab2e271a977c96e3f859ab8a435dbaf23f0f18a
MD5 4ae929b6c0b654d68dfe92f70ea9217b
BLAKE2b-256 19b8146114898886d853364c960b25be37d6d978ebf4291b9911fcedbf03f758

See more details on using hashes here.

Provenance

File details

Details for the file poetry_incr_version-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_incr_version-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2bed8dd8e4dbb02c3d23caf6bdd302e40c5dfbad4db922bbed103f56f6fec425
MD5 d826c65967939e574ebed9ac55b9746d
BLAKE2b-256 9fd48a09fed1245d06eed88b92dfd8288dff0bca235a23baa89881246efc8429

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page