Opened 7 days ago

Closed 20 hours ago

#6090 closed enhancement (fixed)

packaging-26.4 (Python module)

Reported by: Bruce Dubbs Owned by: lfs-book
Priority: normal Milestone: 13.2
Component: Book Version: git
Severity: normal Keywords:
Cc:

Description

New minor version.

Change History (2)

comment:1 by Bruce Dubbs, 22 hours ago

26.4 - 2026-11-23

Removals:

  • Drop support for EOL Python 3.9. (:pull:1354)

Features:

  • Add :func:~packaging.markers.prepare_environment and :meth:Marker.evaluate_prepared() <packaging.markers.Marker.evaluate_prepared> to evaluate many markers against one prepared environment. Pylock.select() now uses them. (:pull:1469)
  • Add replace to :class:~packaging.requirements.Requirement, :class:~packaging.specifiers.Specifier, and :class:~packaging.specifiers.SpecifierSet, for copy.replace() on Python 3.13+. (:pull:1377, :pull:1457)
  • Add :meth:VersionRange.from_bounds() <packaging.ranges.VersionRange.from_bounds> to make a range from explicit bounds. (:pull:1475)
  • Add :meth:VersionRange.snap_bounds() <packaging.ranges.VersionRange.snap_bounds> to move range endpoints onto known versions. (:pull:1477)
  • Add :meth:VersionRange.relation() <packaging.ranges.VersionRange.relation> and :class:~packaging.ranges.RangeRelation, which give containment and disjointness in one pass. (:pull:1473)
  • Add :func:~packaging.tags.interpreter_abi. (:pull:611)
  • Marker.evaluate() accepts a set of names for extra, to evaluate a marker against several selected extras at once. (:pull:1438)
  • Add message, source, and span attributes to :class:~packaging.requirements.InvalidRequirement and :class:~packaging.markers.InvalidMarker for syntax errors.

Behavior adaptations:

  • str() of markers joined with & or | has fewer parentheses when unambiguous. Evaluation and parsed markers do not change. (:pull:1510)
  • The pylock and direct_url dataclasses use slots. Pickles from 26.3 still load. (:pull:1366, :pull:1548)
  • Version.replace() raises TypeError for unknown keyword arguments instead of ignoring them. (:pull:1378)

Fixes for versions and specifiers:

  • Parse plain strings in the iterable form of SpecifierSet, and raise TypeError for elements that are not Specifier or str. (:pull:1485)
  • Reject an empty arbitrary-equality version (===) in specifiers and requirements. (:pull:1430)
  • Reject non-ASCII letters in ~= pre, post, and dev segments. (:pull:1384)
  • Keep the explicit pre-release opt-in of a literal pre-release version that overlaps an ordinary bound in a VersionRange. (:pull:1511)
  • Support copy and pickle for VersionRange, which raised TypeError before. (:pull:1504)

Fixes for requirements and markers:

  • Reject all whitespace in the URL of a requirement, including Unicode whitespace such as a no-break space. (:pull:1379)
  • Parse === followed by a comma and a spaced specifier in a requirement. (:pull:1531)
  • Keep the prereleases override of each specifier when a Requirement is pickled or copied. (:pull:1462)
  • Raise InvalidMarker for markers nested more than 200 levels deep. (:pull:1450)
  • Keep chains of & and | on markers flat, so long chains do not raise. (:pull:1510)
  • Marker.evaluate() raises UndefinedComparison when extras or dependency_groups is a string instead of a set. (:pull:1507)

Fixes for metadata and licenses:

  • Validate and serialize inherited fields in Metadata subclasses. (:pull:1454)
  • Reject Windows drive-relative License-File paths like C:LICENSE. (:pull:1382)
  • Use one spelling, the first one, for case variants of a LicenseRef- identifier in canonicalize_license_expression(). (:pull:1412)
  • Reject non-ASCII LicenseRef- identifiers before normalization. (:pull:1481)

Fixes for tags and filenames:

  • Reject wheel build tags that contain a line break. (:pull:1427)
  • Keep explicitly empty platforms iterables in cpython_tags(), generic_tags(), and compatible_tags() instead of using the host platforms. (:pull:1360)
  • Detect free-threaded builds in cpython_tags() when a generic ABI such as abi3 or none comes first in abis, or when abis holds only abi3t. (:pull:1555)

