Specification 1.0.0

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. Package managers escaped the first circle of dependency hell by quietly bolting sets, ranges and comparators onto a spec that never defined them, each in its own dialect: ^1.2.3 in npm and Composer, ~> 1.2 in Bundler, a bare 1.2.3 that means a caret in Cargo, ~=1.2 in pip, [1.0,2.0) in Maven and NuGet. That is how we 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 published and ready to build on. The reference parser (semantic-versions) and its ports to seven other languages track the specification and pass a shared conformance suite, and the work is being stewarded toward an open standards body. It is also written to become Semantic Versioning 3.0.0, if there is enough interest in taking it upstream. Corrections and proposals are welcome in the repository.