How to version  your Python application?

How to version your Python application?

"Efficient software versioning with bump2version: Choosing the right versioning method for your project."

Versioning is important because it provides a clear way to track changes to software or other products over time. Here are a few reasons why versioning is important:

  1. Helps with organization and collaboration: Versioning allows developers and other team members to easily track changes to code or other files. By using version numbers, it's easy to see which version of a file was used for a specific release or feature.

  2. Facilitates troubleshooting and bug fixing: Versioning helps with troubleshooting by allowing developers to pinpoint the exact version of a file or code base where a bug was introduced. This makes it easier to identify and fix issues quickly.

  3. Supports backward compatibility: Versioning is crucial for backward compatibility. By using version numbers, developers can ensure that new versions of a software or product are compatible with previous versions, which is important for maintaining user trust.

  4. Enables controlled releases: Versioning also makes it easier to control the release of new features or updates. By using version numbers, developers can release updates in a controlled and predictable way, making it easier to manage user expectations and prevent issues.

Types of Versioning

  1. Sequential versioning: Each new version is given a sequentially incremented number (e.g. 1.0, 1.1, 1.2, etc.). This type of versioning is often used in software development to track the release of new features or bug fixes.

  2. Semantic versioning: Version numbers include three numbers for major, minor, and patch versions (e.g. 1.2.3), used to communicate changes and compatibility to users and other developers. Major versions indicate incompatible changes, minor versions indicate new features, and patch versions indicate bug fixes. This type of versioning is often used in open-source software development.

  3. Date-based versioning: With date-based versioning, the version number includes a date or timestamp. This type of versioning can be useful for tracking changes over time and ensuring that users are using the latest version of a product.

  4. Branch-based versioning: Each branch in a version control system is assigned a version number. This can be useful for managing multiple versions of a codebase simultaneously, such as for testing or experimental features.

  5. Revision control versioning: With revision control versioning, each new version is assigned a unique identifier based on the changes made to the file or codebase. This type of versioning is often used in version control systems like Git to track changes and collaborate with others.

How to version your Python apps?

Bump2version is a command-line tool that allows you to easily update version numbers in your project. Here's how you can use it:

  1. Install bump2version using pip: pip install bump2version.

  2. Add bump2version as a dev dependency to your project by adding it to the [dev-dependencies] section of your pyproject.toml file.

  3. Create a .bumpversion.cfg file in the root of your project directory with the following content:

current_version = {version}
commit = True
tag = True
tag_name = {new_version}
message = Bump version: {current_version} → {new_version}

  1. To use bump2version to increment the package version, run the command bumpversion [part], where [part] is the part of the version to increment (e.g. major, minor, patch). This will update the version number in the file and create a Git tag with the new version number.

  2. Commit and push the changes to your version control system.

That's it! Now you can use bump2version to increment the version of your Flit package and Flit will automatically read the new version number from your package's file during installation.


  • You can now use bump2version to easily update the version number in your project.

  • Versioning is crucial in software development, choose what works for your project and don't be afraid to experiment!

Did you find this article valuable?

Support Nikhil Akki by becoming a sponsor. Any amount is appreciated!