Fixes for pylock and dependency groups:

  • Pylock.select() raises PylockSelectError for an explicitly empty environments list (:pull:1362), and for unknown extras and dependency groups. (:pull:1376)
  • Get pylock file names from paths with mixed Windows path separators. (:pull:1436)
  • Require the complete file name to match in is_valid_pylock_path(). (:pull:1446)
  • Reject pre-releases of lock-version 2, such as 2.0rc1. (:pull:1522)
  • Collect errors from all includes in dependency groups, including sibling includes after a parse error and includes in malformed groups, and report each failing group once. (:pull:1411, :pull:1439, :pull:1492)
  • Name the correct group when a dependency group includes itself with a different spelling. (:pull:1519)

Performance:

  • Support lazy imports on Python 3.15+. (:pull:1129)
  • Cache the canonical form of a Specifier. (:pull:1372)
  • Speed up and cache str(Marker). (:pull:1371, :pull:1459)
  • Avoid literal_eval for plain marker strings. (:pull:1429)
  • Speed up VersionRange construction, subtraction, comparison, disjointness checks, membership checks, and filtering. (:pull:1458, :pull:1460, :pull:1471, :pull:1506, :pull:1542, :pull:1551, :pull:1556, :pull:1558, :pull:1562, :pull:1563, :pull:1564, :pull:1568)
  • Speed up Version parsing, string conversion, and release validation. (:pull:1520, :pull:1523, :pull:1524, :pull:1538)
  • Speed up Specifier parsing, string conversion, hashing, and equality. (:pull:1529, :pull:1544, :pull:1571)
  • Speed up Specifier.contains() for simple comparisons. (:pull:1536)
  • Speed up marker and requirement parsing. (:pull:1494, :pull:1495, :pull:1525, :pull:1545)
  • Validate license expressions without compiling Python code.

Documentation:

  • Add a GitHub link next to the page icons. (:pull:1444)
  • Use autodoc for the pylock and requirements API reference (:pull:1393), and for packaging.tags.INTERPRETER_SHORT_NAMES. (:pull:1491)
  • Fix duplicated words in comments and docstrings. (:pull:1516)
  • Update the contribution guide for batched changelog edits and remove PyPy 3.9 from the nox example. (:pull:1383, :pull:1456)

Benchmarks:

  • Add Python 3.15 to the benchmarks. (:pull:1380)
  • Add VersionRange and PubGrub resolver benchmarks. (:pull:1541, :pull:1543, :pull:1570)
  • Report benchmark changes in a summary table and as PR comments. (:pull:1526, :pull:1528)
  • Make the cold benchmarks independent of internal caches, and do not filter compatible release examples in tests.

Internal:

  • Modernize the code for Python 3.10. (:pull:1347, :pull:1365, :pull:1367, :pull:1368, :pull:1369)
  • Give an unbounded end of a range one spelling, so that it compares and hashes the same. (:pull:1392)
  • Remove unused constants in metadata. (:pull:1488)
  • Speed up the test suite. (:pull:1385, :pull:1386, :pull:1387, :pull:1388, :pull:1389, :pull:1390, :pull:1391)
  • Support parallel nox sessions. (:pull:1381)
  • Simplify the cached spec Version in Specifier. (:pull:1539)
  • Update the downstream test projects. (:pull:1400, :pull:1479, :pull:1490, :pull:1493)
  • Type the marker tree and parser return values precisely. (:pull:1513, :pull:1517)
  • Skip GC freezing for property tests, and cover overlapping pre-release literals in ranges. (:pull:1514, :pull:1515)
  • Test that pickles from 26.2 and 26.3 load, including pylock and direct_url objects. (:pull:1550)
  • Update CI: test feature branches, always run lint, check all test jobs, set up in parallel, and pin the oldest Python jobs to Ubuntu 24.04. (:pull:1355, :pull:1414, :pull:1423, :pull:1441, :pull:1442, :pull:1443, :pull:1463)
  • Update GitHub Actions and pre-commit hooks.

comment:2 by Bruce Dubbs, 20 hours ago

Resolution: → fixed
Status: new → closed

Fixed at commit 8078e7ef0.

Note: See TracTickets for help on using tickets.