Glossary termVersioning convention

Semantic Versioning

Also known as: SemVer

Versioning convention that encodes compatibility in MAJOR.MINOR.PATCH numbers, signaling breaking changes, added features and bug fixes.

Semantic versioning is a scheme for assigning version numbers to software so that the numbers themselves communicate what changed. A version has three parts, MAJOR.MINOR.PATCH, such as 2.4.1. The patch number increases for backward-compatible bug fixes, the minor number for backward-compatible additions of functionality and the major number for changes that break compatibility with existing users of the software's public API. A move from 2.4.1 to 2.5.0 should be safe to adopt, while 3.0.0 warns that code depending on the software may need to change.

The specification was written by Tom Preston-Werner, a co-founder of GitHub, and version 2.0.0 of it was published in 2013. It also defines pre-release labels, such as 1.0.0-beta.1, and build metadata, and states that versions below 1.0.0 are for initial development, during which anything may change. Package managers such as npm and Cargo rely on these conventions: a dependency declared with a caret range, for instance, accepts any later minor or patch release but not the next major version.

Semantic versioning works only as well as maintainers' judgment about what counts as breaking. Almost any change can break someone who relied on undocumented behavior, and accidental breaking changes in minor releases are common, which is why lock files and automated tests remain important. Some projects prefer alternatives such as calendar versioning, which encodes release dates, as Ubuntu does with version numbers like 24.04. Even so, SemVer has become a widely shared vocabulary for compatibility and underpins dependency resolution across much of the open source world.

Key points

  • Semantic versions take the form MAJOR.MINOR.PATCH, with each part signaling a different kind of change.
  • An increase in the major version warns of breaking changes to the public API.
  • Package managers use semantic version ranges to decide which dependency updates are safe to install automatically.
  • The scheme depends on maintainers correctly judging what is breaking, so tests and lock files remain essential.

Related entries

Glossary term

Package Manager

ProgrammingFOSS

Tool that automates installing, upgrading, configuring and removing software packages and their dependencies from shared repositories.

Glossary term

API

Programming

Defined set of rules and interfaces through which one piece of software can request services or data from another without knowing its internals.

Glossary term

Software Library

Programming

Collection of prewritten, reusable code, such as functions and classes, that programs call on to perform common tasks without reimplementing them.

Glossary term

Version Control

ProgrammingDevOps

System that records changes to files over time so that people can track history, revert mistakes and collaborate on the same codebase.

Technology

GitHub

ProgrammingFOSS

Web platform owned by Microsoft for hosting Git repositories and collaborating on software through pull requests, issues and automation.

Glossary term

Approach to software in which source code is published under a license that lets anyone inspect, modify and redistribute it.

Glossary term

Release policy in which a designated version of software receives security and stability updates for an extended period, longer than standard releases.

Referenced by

Other entries that discuss or point to Semantic Versioning.