Giter VIP home page Giter VIP logo

bump-py-version's Introduction

bump-py-version

This is a simple and opinionated script to bump the version of a python package.

  1. The script will check for any changes in the git repository and abort if there are any.
  2. If there are no changes, it will alter files where a version is set, e.g. pyproject.toml or __init__.py. (Which files to alter are specified in the pyproject.toml file according to the tool.bump_version section.)
  3. The script commits and pushes the changes.
  4. Then a new tag is created using the version tag specified.
  5. Finally the script pushes the tag to the remote repository.

Installation

pipx install git+https://github.com/diversen/[email protected]

Configuration

It may bump the version in a __init__.py file (or similar) using a pyproject settings like the following:

[tool.bump_version]
version_file = "bump_py_version/__init__.py"

Note about setup.py. setup.py should import the version from the __init__.py file. Example:

from bump_py_version import __version__

If you have a pyproject file with a project.version or a tool.poetry.version section then the script will bump these versions too.

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.pip]
file = "README.md"
search = "<!-- LATEST-VERSION-PIP -->"
replace = "\tpip install git+https://github.com/diversen/bump-py-version@{version}\n"

[tool.bump_version.replace_patterns.pipx]
file = "README.md"
search = "<!-- LATEST-VERSION-PIPX -->"
replace = "\tpipx install git+https://github.com/diversen/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.

Usage example

Example:

bump-py-version v0.0.1

bump-py-version's People

Contributors

diversen avatar diversen7 avatar

Stargazers

iSplasher avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.