https://github.com/mmcshane/poetry-commit-date-versioning
A Poetry plugin that observes the current git commit to build a date-based version number
https://github.com/mmcshane/poetry-commit-date-versioning
Last synced: 2 months ago
JSON representation
A Poetry plugin that observes the current git commit to build a date-based version number
- Host: GitHub
- URL: https://github.com/mmcshane/poetry-commit-date-versioning
- Owner: mmcshane
- Created: 2023-12-06T17:28:11.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-08T18:56:08.000Z (almost 2 years ago)
- Last Synced: 2025-03-15T04:12:49.265Z (7 months ago)
- Language: Python
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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`
1. In pyproject.toml add a stanza to enable the plugin for a given project```.toml
[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"````.toml
[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.```.py
from importlib import metadata__version__ = metadata.version(__name__)
```
This project was created as an alternative to
- [poetry dynamic
versioning](https://github.com/mtkennerly/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](https://github.com/miigotu/poetry-date-version-plugin) which may be
abandoned and incomplete and which is definitely centered around writing
version numbers into python source files.