Specification · 1.0.0

Software versions are a
communication mechanism.

Semantic Versions is an open specification for how version numbers are
assigned, incremented, grouped, compared and matched.
A spiritual successor to Semantic Versioning 2.0.0-rc.1.

anatomy of a version
npm:react@1.2.3-beta.4+build.7
# source:name @ major.minor.patch-prerelease+build

Why a new spec

Versioning should mirror how software actually changes.

Semantic Versioning 2.0.0 is more than a decade old, has not meaningfully changed in that time, and has no realistic path to a 3.0. The way we ship software has moved on. JavaScript avoided the first circle of dependency hell only because tooling quietly bolted sets, ranges and comparators onto a spec that never defined them. We have since landed in a deeper circle, where package managers read the same version differently and resolve to different graphs.

A specification is a language, and it is only as good as the definitions it contains. Software changes over time and sometimes breaks; that is natural, and necessary for growth. A versioning spec exists to codify the signals that communicate change, so it should codify the ones we actually use.

What changed

Corrected definitions, restored meaning, formal grammars.

01

Patch, corrected

A patch is a fix for behaviour that was never intended, not a promise of backward compatibility (which is practically impossible to guarantee). The definition is amended so a fix stays a fix.

02

Builds get their precedence back

2.0.0-rc.2 turned builds into inert "build metadata," making every build of a version equivalent. Two artifacts with different hashes or architectures are distinct software, so builds order again.

03

Sets & subsets

Precedence alone can't describe a collection of versions. This spec defines ordered, unordered, normal, prerelease and build sets: the vocabulary you need to manage more than one version at a time.

04

Ranges & comparators

Comparators (>=1.2.7), comparator sets, hyphen ranges, x-ranges, tilde and caret. The grammar tools already ship, defined so they desugar to primitive comparators in one deterministic way.

05

Approximate ranges (~>)

The pessimistic operator, borrowed from the Ruby world, is defined explicitly rather than left to each tool's imagination.

06

A reference implementation & BNF

Backus–Naur grammars for versions, ranges and comparators, plus a parser you can read, so anyone can build a compliant library.

Status of this document

Semantic Versions 1.0.0 is a release candidate. Its definitions are intended to be scrutinized, tested and refined; a reference parser (semantic-versions) tracks the specification, and the work is being stewarded toward an open standards body. Corrections and proposals are welcome in the repository.