Version Range Translator

Type one version range. See how npm, Cargo, Composer, PEP 440 and RubyGems each read that exact string, as plain comparators tested against versions you list.

The same string, five readings. ~1.2 stops below 1.3 in npm and Cargo but below 2.0 in Composer. ~>1.2 stops below 1.3 in npm but below 2.0 in RubyGems. A bare 1.2 is 1.2.x in npm, below 2.0.0 in Cargo, exactly 1.2.0 in Composer and RubyGems, and not a valid specifier in PEP 440. Each ecosystem is following its own published or implemented grammar. This page runs a port of each one, offline.

Input

Presets

Where the answers differ

Five readings

Test versions

Each cell shows how that ecosystem parses the literal line, whether it matches the requirement, and whether the ecosystem's default policy would admit it. A row marked on the left gets different answers across the valid columns.

Every test version under every grammar

Equivalent spelling

Pick a source ecosystem. If its reading reduces to one interval (an optional lower bound and an optional upper bound), the page writes that interval in each target's plain comparator syntax, then re-reads every emitted string with the target's own engine against your test versions. The live agreement count is the only claim. No emitted form is claimed to be exactly equivalent.

Self test

Runs on load. Expected values were produced by the real engines and by the upstream test suites, then frozen into this page. The count below is computed now, in your browser.

Not run yet.

Separators and pre-releases, per grammar

What joins comparators, and where pre-releases are decided
GrammarCommaWhitespaceORHyphen rangePre-release: matches the requirementPre-release: admitted by default
npmRefusedAND||YesOnly if a comparator with the same major.minor.patch carries a pre-releaseSame as the match
CargoAND (required)Refused between comparatorsRefusedNoSame rule as npmSame as the match
ComposerANDAND|| or |YesMatching ignores stability, so >=1.2 matches 1.3.0-RC1Held back by minimum-stability, which defaults to stable. A stability flag such as @beta overrides it. In a root requirement, a single-token constraint that names a pre-release, such as ^1.2.3-beta.2, sets that flag by itself
PEP 440ANDRefused between clausesRefusedNoExclusive comparisons have extra rules (<1.5 refuses 1.5.0rc1)Depends on the candidate set: pre-releases are kept only when no final or post release matches, or when a specifier names a pre-release
RubyGemsSeparate requirement strings (this page splits on commas)Refused between comparatorsRefusedNoGem::Requirement#satisfied_by? admits pre-releasesGem::Dependency#match? excludes them unless the requirement names one

PEP 440 notes: already-installed pre-releases are not modelled. The --pre box above models an explicit user request. Composer notes: this page models the default minimum-stability, explicit @ stability flags, and the flag Composer infers when a root requirement names a pre-release in a single-token constraint (^1.2.3-beta.2 admits beta and above). It reads the range as your own composer.json require; a dependency's requirements get no inferred flag.