Semantic versioning
Semantic versioning
Semantic versioning (often abbreviated as SemVer) is a versioning scheme for software that aims to convey meaning about the underlying changes in a release. It uses a three-part version number: MAJOR.MINOR.PATCH, where each component is incremented based on the type of change introduced.
Under semantic versioning, a version number is considered "stable" once it reaches 1.0.0. Prior to that, versions in the 0.x range are commonly used for initial development and may break backward compatibility at any time. The system is widely adopted in the open‑source ecosystem, especially for package managers such as npm, RubyGems, and Packagist.
History
The concept was formalized by Tom Preston-Werner in 2011, inspired by the need for a clear, machine‑readable way to manage dependency upgrades. The specification was published at semver.org and has since become a de facto standard in many programming communities. Version 2.0.0 of the specification was released in 2013, adding support for build metadata and pre‑release identifiers.
Specification
The core rules of semantic versioning are:
- MAJOR version: incremented when incompatible API changes are made.
- MINOR version: incremented when functionality is added in a backward‑compatible manner.
- PATCH version: incremented when backward‑compatible bug fixes are made.
- Pre‑release versions (e.g., `1.0.0-alpha.1`) have lower precedence than the corresponding normal version.
- Build metadata (e.g., `+20130313144700`) does not affect version precedence.
Adherence to semantic versioning helps developers understand the risk of upgrading a dependency and enables automated tools to resolve dependency hell. Many projects also publish a changelog that follows the same MAJOR/MINOR/PATCH structure.