Skip to main content

NewVersion - PEP 440 version manager

PyPI - newversion PyPI - Python Version PyPI - Downloads Docs

PyPI - Python Version Coverage

Features

Installation

python -m pip install newversion

Usage

uv

# bump Python package micro version and update package version
# 1.2.3 -> 1.2.4
uvx newversion -p bump --save

# bump Python package minor version and update package version
# 1.2.3 -> 1.3.0
uvx newversion -p bump minor --save

# bump Python package major version and update package version
# 1.2.3 -> 2.0.0
uvx newversion -p bump major --save

# bump Python package RC pre-release version and update package version
# 1.2.3 -> 1.2.4rc1
uvx newversion -p bump pre --save

# set commit hash as local and update package version
# 1.2.3 -> 1.2.3+956a81a
uvx newversion -p set local ${COMMIT_SHA} --save

CLI

newversion            # 0.0.0
newversion bump major # 1.0.0

# get package version from pyproject.toml, setup.cfg or setup.py
newversion -p # 1.2.3
newversion -p bump # 1.2.4
newversion -p bump pre # 1.2.4rc1
newversion -p get minor  # 2


# bump minor version and update package version
newversion -p --save bump minor

echo "1.2.3rc1" | newversion bump micro   # 1.2.3
echo "1.2.3rc1" | newversion bump minor   # 1.3.0
echo "1.2.3rc1" | newversion bump major   # 2.0.0
echo "1.2.3rc1" | newversion bump pre     # 1.2.3rc2
echo "1.2.3rc1" | newversion bump rc      # 1.2.3rc2
echo "1.2.3rc1" | newversion bump alpha   # 1.2.4a1

echo "1.2.3rc1" | newversion set micro 5  # 1.2.5rc1
echo "1.2.3rc1" | newversion set minor 5  # 1.5.3rc1
echo "1.2.3rc1" | newversion set major 5  # 5.2.3rc1
echo "1.2.3rc1" | newversion set pre 5    # 1.2.3rc5
echo "1.2.3rc1" | newversion set rc 5     # 1.2.3rc5
echo "1.2.3rc1" | newversion set alpha 5  # 1.2.3a5

echo "1.2.3rc1" | newversion get micro    # 1
echo "1.2.3rc1" | newversion get minor    # 2
echo "1.2.3rc1" | newversion get major    # 3
echo "1.2.3rc1" | newversion get pre      # rc1
echo "1.2.3rc1" | newversion get rc       # 1
echo "1.2.3rc1" | newversion get alpha    # 0

echo "1.2.3rc1" | newversion stable # 1.2.3

echo "1.2.3rc1" | newversion is_stable       # error!
echo "1.2.3" | newversion is_stable          # 1.2.3
echo "1.2.3" | newversion is_stable && echo "Stable!" # Stable!

echo "1.2.3rc1" | newversion gt "1.2.3"   # error!
echo "1.2.3rc1" | newversion lte "1.2.3"  # "1.2.3rc1"

Python library

from newversion import Version

version = Version("1.2.3")
next_version = version.bump_minor() # Version("1.3.0")

# bump version same way as SemVer
version.dumps() # "1.2.3"
version.bump_micro().dumps() # "1.2.4"
version.bump_minor().dumps() # "1.3.0"
version.bump_major().dumps() # "2.0.0"

# create and bump pre-releases
version.bump_prerelease().dumps() # "1.2.4rc1"
version.bump_prerelease(bump_release="minor").dumps() # "1.3.0rc1"
version.bump_prerelease("alpha").dumps() # "1.2.4a1"
Version("1.2.3b4").bump_prerelease().dumps() # "1.2.3b5"
version.bump_micro().replace(dev=1234).dumps() # "1.2.4.dev1234"

# and post-releases
version.bump_postrelease().dumps() # "1.2.3.post1"
Version("1.2.3.post3").bump_postrelease(2).dumps() # "1.2.3.post5"

# easily check if this is a pre- or dev release or a stable version
Version("1.2.3").is_stable # True
Version("1.2.3a6").is_stable # False
Version("1.2.3.post3").is_stable # True
Version("1.2.3.post3").get_stable().dumps() # "1.2.3"

Versioning

newversion version follows PEP 440.

Latest changes

Full changelog can be found in Releases.

Metadata

Release files for newversion 3.1.0

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

Source distribution (sdist)

Source distribution for newversion 3.1.0
File Size Uploaded Provenance Actions
newversion-3.1.0.tar.gz 20.1 kB Without provenance Details for newversion-3.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for newversion 3.1.0
File Interpreter ABI Platform Actions
newversion-3.1.0-py3-none-any.whl Python 3 none any Details for newversion-3.1.0-py3-none-any.whl

Total release size: 38.1 kB

Release files / newversion-3.1.0.tar.gz

Download URL newversion-3.1.0.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c7ef57eb0d5a69a92bda13033c923b4f3d1b3782d08a5821ea0aecdf0c07ea3c
BLAKE2b-256 checksum
How to use checksums
949328a56a8c05df3bf722ea47938d1725e731ceb0ab89ae23bfed25bf01a856
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.1

Release files / newversion-3.1.0-py3-none-any.whl

Download URL newversion-3.1.0-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c69363bfa68eca5b2559b247000773ccf8896cee97f91942c33a6128c2049e61
BLAKE2b-256 checksum
How to use checksums
a873ac85309860cca23ec87681507714c02a04df6d6038ffc6fe83b8372b1796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.1

Security for newversion 3.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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