How to Version in pyproject

How to Version in pyproject

October 18, 2025

From https://packaging.python.org/en/latest/guides/writing-pyproject-toml/. The main learning I got was how to do a date version instead of 1.0 type versioning.

Put the version of your project.

[project]
version = "2020.0.0"

Some more complicated version specifiers like 2020.0.0a1 (for an alpha release) are possible; see the specification for full details.

This field is required, although it is often marked as dynamic using

[project]
dynamic = ["version"]

This allows use cases such as filling the version from a __version__ attribute or a Git tag. Consult Single-sourcing the package version for more details.