[FR] Warn when metadata field is defined as dynamic, but not marked in project.dynamic
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
What's the problem this feature will solve?
A miss-specified pyproject.toml file that leaves out a dynamic field from the [project.dynamic] list, but still specifies that metadata field in [tool.setuptools.dynamic] will not warn the user of the missing field.
Take the following pyproject.toml file:
[project]
name = "package"
dynamic = ['version'] # "dependencies" accidentally omitted
[tool.setuptools.dynamic]
version = {file = "VERSION"}
dependencies = {file = ["requirements.txt"]}
The user has forgotten to put "dependencies" in the project.dynamic list. But when running any setuptools building or installation commands (pip install, python -m build, python setup.py sdist), there is no indication that something is wrong until the user is unable to run their code due to missing dependencies.
Describe the solution you'd like
If a field is defined in [tool.setuptools.dynamic], but it is missing from the list in [project.dynamic], warn the user when attempting to build or install the package (from the local file structure, it will be mostly unhelpful when installing from pypi).
A similar thing is done elsewhere: When a field is defined in the setup.py file and not noted as dynamic in the pyproject.toml, a _MissingDynamic warning is sent to the console when attempting to build the package (though not when attempting to install it).
Alternative Solutions
An error/failure to build the package could also be acceptable, especially since a mistake like this might not get noticed if development is taking place in a local environment that already has the necessary dependencies installed.
Additional context
I am aware of #4183, however I don't believe that we are requesting the same thing. What this is requesting is a warning for projects that use pyproject.toml exclusively, and a mistake has simply been made when writing the file.
Code of Conduct
- I agree to follow the PSF Code of Conduct
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the case using the shown pyproject.toml, with dependencies configured in [tool.setuptools.dynamic] but omitted from project.dynamic, then run pip install, python -m build, or python setup.py sdist. Compare the behavior with the existing _MissingDynamic warning for setup.py-defined fields. Done means a clear warning, or a documented build failure, identifies the omitted dynamic metadata field.
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
- 35/100