Semantic Versioning & Release: A Deep Dive

Abdul R. Wahab
3 min readApr 19

--

Background

Software engineering requires constant updates and changes to stay relevant and grow in the market.

As software projects grow in complexity and scale, it becomes increasingly important to have a systematic approach to versioning and releasing software updates.

This is where Semantic Versioning (SemVer) comes in.

In this blog post, I will cover:

  • The basics of Semantic Versioning,
  • Why it is useful,
  • How it can be implemented in Python and TypeScript projects

What is Semantic Versioning?

Semantic Versioning (SemVer) is a versioning system that provides a standardized way of specifying changes and updates to a software project.

It defines a set of rules and guidelines for assigning version numbers to software releases.

A SemVer version number consists of three numbers separated by dots:

Major.Minor.Patch.

  • Major: A major version update indicates significant changes that may introduce backward incompatibilities.
  • Minor: A minor version update indicates the addition of new features or functionality without breaking backward compatibility.
  • Patch: A patch version update indicates bug fixes or small improvements that do not introduce any new features or backward incompatibilities.

Example: A software version number of 2.1.4 indicates that it is a major version 2, minor version 1, and patch version 4 release. The SemVer specification also allows for additional version identifiers such as pre-release and build metadata.

Source: teziger.com

Why is Semantic Versioning useful?

Semantic Versioning is useful for several reasons.

First, it provides a consistent and standardized way of versioning software releases. This makes it easier for developers and users to understand the impact of a particular version update and determine if it is safe to upgrade.

Second, SemVer helps to minimize the risk of introducing breaking changes that can disrupt existing workflows and cause compatibility issues. By clearly indicating the type of update being made, SemVer enables developers to communicate the potential impact of a release to users and stakeholders.

Finally, Semantic Versioning promotes better collaboration and communication within development teams. By using SemVer, developers can ensure that everyone is on the same page regarding the scope and impact of version updates, and can plan releases accordingly.

How can I implement SemVer in Python and TypeScript?

Implementing Semantic Versioning in Python and TypeScript projects is relatively straightforward.

In both cases, I’ll show how we can use libraries that provide support for SemVer versioning.

In Python, we can use the semantic-versioning library to handle versioning. The library provides a simple way to parse, compare, and manipulate version numbers. To use the semantic-versioning library in our Python project, we can install it using pip:

pip install semantic-versioning

We can then use the library to manage our version numbers:

import semantic_versioning as semver

# create a version object
version = semver.Version("1.2.3")

# increment the minor version number
version.next_minor()

# output: "1.3.0"
print(str(version))

In TypeScript, we can use the semver library to handle versioning. The library provides similar functionality to semantic-versioning in Python. To use the semver library in our TypeScript project, we can install it using npm:

npm install semver

We can then use the library to manage our version numbers:

import * as semver from "semver";

// create a version object
const version = semver.parse("1.2.3");

// increment the minor version number
version.minor++;

// output: "1.3.0"
console.log(semver.format(version));

Closing thoughts

Overall, SemVer is a pretty effective way to manage versioning and releases for software products. If you happen to be working in a large codebase, with a large group of teams all working together in the codebase (i.e. a monorepo), the earlier you can implement SemVer, the smoother deployments will be.

Try it out. You can thank me later 🙂

--

--

Implementing a Data Mesh Architecture with AWS Redshift Spectrum and Lake Formation

4 min read

May 7

Using Vault Agent Caching to authenticate to Amazon RDS

3 min read

Apr 21

Different ways to migrate Terraform State

4 min read

May 4

Python ThreadPoolExecutor: Use Cases for Parallel Processing

6 min read

Apr 29

Authenticating to AWS Redshift using Ephemeral Credentials

3 min read

Apr 29

How-to: Create a Custom Terraform Module

4 min read

Apr 21

How-to: Decide whether to use TypeScript or JavaScript

3 min read

Apr 20

How-to: Handle Concurrency & Parallelism in Python

4 min read

Apr 20

How-to: Create a Data Lake using AWS Lake Formation

9 min read

Dec 4, 2022

Study Plan — AWS Certified Cloud Practitioner Exam

2 min read

Jan 17, 2021

Abdul R. Wahab

Multi-domain Technical Lead specialized in building products users love. Today, I manage & secure big data in the AWS cloud. All views shared are my own.