Skip to content

sparkles:versions

An ecosystem-aware version library for D. It parses, compares, and constrains the version strings of many package ecosystems — Semantic Versioning, PEP 440 (PyPI), Maven, Debian, CalVer, and several internal schemes — and interoperates with pURL (Package URL) and VERS (version-range URI).

Each ecosystem is one hand-written struct (SemVer, PypiVersion, DebianVersion, …) conforming to a tiny compile-time concept; generic algorithms — ranges, sorting, satisfaction — work over any conforming type. Cross-scheme comparison does not compile, so you cannot accidentally ask whether a Debian version is "greater than" a PyPI one.

d
import sparkles.versions.schemes.semver : SemVer;

auto a = SemVer.parse("1.2.3-rc.1").value;
auto b = SemVer.parse("1.2.3").value;
assert(a < b);          // a prerelease precedes its release

How this documentation is organised

These docs follow the Diátaxis framework: four sections, each answering a different kind of question. If you are not sure where to start, read the tutorial.

Tutorial

Learning-oriented. A single guided walk that has you parsing, comparing, sorting, and range-testing versions in one runnable program. Start here if you are new to the library.

How-to guides

Task-oriented. Short, focused recipes for a specific job. Reach for these when you already know what you want to do.

Reference

Information-oriented. Precise, lookup-style descriptions of what the library provides.

  • Concepts and API — the three concepts (isVersion, isVersionRange, isVersionScheme), the capability vocabulary, and the public surface, with pointers into the normative SPEC.
  • Scheme catalogue — every shipped scheme: its pURL type, examples, ordering rules, capabilities, native-range grammar, and provenance.
  • API index — the public symbols by module.

Explanation

Understanding-oriented. The reasoning, history, and trade-offs behind the design.

  • The design — why per-ecosystem structs over a generating engine, and the required/optional concept split.
  • Prior art — what pubgrub, Maven Aether, univers, and Repology taught us.
  • No cross-scheme order — why comparing across ecosystems is deliberately impossible.
  • Prerelease in ranges — the node-semver rule and why we adopted it.

See also