Skip to content
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

Enforce visibility of deprecation warnings #159

Open
ghost opened this issue Mar 6, 2014 · 3 comments
Open

Enforce visibility of deprecation warnings #159

ghost opened this issue Mar 6, 2014 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 6, 2014

Originally reported by: jaraco (Bitbucket: jaraco, GitHub: jaraco)


With the release of 3.0, it became apparent that the DeprecationWarning for #65 wasn't adequate to raise awareness of the pending removal.

Setuptools should probably enforce visibility of DeprecationWarnings in the setuptools and pkg_resources namespaces.

Something like

warnings.filterwarnings("always", category=DeprecationWarning, module="setuptools\.|pkg_resources\.")

I'm not quite sure yet where this would happen. I'm considering it could happen at import time or possibly only during select commands initialization.


@ghost ghost mentioned this issue Mar 29, 2016
@pganssle pganssle added Needs Triage Issues that need to be evaluated for severity and status. Needs Implementation Issues that are ready to be implemented. and removed Needs Triage Issues that need to be evaluated for severity and status. labels Oct 19, 2018
@pganssle
Copy link
Member

I think the way most people solve this (matplotlib, dateutil, pandas, etc) is to just not use DeprecationWarning at all. Instead, you create a subclass of Warning, like so:

class PkgResourcesDeprecationWarning(Warning):
    """Class for warning about deprecations in PkgResources"""

That way, they are on by default, but they're still easy to filter out.

@martonp
Copy link
Contributor

martonp commented Oct 27, 2018

@robinjhuang and I would like to work on this during the GA python sprint

martonp added a commit to robinjhuang/setuptools that referenced this issue Oct 27, 2018
…ecationWarning with it.

Fixes issue pypa#159

Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
martonp added a commit to robinjhuang/setuptools that referenced this issue Oct 27, 2018
…cationWarning with it.

Fixes issue pypa#159

Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
robinjhuang added a commit to robinjhuang/setuptools that referenced this issue Oct 27, 2018
…cationWarning with it.

Fixes issue pypa#159

Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
robinjhuang added a commit to robinjhuang/setuptools that referenced this issue Oct 27, 2018
Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
robinjhuang added a commit to robinjhuang/setuptools that referenced this issue Oct 27, 2018
Fixes issue pypa#159

Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
pganssle pushed a commit to robinjhuang/setuptools that referenced this issue Oct 28, 2018
Fixes issue pypa#159

Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
pganssle pushed a commit to robinjhuang/setuptools that referenced this issue Oct 28, 2018
Fixes issue pypa#159

Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
pganssle pushed a commit to robinjhuang/setuptools that referenced this issue Oct 28, 2018
Fixes issue pypa#159

Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
pganssle pushed a commit to robinjhuang/setuptools that referenced this issue Oct 28, 2018
`DeprecationWarning` is not visible by default in the latest versions of
CPython, so this switches the deprecation warnings in setuptools and
pkg_resources over to custom classes derived from `Warning` instead.

Fixes issue github issue pypa#159

Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
@abravalheri
Copy link
Contributor

This issue seems to be mostly solved (thanks to the various contributions), right?

(... if we ignore the situations where the build frontend hides the warnings ...)

Is there anything left to do from the setuptools point of view?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants