Suppress deprecation warnings in vendored projects during normal operation #12243
Closed
1 task done
Labels
kind: workaround
Is a workaround for a problem
project: setuptools
Related to setuptools
project: vendored dependency
Related to a vendored dependency
S: needs triage
Issues/PRs that need to be triaged
state: needs discussion
This needs some more discussion
state: needs eyes
Needs a maintainer/triager to take a closer look
type: bug
A confirmed bug or unintended behavior
UX
User experience related
Description
Starting with pip 23.2, it emits a deprecation warning coming from the vendored copy of setuptools/pkg_resources.
I would like to request any warnings coming from those projects to be suppressed by default, in a normal runtime. They don't have value to the end-users, as they aren't at all actionable.
Using
python -Werror
is useful to proactively locate packages in the dependency tree that are going to cause problems shortly, and unrelated warnings make it harder to deal with the target ones.Of course, I'd like this mode to propagate to the underlying build processes so this actually needs an env var.
To work around this problem, one could attempt to make the warning non-failing:
PYTHONWARNINGS='error,once:pkg_resources is deprecated as an API.:DeprecationWarning:pip._internal.metadata.importlib._envs'
. But still, this is rather annoying and probably won't be sustainable across different pip versions.This seems to be one of the incarnations of #11715 (comment) but I'm raising this as a separate issue concerning a more generalized, systemic appoach to dealing with such situations wrt all the vendored projects not just one.
Expected behavior
No warnings originating from any of the vendored packages. I suppose, they should be enabled in tests or when running something like
python -Xdev
but not in a normal pip run.Maybe,
vendoring
should patch out such places on project updates. But this means not addressing said problems on the pip side + no possibility to catch problems proactively. So I was thinking that perhaps this should be done with a feature-toggle in places where the vendored projects are imported and called.pip version
23.2 and higher
Python version
3.11 and higher
OS
ubuntu-latest @ GHA
How to Reproduce
I noticed that this warning can be reached through calling
pip install
(even without any arguments). Though,--help
doesn't fail.Output
Code of Conduct
The text was updated successfully, but these errors were encountered: