I’m pleased to announce, with @henryiii as the release manager, that packaging 26.4 is out! This release drops support for Python 3.9.
New features
prepare_environment()andMarker.evaluate_prepared()let you reuse one environment across many marker evaluations.Marker.evaluate()accepts a set of selected names forextra.Requirement,Specifier, andSpecifierSetsupport__replace__calls, whichcopy.replace()uses on Python 3.13+.packaging.tags.interpreter_abi()gives you the ABI tag for the running interpreter.InvalidRequirementandInvalidMarkerexposemessage,source, andspanfor syntax errors.VersionRange.from_bounds()builds a range from explicit bounds,snap_bounds()moves its endpoints to known versions, andrelation()checks subset and disjointness in one pass.
Performance
Across the board our benchmarks show performance improvements. E.g. we see repeatedly filtering with ~= takes about 30% to 45% less time. The first str(marker) call takes about 20% to 30% less time, and repeated calls on the same marker take about 95% less time.
Packaging uses lazy imports on Python 3.15 and later.
Behavior changes and fixes
Markers joined with & or | print with fewer parentheses. Pylock.select() raises an error for unknown extras or dependency groups.
See the changelog for the full list.
Bonus topic
We have a new PubGrub dependecy resolver benchmark to validate packaging’s performance, and it is intended to also be a simple implementation for understanding PubGrub.