TIL: Single source version package builds with uv
Briefly

Manage package versions effectively by modifying `pyproject.toml` to use dynamic versioning. Remove the static `version` entry and replace it with `dynamic = ["version"]`. Under `[tool.setuptools.dynamic]`, specify the version's location as `version = { attr = "mypackage.__version__" }`. In the root `__init__.py` file, define a `__version__` attribute that holds the version string. This approach streamlines the versioning process and reduces the need for multiple updates before publishing.
Remove `version` in `pyproject.toml` and replace with `dynamic = ["version"]`. Add `[tool.setuptools.dynamic]` and specify the location of the version using `version = { attr = "mypackage.__version__" }`.
In your project's root `__init__.py`, add a `__version__` attribute. Example: `__version__ = "0.1.0"`. This allows for a single source of version control.
Read at daniel.feldroy.com
[
|
]