Skip to main content

nr.poetry-release

A Poetry plugin to automate releasing new versions of Python packages.

Features

  • Update the version number in all relevant places
    • Built-in support for pyproject.toml (like the poetry versioncommand) & in your package source code
    • Configuration option to match and bump version numbers in other files
    • Plugin infrastructure to dispatch additional logic on version bump (used by e.g. poetry-changelog)
  • Automatically commit, tag and push version bumps
  • Easily release from CI

Installation

Plugins work with Poetry version 1.2.0a2 or above.

$ poetry plugin add nr.poetry-release

Usage

$ poetry release patch --tag --push

This will

  1. Increment the patch version number in pyproject.toml and synchronize all other built-in and configured places where the version number is referenced
  2. Commit the changes and create a Git tag with the new version number, then push the branch to the remote repository

In addition to the version rules already supported by poetry version, the poetry release plugin supports a git rule which will construct a version number based on the last Git tag and the commit distance. Note that this version number is not PyPI compatible, but can be used to publish for example to Artifactory.

Using the --verify option will instead check if the specified version number is used consistently across all version references and is useful in CI.

Configuration

Release branch

If in a Git project, unless --no-branch-check is passed, poetry release will prevent you from creating the release unless the worktree is currently on the configured release branch (develop by default). The release branch can be changed by setting the tool.nr.poetry-release.branch option in pyproject.toml.

[tool.nr.poetry-release]
branch = "main"

Tag format

When using the --tag option, a Git tag will be created with the target version as its name. The name assigned to the new tag can be changed by setting the tool.nr.poetry-release.tag-format option in pyproject.toml. For example, if the target version is 1.0.0 but the tag name should be v1.0.0, the configuration to use is:

[tool.nr.poetry-release]
tag-format = "v{version}"

Additional version references

You can configure additional references to the version number in your project using the tool.nr.poetry-release.references option. It must be a list of tables that define the files and a regular expression to find the version number.

[tool.nr.poetry-release]
references = [
  { file = "../frontend/package.json", pattern = "  \"version\": \"{version}\"," }
]

In addition to this configuration option, plugins of type peotry_release.plugin_api.PoetryReleasePlugin registered under the poetry_release.plugins entrypoint will be used to detect additional version number references, or register a callback to modify file(s) with respect to the target version number.

Metadata

Release files for nr.poetry-release 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nr.poetry-release 0.1.3
File Size Uploaded
nr.poetry-release-0.1.3.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nr.poetry-release 0.1.3
File Interpreter ABI Platform
nr.poetry_release-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / nr.poetry-release-0.1.3.tar.gz

Download URL nr.poetry-release-0.1.3.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7aec1404de4e2ffca9b1efa5c036d5f709f446279f195b5c510b2e0abbc5196c
BLAKE2b-256 checksum
How to use checksums
7d7f2903c4debe8ff4081674f6270a83b294a07f93c65e0a1b9836a7f1ee2285
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release files / nr.poetry_release-0.1.3-py3-none-any.whl

Download URL nr.poetry_release-0.1.3-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf1125cfa2a7920f11621a828707dac98e8fa921d96ba6a2110bad1dbb7652f2
BLAKE2b-256 checksum
How to use checksums
d6b92cf942852da378e8514bb2bc6ffea73b2ba7670a9638f8110560cef185eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page