A permitted prerelease must still satisfy the version specifier, and a floor accepts later prereleases
FactVerified 2 Oct 2026Holds anywhere
Fact. A statement and the evidence for it.
Statement#
When prereleases are permitted (--pre, or a specifier with a dev version), a prerelease must satisfy the specifier the same as a final release. The installer then takes the newest version that matches.
>=2.2.0is only a floor. It accepts prereleases of 2.2.x, 2.3.0 and 3.x.- To stop at a major version, add a cap:
>=2.2.0,<3rejects all 3.x versions, also3.0.0.dev0. ~=2.2.0accepts only 2.2.x.X.Y.Z.postN.dev0sorts afterX.Y.Z, so>=X.Y.Zaccepts it.X.Y.Z.dev0andX.Y.ZrcNsort beforeX.Y.Z, so>=X.Y.Zrejects them.
Evidence#
packaging.specifiers.SpecifierSet(s).filter(versions, prereleases=True) on 2026-10-02, with the versions 2.2.0.dev0, 2.2.0rc1, 2.2.0, 2.2.0.post1.dev0, 2.2.5.post3.dev0, 2.3.0.post1.dev0, 3.0.0.dev0, 3.0.0, 3.1.0.post2.dev0:
>=2.2.0accepts all but 2.2.0.dev0 and 2.2.0rc1>=2.2.0,<3accepts 2.2.0, 2.2.0.post1.dev0, 2.2.5.post3.dev0, 2.3.0.post1.dev0~=2.2.0accepts 2.2.0, 2.2.0.post1.dev0, 2.2.5.post3.dev0
Later case: A version floor with a .dev0 part in pyproject.toml (for example dftracer-utils>=0.0.14.dev0) enables prereleases for that package only. Plain uv pip install -e . then took the dev wheels of the two named packages and the final release of httpx (0.28.1).
Also found by searching
- does a prerelease still have to satisfy the version specifier in pyproject.toml
- with --pre does >=2.2.0 accept a 2.3.0 or 3.0.0 dev version
- how do I stop pip --pre from taking a prerelease of the next major version
- is 2.2.0.post1.dev0 newer than 2.2.0