26.0
Read about the performance improvements here: https://iscinumpy.dev/post/packaging-faster.
What's Changed
Features:
- PEP 751: support pylock by @sbidoul in https://github.com/pypa/packaging/pull/900
- PEP 794: import name metadata by @brettcannon in https://github.com/pypa/packaging/pull/948
- Support writing metadata by @henryiii in https://github.com/pypa/packaging/pull/846
- Support
__replace__forVersionby @henryiii in https://github.com/pypa/packaging/pull/1003 - Support positional pattern matching for
VersionandSpecifierby @henryiii in https://github.com/pypa/packaging/pull/1004
Behavior adaptations:
- PEP 440 handling of prereleases for
Specifier.contains,SpecifierSet.contains, andSpecifierSet.filterby @notatallshaw in https://github.com/pypa/packaging/pull/897 - Handle PEP 440 edge case in
SpecifierSet.filterby @notatallshaw in https://github.com/pypa/packaging/pull/942 - Adjust arbitrary equality intersection preservation in
SpecifierSetby @notatallshaw in https://github.com/pypa/packaging/pull/951 - Return
Falseinstead of raising for.containswith invalid version by @Liam-DeVoe in https://github.com/pypa/packaging/pull/932 - Support arbitrary equality on arbitrary strings for
SpecifierandSpecifierSet'sfilterandcontainsmethod. by @notatallshaw in https://github.com/pypa/packaging/pull/954 - Only try to parse as
Versionon certain marker keys, returnFalseon unequal ordered comparsions by @JP-Ellis in https://github.com/pypa/packaging/pull/939
Fixes:
- Update
_hashwhen unpicklingTag()by @dholth in https://github.com/pypa/packaging/pull/860 - Correct comment and simplify implicit prerelease handling in
Specifier.prereleasesby @notatallshaw in https://github.com/pypa/packaging/pull/896 - Use explicit
_GLibCVersionNamedTuplein_manylinuxby @cthoyt in https://github.com/pypa/packaging/pull/868 - Detect invalid license expressions containing
()by @bwoodsend in https://github.com/pypa/packaging/pull/879 - Correct regex for metadata
'name'format by @di in https://github.com/pypa/packaging/pull/925 - Improve the message around expecting a semicolon by @pradyunsg in https://github.com/pypa/packaging/pull/833
- Support nested parens in license expressions by @Liam-DeVoe in https://github.com/pypa/packaging/pull/931
- Add space before at symbol in
Requirementsstring by @henryiii in https://github.com/pypa/packaging/pull/953 - A root logger use found by ruff LOG, use
packaginglogger instead by @henryiii in https://github.com/pypa/packaging/pull/965 - Better support for subclassing
MarkerandRequirementby @henryiii in https://github.com/pypa/packaging/pull/1022 - Normalize all extras, not just if it comes first by @henryiii in https://github.com/pypa/packaging/pull/1024
- Don't produce a broken repr if
Markerfails to construct by @henryiii in https://github.com/pypa/packaging/pull/1033
Performance:
- Avoid recompiling regexes in the tokenizer for a 3x speedup by @hauntsaninja in https://github.com/pypa/packaging/pull/1019
- Improve performance in
_manylinux.pyby @cthoyt in https://github.com/pypa/packaging/pull/869 - Minor cleanups to
Versionby @bearomorphism in https://github.com/pypa/packaging/pull/913 - Skip redundant creation of
Versions in specifier comparison by @notatallshaw in https://github.com/pypa/packaging/pull/986 - Cache
Specifier's Version by @notatallshaw in https://github.com/pypa/packaging/pull/985 - Make
Versiona little faster by @henryiii in https://github.com/pypa/packaging/pull/987 - Minor
Versionregex cleanup by @henryiii in https://github.com/pypa/packaging/pull/990 - Faster regex on Python 3.11.5+ by @henryiii in https://github.com/pypa/packaging/pull/988 and https://github.com/pypa/packaging/pull/1055
- Lazily calculate
_keyinVersionby @notatallshaw in https://github.com/pypa/packaging/pull/989 and regression forpackaging_legacyfixed by @henryiii in https://github.com/pypa/packaging/pull/1048 - Faster
canonicalize_versionby @henryiii in https://github.com/pypa/packaging/pull/993 - Use
fullmatchin a couple more places by @henryiii in https://github.com/pypa/packaging/pull/992 - Use
fullmatchfor markers too by @henryiii in https://github.com/pypa/packaging/pull/1029 - Use
mapinstead of generator by @henryiii in https://github.com/pypa/packaging/pull/996 - Deprecate
._version(_Version, aNamedTuple) by @henryiii in https://github.com/pypa/packaging/pull/995 and https://github.com/pypa/packaging/pull/1062 - Avoid duplicate
Versioncreation incanonicalize_versionby @henryiii in https://github.com/pypa/packaging/pull/994 - Add
__slots__toVersionby @henryiii in https://github.com/pypa/packaging/pull/1001 - Add
__slots__toSpecifiers by @henryiii in https://github.com/pypa/packaging/pull/1002 - Add
__slots__toNodes by @henryiii in https://github.com/pypa/packaging/pull/1032 - Use
version.__replace__in specifier comparison by @notatallshaw in https://github.com/pypa/packaging/pull/999 - Use
_get_spec_versionin more places inSpecifierby @notatallshaw in https://github.com/pypa/packaging/pull/1005 - Pull
setconstruction out of function by @henryiii in https://github.com/pypa/packaging/pull/1012 - Letter normalization dict for prereleases and the like by @henryiii in https://github.com/pypa/packaging/pull/1014
- Avoid normalizing extras again when comparing by @henryiii in https://github.com/pypa/packaging/pull/1028
- Speed up
Version.__str__by about 10% by @henryiii in https://github.com/pypa/packaging/pull/997 - Increase the performance of
canonicalize_nameby avoiding a regex by @henryiii in https://github.com/pypa/packaging/pull/1030, https://github.com/pypa/packaging/pull/1047, and https://github.com/pypa/packaging/pull/1064 - Faster zero stripping by @henryiii in https://github.com/pypa/packaging/pull/1058
Type annotations:
- Fix a type annotation by @brettcannon in https://github.com/pypa/packaging/pull/907
- Fix tags return type in
parse_wheel_filenamedocs by @ncoghlan in https://github.com/pypa/packaging/pull/973 - Add type hint for
_versionin.version.Versionby @brettcannon in https://github.com/pypa/packaging/pull/927 - Changed static type annotations in prereleases setter method in
specifier.pyby @subhajitsaha01 in https://github.com/pypa/packaging/pull/930 - Statically type the tests by @henryiii in https://github.com/pypa/packaging/pull/982
Internal:
- Test and declare support Python 3.14 by @henryiii in https://github.com/pypa/packaging/pull/901
- Modernize and speed up tests on Python 3.14 by @henryiii in https://github.com/pypa/packaging/pull/903
- Change our license metadata to use an SPDX license expression by @cdce8p in https://github.com/pypa/packaging/pull/881
- No need for
license-filesby @DimitriPapadopoulos in https://github.com/pypa/packaging/pull/924 - Update mypy by @hauntsaninja in https://github.com/pypa/packaging/pull/891
- Some config updates by @henryiii in https://github.com/pypa/packaging/pull/902
- Add spell check and rst check by @henryiii in https://github.com/pypa/packaging/pull/904
- Clean up ruff ignores by @henryiii in https://github.com/pypa/packaging/pull/905
- Update example for env marker
python_versionby @trim21 in https://github.com/pypa/packaging/pull/908 - Move codespell configuration into pyproject.toml by @yarikoptic in https://github.com/pypa/packaging/pull/910
- Check warning a little more precisely by @henryiii in https://github.com/pypa/packaging/pull/837
- Speed up mypy a little by @henryiii in https://github.com/pypa/packaging/pull/836
- Apply ruff/flake8-pyi rules (PYI) by @DimitriPapadopoulos in https://github.com/pypa/packaging/pull/835
- Better local runs for codespell by @henryiii in https://github.com/pypa/packaging/pull/911
- Remove outdated/confusing Gist link by @stefan6419846 in https://github.com/pypa/packaging/pull/921
- Fix docs and docs ci after #897 landed by @notatallshaw in https://github.com/pypa/packaging/pull/926
- Run twine-check on push in CI by @EpicWink in https://github.com/pypa/packaging/pull/922
ruffwas renamedruff-checkin pre-commit by @henryiii in https://github.com/pypa/packaging/pull/933- Fix incorrectly implicitly concatenated string in specifiers test by @notatallshaw in https://github.com/pypa/packaging/pull/946
- Simplify conditional by @ofek in https://github.com/pypa/packaging/pull/949
- Modernize nox, use dependency-groups for tests by @henryiii in https://github.com/pypa/packaging/pull/952
- Add more checks that don't affect anything by @henryiii in https://github.com/pypa/packaging/pull/957
- Enable Ruff ISC rule by @henryiii in https://github.com/pypa/packaging/pull/959
- Ruff code FLY by @henryiii in https://github.com/pypa/packaging/pull/963
- pytest
log_levelis better thanlog_cli_levelby @henryiii in https://github.com/pypa/packaging/pull/956 - Ruff code TRY by @henryiii in https://github.com/pypa/packaging/pull/961
- Add the ruff PL checks by @henryiii in https://github.com/pypa/packaging/pull/964
- Enable Ruff ARG rules by @henryiii in https://github.com/pypa/packaging/pull/958
- Ruff PT code (pytest) by @henryiii in https://github.com/pypa/packaging/pull/960
- Add ruff DTZ by @henryiii in https://github.com/pypa/packaging/pull/968
- Add ruff BLE by @henryiii in https://github.com/pypa/packaging/pull/967
- Add the ruff SIM checks by @henryiii in https://github.com/pypa/packaging/pull/966
- Adding ruff PERF by @henryiii in https://github.com/pypa/packaging/pull/969
- Move some config into coverage config by @henryiii in https://github.com/pypa/packaging/pull/971
- Check ruff C4 by @henryiii in https://github.com/pypa/packaging/pull/962
- Adding ruff T20 by @henryiii in https://github.com/pypa/packaging/pull/972
- Add a tests pass job by @henryiii in https://github.com/pypa/packaging/pull/977
- Add ruff TC by @henryiii in https://github.com/pypa/packaging/pull/980
- Adding part of ruff RET by @henryiii in https://github.com/pypa/packaging/pull/979
- Reorder mypy check by @henryiii in https://github.com/pypa/packaging/pull/983
- Enable ruff ALL by @henryiii in https://github.com/pypa/packaging/pull/984
- Link back to repo/source in furo by @henryiii in https://github.com/pypa/packaging/pull/991
- Add case insensitivity tests for arbitrary equality by @notatallshaw in https://github.com/pypa/packaging/pull/975
- Synchronize documentation and code for markers by @zahlman in https://github.com/pypa/packaging/pull/1008
- Use
partitionin_parse_project_urlsby @henryiii in https://github.com/pypa/packaging/pull/1013 - auto-skip the dependabot PRs in the release changelog generation by @henryiii in https://github.com/pypa/packaging/pull/1016
- Update unreleased section in changelog by @henryiii in https://github.com/pypa/packaging/pull/1017
- Fix PR role to match extlinks by @hugovk in https://github.com/pypa/packaging/pull/1020
- Mention new parts in README by @henryiii in https://github.com/pypa/packaging/pull/1023
- Replace a couple of asserts with else by @henryiii in https://github.com/pypa/packaging/pull/1027
- Simplify and/or check a little more by @henryiii in https://github.com/pypa/packaging/pull/1031
- Use slim runner for all check by @henryiii in https://github.com/pypa/packaging/pull/1021
- Use typos instead of codespell by @henryiii in https://github.com/pypa/packaging/pull/1015
- Update changelog with recent additions by @henryiii in https://github.com/pypa/packaging/pull/1034
- Publish to PyPI via GitHub CI by @EpicWink in https://github.com/pypa/packaging/pull/893
- Use prek for faster pre-commit lint step by @henryiii in https://github.com/pypa/packaging/pull/1037
- Add help text to noxfile by @henryiii in https://github.com/pypa/packaging/pull/1038
- Update licenses to 3.27 by @henryiii in https://github.com/pypa/packaging/pull/1036
- Use relative import in
packaging.licensesby @notatallshaw in https://github.com/pypa/packaging/pull/1039 - Add zizmor and tighten up CI by @henryiii in https://github.com/pypa/packaging/pull/1035
- Fix release script by @henryiii in https://github.com/pypa/packaging/pull/1040
- Fix using a dev version (again) by @henryiii in https://github.com/pypa/packaging/pull/1041
- Fix type hint of function used with
contextlib.contextmanagerby @SpecLad in https://github.com/pypa/packaging/pull/1046 - Always run tests by @henryiii in https://github.com/pypa/packaging/pull/1044
- Fix a changelog number by @henryiii in https://github.com/pypa/packaging/pull/1042
- Fix the publish job by @henryiii in https://github.com/pypa/packaging/pull/1043
- Get the correct tag on publish by @henryiii in https://github.com/pypa/packaging/pull/1045
- Test on first public release of CPython 3.11 and newer by @henryiii in https://github.com/pypa/packaging/pull/1056
- Fix publication job (again) by @henryiii in https://github.com/pypa/packaging/pull/1051
- Use
actionlintto check CI workflows by @miketheman in https://github.com/pypa/packaging/pull/1052 - Fix formatting of distribution types in metadata.rst by @brettcannon in https://github.com/pypa/packaging/pull/1053
New Contributors
- @cdce8p made their first contribution in https://github.com/pypa/packaging/pull/881
- @dholth made their first contribution in https://github.com/pypa/packaging/pull/860
- @trim21 made their first contribution in https://github.com/pypa/packaging/pull/908
- @yarikoptic made their first contribution in https://github.com/pypa/packaging/pull/910
- @cthoyt made their first contribution in https://github.com/pypa/packaging/pull/868
- @bwoodsend made their first contribution in https://github.com/pypa/packaging/pull/879
- @stefan6419846 made their first contribution in https://github.com/pypa/packaging/pull/921
- @bearomorphism made their first contribution in https://github.com/pypa/packaging/pull/913
- @EpicWink made their first contribution in https://github.com/pypa/packaging/pull/922
- @Liam-DeVoe made their first contribution in https://github.com/pypa/packaging/pull/932
- @subhajitsaha01 made their first contribution in https://github.com/pypa/packaging/pull/930
- @ncoghlan made their first contribution in https://github.com/pypa/packaging/pull/973
- @zahlman made their first contribution in https://github.com/pypa/packaging/pull/1008
- @JP-Ellis made their first contribution in https://github.com/pypa/packaging/pull/939
Since last RC
Fixes:
- Restore
._versionas a compat shim by @henryiii in https://github.com/pypa/packaging/pull/1062
Performance:
- Dual replace by @henryiii in https://github.com/pypa/packaging/pull/1064
Documentaiton:
- Prepare for 26.0 final by @henryiii in https://github.com/pypa/packaging/pull/1063
Full Changelog: https://github.com/pypa/packaging/compare/26.0rc3...26.0