pypa / pypa/setuptools

[Enhancement Request] `_MissingDynamic` with pyproject.toml should be a failing error, not a warning

Open
#4,183 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Discussion proposal
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

setuptools version

setuptools == 69.0.3

Python version

N/A

OS

N/A

Additional environment information

No response

Description

(I was gonna ask if this behaviour is intentional as a comment on #4066, but figured a dedicated issue would be better)

Since #4066 / v69.0.0, setuptools does not raise an error when an metadata field is not declared as dynamic in pyproject.toml and ignores that metadata field entirely. The current behaviour is printing a warning like:

/private/var/folders/s0/qbw337m17yj9tq4xm822qwn40000gq/T/build-env-2mvjqejz/lib/python3.11/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: dependencies defined outside of pyproject.toml is ignored.

Full logs and source tree: https://gist.github.com/pradyunsg/e502bb5ca096e18308600f0009d86bb0

Expected behavior

Instead of printing this as a warning and silently ignoring information provided via the setup call, setuptools should error out on these cases since the transitory period has concluded.

How to Reproduce
  1. Create a directory containing...
❯ cat pyproject.toml
[project]
name = "example"
version = "1.0.0"
❯ cat setup.py
from setuptools import setup

setup(
    install_requires=["httpx"],
)
  1. Run python -m build on it (or python setup.py sdist, if you want a setuptools-only reproducer).
Output

https://gist.github.com/pradyunsg/e502bb5ca096e18308600f0009d86bb0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pyproject.toml and setup.py reproducer described in the issue, then trace how setuptools handles metadata fields that are not declared dynamic. Confirm the expected behavior by running python -m build or python setup.py sdist; done means the case raises an error instead of emitting _MissingDynamic and ignoring the metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.