Skip to main content

Poetry plugin to update __version__ in __init__ file and other files containing version strings

Project description

Logo

The poetry version command only updates version in pyproject.toml file. This plugin updates version in other files when poetry version <version> command is executed.

Build Status Coverage Status Python Versions PyPI version Licence

Getting Started

Prerequisites

  • poetry = ^1.2.0a2

Install

Install the plugin by poetry plugin command.

poetry self add poetry-bumpversion

Configure version replacements

Say you have __version__ variable set at your_package/__init__.py file

__version__ = "0.1.0" # It MUST match the version in pyproject.toml file

Add the following to your pyproject.toml file.

[tool.poetry_bumpversion.file."your_package/__init__.py"]
# Duplicate the line above to add more files

Now run poetry version patch --dry-run, if your output looks somewhat like below you are all set (dry-run does not update any file).

Bumping version from 0.5.0 to 0.5.1
poetry-bumpversion: processed file: your_package/__init__.py

If dry-run output looks fine you can run version update command without dry-run flag to check if version in both pyproject.toml and your_package/__init__.py file has been updated.

Advanced Usage

You can define search and replace terms to be more precise

[tool.poetry_bumpversion.file."your_package/__init__.py"]
search = '__version__ = "{current_version}"'
replace = '__version__ = "{new_version}"'

You can define replacements if you have same search/replace patterns across multiple files.

[[tool.poetry_bumpversion.replacements]]
files = ["your_package/__init__.py", "your_package/version.py"]
search = '__version__ = "{current_version}"'
replace = '__version__ = "{new_version}"'

[[tool.poetry_bumpversion.replacements]]
files = ["README.md"]
search = 'version: {current_version}'
replace = 'version: {new_version}'

License

This project is licensed under MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry-bumpversion-0.3.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

poetry_bumpversion-0.3.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file poetry-bumpversion-0.3.0.tar.gz.

File metadata

  • Download URL: poetry-bumpversion-0.3.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.8.10 Linux/5.15.0-1020-azure

File hashes

Hashes for poetry-bumpversion-0.3.0.tar.gz
Algorithm Hash digest
SHA256 aeff169c5bfa93d6c8542ba06b0545e02db91252a65d25317cd5c7e10d91dfd6
MD5 5dc84db3b78f2b9432c730eb24a03c24
BLAKE2b-256 1f316381ce6ba139c687aa1846ad63352e3f1908b0a2c1a2418073e1feea6a68

See more details on using hashes here.

File details

Details for the file poetry_bumpversion-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_bumpversion-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57dbfa4c986f55e97769f95967495559cb99e58a7ee587a1ecb3cd81d1f93464
MD5 24d1d0599aacb997f6498ba34674b74d
BLAKE2b-256 83503021545f6824987a542839e243f9e67b6e15b5ca219a0cee4f5f9705aa01

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page