![](https://secure.gravatar.com/avatar/0a2191a85455df6d2efdb22c7463c304.jpg?s=120&d=mm&r=g)
On 21.04.2021 13:35, Paul Moore wrote:
On Wed, 21 Apr 2021 at 12:24, M.-A. Lemburg <mal@egenix.com> wrote:
Isn't that an educational problem ? Adjusting reporting of warnings isn't all that hard:
https://docs.python.org/3/library/warnings.html#the-warnings-filter
Perhaps it's just a usability issue. We could have venvs help us a bit with this by e.g. making such settings "global" per venv, without the user having to configure PYTHONWARNINGS or writing a sitecustomize.py for this purpose.
Maybe. In my own personal experience, I hit this sort of thing when using tools. Consider for example black - if that triggered a warning, I'd report it, but then what would I do? Edit my copy of black (possibly in multiple environments) to suppress the warning? Block the warning globally which means I then don't see it for other projects and hence don't report it to them? Work out the precise incantation to suppress it just for black?
In practice, I just moan a lot about the warning, and vote to suppress warnings by default next time the question comes up :-)
So yes, maybe it's an education/usability issue, but if so it's one that's hard to fix. If we can work out a way for users (who may well have limited programming knowledge) to just "push a button" to say "I reported that issue to black, now stop bothering me about it for this version of black (at least on this PC)" then that would be great. But at the moment I don't believe it's that simple.
I wouldn't give up so fast :-)
If we'd make warning message more instructive and point people to a simple command they could run to suppress the warning that should take away a lot of the pain.
Sketching here:
""" DeprecationWarning: The package x.y.z is using a deprecated feature tadada at module.py:34. If you get a change, please report this to the maintainers. In order to suppress warnings for this package, please run: python3 -m warnings.ignore('::DeprecationWarning:package') """
The ignore() function would then add a warning filter to pyvenv.cfg, if available, or output instructions on how to setup the environment via the a usercustomize.py, sitecustomize.py or PYTHONWARNINGS env var.
If you want a click-for-help approach, we could also put a URL into the message, which then points to a page with specific instructions (rendered to be specific to the warning instance via a Django view for example).
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Experts (#1, Apr 21 2021)
Python Projects, Coaching and Support ... https://www.egenix.com/ Python Product Development ... https://consulting.egenix.com/
::: We implement business ideas - efficiently in both time and costs :::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/