Fundamentals5 min readLast updated: Sun Mar 24 2024 00:00:00 GMT+0000 (Coordinated Universal Time)

Semantic Versioning (SemVer)

Software version numbers like 2.14.3 are not random. They follow a strict standard called Semantic Versioning.

The Format: MAJOR.MINOR.PATCH

1. MAJOR (The Breaking Change)

1.0.0 -> 2.0.0
Increment this when you make incompatible API changes.

  • Example: You removed a function. Old code will crash if it updates to this version.

2. MINOR (The Feature)

1.1.0 -> 1.2.0
Increment this when you add functionality in a backward-compatible manner.

  • Example: You added a new button or a new API endpoint. Old code works fine, but there are new toys to play with.

3. PATCH (The Fix)

1.1.1 -> 1.1.2
Increment this when you make backward-compatible bug fixes.

  • Example: You fixed a typo or a security hole. No features changed.

Dependency Hell

SemVer is critical for package managers like NPM or PIP.
When you install a library with ^1.2.0 (caret), you are telling the computer:
"I accept any update that does NOT change the leftmost non-zero digit."

  • It will auto-update to 1.2.1 or 1.3.0.
  • It will block 2.0.0 because that might break your app.