Skip to content

Avoid KeyError in _REQUIRES_PYTHON_SCRIPT - #2026

Merged
gaborbernat merged 2 commits into
pypa:mainfrom
Cycloctane:fix-requires-python-script
Sep 1, 2026
Merged

gaborbernat merged 2 commits into
pypa:mainfrom
Cycloctane:fix-requires-python-script

Conversation

@Cycloctane

@Cycloctane Cycloctane commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

metadata raises KeyError for missing keys in Python3.15+. This error can be safely ignored, but it causes python to print a stacktrace when installing a package without 'Requires-Python' field in metadata, though the package is actually installed successfully.

This PR updates _REQUIRES_PYTHON_SCRIPT to avoid stderr noise caused by KeyError.

  • ran the linter to address style issues (pre-commit run --all-files)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in changelog.d/ folder (choose a type: feature, bugfix, doc, removal, or misc)
  • updated/extended the documentation

metadata raises KeyError for missing keys in Python3.15+.
this error can be safely ignored, but it causes stacktrace in stderr
when installing a package without 'Requires-Python' field in metadata.
@gaborbernat
gaborbernat merged commit cbd6770 into pypa:main Sep 1, 2026
17 checks passed
@Cycloctane
Cycloctane deleted the fix-requires-python-script branch September 1, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants