Skip to content

[BUG] Deprecated metadata fields are included as Dynamic fieldsΒ #4797

@di

Description

@di

setuptools version

75.8.0

Python version

n/a

OS

n/a

Additional environment information

Ref: pypi/warehouse#17389

Description

Since #4698, setuptools will record the deprecated Requires field as a Dynamic field.

PEP 643 says:

A new field, Dynamic, will be added to the Core Metadata Specification. This field will be multiple use, and will be allowed to contain the name of another core metadata field.

I read this to mean that this can only contain the name of a core metadata field that is valid for the given metadata version, and shouldn't include deprecated fields. Since Requires was deprecated in 1.2 and Dynamic was added in 2.2, Requires should never be included as a Dynamic field.

Expected behavior

Setuptools should not write deprecated Core metadata fields to Dynamic.

How to Reproduce

This setup.py:

from setuptools import setup

setup(
    name="test",
    version="0.0.0",
    requires=["foo"],
    install_requires=["bar"],
)

Built with:

$ python -m build -w

Output

This results in the following METADATA file:

Metadata-Version: 2.2
Name: test
Version: 0.0.0
Requires: foo
Requires-Dist: bar
Dynamic: requires
Dynamic: requires-dist

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions