Semantic Versioning Explained

Nemuel Wainaina
3 min readJul 20, 2023

--

Source : python.org

Introduction

As of 20th July 2023, the latest version of Python is 3.11.4 . Note the 3 numbers separated by ‘.’ . Several other programs have a similar version notation, and in this guide we shall be taking a deeper look at the Semantic Versioning Scheme, which is of the above format .

Versioning Schemes

A versioning scheme is a standardized way of assigning version numbers to software releases or any other products to convey information about changes and compatibility . Different versioning schemes are used depending on the context and requirements of the project . Over the years, a variety of versioning schemes have been adopted for various projects, and here is a list of some of the commonly used ones :

  • Semantic Versioning (SemVer)
  • Date-Based Versioning
  • Sequential Versioning
  • Calendar Versioning (CalVer)
  • Alphabetical Versioning
  • Hybrid Versioning

While all these apply to different projects based on the context, Semantic Versioning remains the most popular and widely adopted scheme, owing to its clear and logical structure .

Semantic Versioning (SemVer)

Now that we have a general idea of versioning schemes, it’s time to understand semantic versioning . It follows the format : MAJOR.MINOR.PATCH . Therefore, in the latest Python version, the major version is 3, the minor version is 11 and the patch version is 4 . Let’s take a closer look at these :

MAJOR : This number gets incremented when backward-incompatible changes are introduced to the code . This indicates that major changes or significant updates have been made to the product . For example, a python3 interpreter cannot interpret code written in python2, hence the increment from 2 to 3, get it ?

MINOR : This number gets incremented when backward-compatible changes are made . New capabilities have been added to the software, but the additions don’t break backward-compatibility . For example, if the developers of Python introduce a new feature in Python 3 to improve its performance, this number will get incremented by 1 . Just have one thing in mind, new features that do not break backward-compatibility .

PATCH : This number gets incremented for backward-compatible bug fixes and minor updates that do not introduce new features . These updates should by no means affect compatibility with the previous version .

In addition to the 3 parts, SemVer allows for an optional suffix of pre-release and build metadata . Let’s look at that now :

Pre-release version : If a version is considered as not being stable, or is still a work in progress, we can add a hyphen followed by a sequence of alphanumeric characters eg, alpha.1, beta . The resulting version number will be something like this : 1.0.0-alpha.1 . Note that these versions are usually less stable and may change before the final release !

Build metadata : The version can also include build metadata, which gets appended after a plus sign (+) eg. 1.0.0+35235323 . Note that this does not affect version precedence and is typically used for build identification .

Conclusion

Congrats on making it this far ! I believe you now know what those numbers represent, as well as how you can leverage SemVer in your own software or product releases . You can try breaking down the version numbers of your favorite software and comparing it with previous ones to understand this better . Also, please take time to look into the other versioning schemes as well .

Let’s connect !

LinkedIn : https://linkedin.com/in/nemuel-wainaina

Twitter : https://twitter.com/_nemuelw

Github : https://github.com/nemzyxt

--

--

Nemuel Wainaina
Nemuel Wainaina

Written by Nemuel Wainaina

Security Researcher | Software Engineer

No responses yet