Skip to main content

A Poetry plugin that observes the current git commit to build a date-based version number

Project description

poetry-commit-date-versioning

Date-based versioning for Poetry projects. Reads the commit date and sha from git and uses it to set the project version. Nothing else. No attempt is made to work with anything other than git.

To use:

  1. poetry self add poetry-commit-date-versioning
  2. In pyproject.toml add a stanza to enable the plugin for a given project
[tool.poetry-commit-date-versioning]
enable = true

You can optionally indicate whether the plugin should generate zero-padded version segments or pep440 canonicalized segments. With padding, version number segments are left-padded with zeros to extend to the maximum possible width of the field. For example a version number including the month of January 1980 would be padded to start with 1980.01. With canonicalization that same version number would be 1980.1. By default, pep440 canonicaization is used but padding can be enabled with the version-style configuration field. This field accepts one of two values: "pep440-canonicalized" or "zero-padded"

[tool.poetry-commit-date-versioning]
enable = true
version-style = "zero-padded"

As the version number is not written into source code files anywhere, we suggest using importlib to determine your module's version number.

from importlib import metadata

__version__ = metadata.version(__name__)

This project was created as an alternative to

  • poetry dynamic versioning because it rewrites the pyproject.toml file with every invocation (even if nothing has changed) and is thus incompatible with a development process that uses pyproject.toml file in Makefile dependencies.
  • poetry date versioning plugin which may be abandoned and incomplete and which is definitely centered around writing version numbers into python source files.

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_commit_date_versioning-0.4.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file poetry_commit_date_versioning-0.4.0.tar.gz.

File metadata

File hashes

Hashes for poetry_commit_date_versioning-0.4.0.tar.gz
Algorithm Hash digest
SHA256 dd20b799a86bf6b0a0d831c07349776eb5c23ef5f8c948b8676acb6ffc7b173c
MD5 bd5de513eb6aaeb53bf50f5cc474673e
BLAKE2b-256 53f76118b0b1d9342620a829dfdd945c94db524fa9d027361cc2d02ff00e35bf

See more details on using hashes here.

File details

Details for the file poetry_commit_date_versioning-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_commit_date_versioning-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7bfb62f5c49804005301809438a612ecb338a8a443b6763ab5eeffb89f782b7
MD5 65009a69521345166eab2a31212459ea
BLAKE2b-256 9df1fe665e0ac9254f7ce56c5d646a6b127b1e40e5112f8ced83ddd273b87400

See more details on using hashes here.

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