Poetry Dynamic Versioning

1.10.0 · active · verified Thu Apr 09

Poetry Dynamic Versioning is a plugin for Poetry (1.2.0+ and Poetry Core 1.0.0+) that enables dynamic versioning for Python projects based on tags in your version control system. It is powered by the Dunamai library and automatically inserts the correct version into relevant files during Poetry commands (like `poetry build`), reverting changes afterward to keep the repository clean. The current version is 1.10.0, and it maintains an active release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to install the plugin, enable dynamic versioning for a project via the CLI command, and create a Git tag for version detection. The `poetry dynamic-versioning enable` command automatically configures `pyproject.toml` for you. Building the project will then use the version from your Git tag.

# 1. Install the plugin (see 'Install' section for options based on your Poetry version)
# For Poetry 1.2.0+:
pip install poetry-dynamic-versioning

# 2. Navigate to your project directory
# cd your-project

# 3. Enable dynamic versioning for your project
poetry dynamic-versioning enable

# This command updates your pyproject.toml to look like this (simplified):
# [project]
# dynamic = ["version"]
# name = "your-project-name"
#
# [tool.poetry]
# version = "0.0.0" # Placeholder
#
# [tool.poetry-dynamic-versioning]
# enable = true

# 4. Create an initial Git tag
git init
git add .
git commit -m "Initial commit"
git tag v0.1.0

# 5. Build your project to see the dynamic version in action
poetry build

view raw JSON →