Skip to content

Ignore readme and requires-python not listed in dynamic - #5343

Open
andrewstellman wants to merge 1 commit into
pypa:mainfrom
andrewstellman:missing-dynamic-readme-requires-python
Open

andrewstellman wants to merge 1 commit into
pypa:mainfrom
andrewstellman:missing-dynamic-readme-requires-python

Conversation

@andrewstellman

Copy link
Copy Markdown

Summary of changes

pyproject.toml with [project] name = 'p', version = '1' and no dynamic, plus setup(long_description='hello') in setup.py: the build fails with AttributeError: 'NoneType' object has no attribute 'get'. With setup(python_requires='>=3.8') it fails with TypeError: 'NoneType' object is not iterable. Expected: the _MissingDynamic warning and the value ignored, as already happens for description, classifiers, dependencies, etc. (the warn-and-ignore behaviour abravalheri explains in a comment on #4183).

_handle_missing_dynamic (setuptools/config/_apply_pyprojecttoml.py) resets readme and requires-python to None, which _long_description and _python_requires did not handle. Both now treat None as a reset. For python_requires, the value is also cleared from dist, so _finalize_requires cannot copy it back. The new cases extend TestPresetField.test_not_listed_in_dynamic.

PEP 621 (dynamic): "If the metadata does not list a field in dynamic, then a build back-end CANNOT fill in the requisite metadata on behalf of the user".

Pull Request Checklist

  • Changes have tests
  • News fragment added in [newsfragments/].

Found by Quality Playbook, an AI code-review tool, with Claude; I reviewed the change.

_handle_missing_dynamic resets these fields to None, which _long_description
and _python_requires did not accept (AttributeError / TypeError). Treat None
as a reset so the value from setup.py is dropped with the _MissingDynamic
warning, as for the other fields.
@andrewstellman
andrewstellman force-pushed the missing-dynamic-readme-requires-python branch from a424327 to be18f5a Compare October 5, 2026 17:24
@andrewstellman
andrewstellman marked this pull request as ready for review October 5, 2026 17:25
@mergify

mergify Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

1 participant