bump-py-version
This is a simple and opinionated python tool to bump the of a python package.
-
The script will check for any changes in the current
gitrepository and abort if there are any. -
If there are no changes, it will check for a
versionfield inpyproject.toml. If theproject.versionexist it is altered to the specified version. Other options are specified below. -
The script commits and pushes the changes.
-
Then a new tag is created using the new
versionspecified to the script. -
Finally the script pushes the new tag to the remote repository.
Installation
Install the latest version from PyPI with uv:
uv tool install bump-py-version
Configuration
You may also bump the python version __version__ in e.g. __init__.py file (or similar) using a pyproject.toml setting like the following:
[tool.bump_version]
version_file = "bump_py_version/__init__.py"
You may configure the script to alter text files (e.g. README.md) by setting the section tool.bump_version.replace_patterns in the pyproject.toml file. Example:
[tool.bump_version.replace_patterns.pipx]
file = "README.md"
search = "<!-- LATEST-VERSION-UV -->"
replace = "\tuv tool install bump-py-version=={version}\n"
The above will cause the line below the search string to be replaced with the replace string. Then it is easy to show the latest version of the package in a README.md file.
Updating uv.lock
To update uv.lock as part of each version bump, enable:
[tool.bump_version]
uv_lock = true
This runs uv lock after updating the version files and before staging changes,
so the lockfile is included in the release commit and tag. It does not request
dependency upgrades. If the lockfile does not exist, uv lock creates it.
uv must be installed and available on PATH. The command checks these
prerequisites before modifying files and rejects an ignored uv.lock, explaining
that it must be removed from .gitignore or the applicable Git ignore rules.
An existing, untracked lockfile must be committed before bumping, just like any
other non-ignored untracked file.
If uv lock fails, the command stops before committing, pushing, or tagging;
local edits remain available for inspection. The setting defaults to false,
which preserves the existing behavior without running uv.
Usage example
Example:
bump-py-version v1.2.3
License
MIT © Dennis Iversen
Metadata
Release files for bump-py-version 2.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bump_py_version-2.1.2.tar.gz | 6.5 kB | Without provenance | Details for bump_py_version-2.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bump_py_version-2.1.2-py3-none-any.whl | Python 3 | none | any | Details for bump_py_version-2.1.2-py3-none-any.whl |
Total release size: 12.5 kB
Release files / bump_py_version-2.1.2.tar.gz
| Download URL | bump_py_version-2.1.2.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed5048d36a1878a144c46e4a0b2dad65a078fdc03896ab84053e96e583979158
|
|
BLAKE2b-256 checksum How to use checksums |
cbbf93df1f14b1deb0c88a212f6612e97f70a5811e84cc4e5e2a51b889eabc6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / bump_py_version-2.1.2-py3-none-any.whl
| Download URL | bump_py_version-2.1.2-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a9b44758bb8608edb192d7c023e486f0f36eda7f09dd7502731acdeab57c070
|
|
BLAKE2b-256 checksum How to use checksums |
bef589a008190790b9af8c2c9ef1234c28d9f09032056ce0345b59d5ca5c4c7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for bump-py-version 2.1.2
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.