Skip to content

[BUG] setting install_requires=[] disables dynamic requires-dist #5120

@lmondada

Description

@lmondada

setuptools version

setuptools==80.9

Python version

Python 3.12 (should not matter)

OS

n/a

Additional environment information

No response

Description

When passing an empty install_requires=[] argument to setup(), the generated PKG-INFO does not contain the line

Dynamic: requires-dist

even though project.dynamic = ["dependencies"] is set in pyproject.toml.

Why this edge case?

The cudaq project publishes multiple packages wheels for multiple supported versions of CUDA. We then have a metapackage that is sdist only that finds the installed CUDA version on the user's system at install time and sets its dependency dynamically accordingly.

To achieve this, the sdist package initially declares an empty dependency list.

Expected behavior

The file PKG-INFO generated by python -m build should contain a line

Dynamic: requires-dist

How to Reproduce

  1. create an empty package with project.dynamic = ["dependencies"] set in pyproject.toml
  2. set the build backend to setuptools.build_meta and create a setup.py file with setup(install_requires=[])
  3. run python -m build
  4. cd dist && tar xvf package-name-version.tar.gz && cat package-name-version/PKG-INFO | grep Dynamic

Output

The fourth step outputs nothing. It should output Dynamic: requires-dist

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions