New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement Request] _MissingDynamic
with pyproject.toml should be a failing error, not a warning
#4183
Comments
Hi @pradyunsg, thank you very much for issue. If I am not wrong the standard does not mandate an error in these circumstances1, right? The requirement is that the metadata should not be filled dynamically if The reason why there is a warning is the following: I have seem in the past several code bases where people add metadata to both In the future, I hope to reduce the defensive programming in this part of the code (while respecting the standard), because it takes a toll in terms of complexity... Users that want to be on the safe side and prefer harder checks can use Footnotes
|
Well, without a hard error, it's still going to have breakage -- albeit it'll be a subtle breakage rather than a clean one. For example, I had to spend a bunch of time diagnosing this for someone else because "this used to work, and now pip doesn't install dependencies anymore" was the observed behaviour change. An explicit error could have (1) clearly indicated to the user what changed and (2) pointed the user in the direction of what they should've done. |
Hi @pradyunsg thank you very much for the clarification. Personally I am still not 100% certain about the impacts of the proposed change, if there will be any unintended consequence and the backlash it can cause (I am not sure to which extent it might affect other projects because it is very hard to foresee what changes in
I think one easy way out of this situation is to check the logs provided by setuptools. Footnotes
|
_MissingDynamic
with pyproject.toml should be a failing error, not a warning_MissingDynamic
with pyproject.toml should be a failing error, not a warning
Seems reasonable to me!
That's fair. I think useful context to add: one of the reasons I've advocated for more explicit errors from setuptools in multiple cases... it aligns with the feedback we'd gotten during the UX discussions for pip in 2020 as well as my personal experience supporting developers diagnose "Python packaging issues" as a part of my day job for the last few years. :) |
Thank you very much for the context. UX discussions and user studies are very useful, and are a wonderful methodology to guide software projects. But more often than not we also should take their conclusions with a pinch of salt and analyse situation by situation. For example in the setuptools code base we regularly receive requests contradicting each other, and usually what is good for a group of users, not necessarily is good for another... We constantly have to balance out multiple trade-offs. We are trying our best to provide the most useful information for users, so that by scrolling the logs they can easily find the relevant warning message, and this message should contain tips of how to solve the problem1. In this particular cause, you should be able to see something like the following message in your logs: _MissingDynamic: `dependencies` defined outside of `pyproject.toml` is ignored.
!!
********************************************************************************
The following seems to be defined outside of `pyproject.toml`:
`dependencies = ['httpx']`
According to the spec (see the link below), however, setuptools CANNOT
consider this value unless `dependencies` is listed as `dynamic`.
https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
To prevent this problem, you can list `dependencies` under `dynamic` or alternatively
remove the `[project]` table from your file and rely entirely on other means of
configuration.
********************************************************************************
!!
_handle_missing_dynamic(dist, project_table)
/tmp/build-env-s8mz_ua3/lib/python3.8/site-packages/setuptools/config/_apply_pyprojecttoml.py:82: SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies)
corresp(dist, value, root_dir) which should give the user a good indication of why the problem is happening and how to solve it. Footnotes
|
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: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
python -m build
on it (orpython setup.py sdist
, if you want a setuptools-only reproducer).Output
https://gist.github.com/pradyunsg/e502bb5ca096e18308600f0009d86bb0
The text was updated successfully, but these errors were encountered: