-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecation warning #20046
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
Deprecation warning #20046
Conversation
CI failures seem unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading at @anntzer link I still think this is the right deprecation here
Behavior for showing DeprecationWarnings according to https://www.python.org/dev/peps/pep-0565/: Warning shows, when using deprecated functions
I failed to construct such a case 👀 This still warns:
where mylib is next to myscript. Maybe this is only suppressed if mylib is in site-packages? Anyway given the above warning cases, I think it's safe enough to switch to |
Does this need an API change note? |
Definitely needs an API note! |
ed3d631
to
8c9af69
Compare
Squashed and added an API note. Unsure where to dump all the information for most readability? Maybe a blog post on best practices for dealing with warnings for users/CI/library authors and would be more effective than putting some of this information in the docs? |
…cy and fix check() What a mess in tests LOL! Related tickets: [1] computationalmodelling/nbval#162 [2] computationalmodelling/nbval#167 [3] ipython/ipython#12817 [4] ipython/ipython#12889 [5] ipython/ipykernel#591 [6] matplotlib/matplotlib#20046 git-svn-id: file:///srv/repos/svn-community/svn@994636 9fca08f4-af9d-4005-b8df-a31f2cc04f65
…cy and fix check() What a mess in tests LOL! Related tickets: [1] computationalmodelling/nbval#162 [2] computationalmodelling/nbval#167 [3] ipython/ipython#12817 [4] ipython/ipython#12889 [5] ipython/ipykernel#591 [6] matplotlib/matplotlib#20046 git-svn-id: file:///srv/repos/svn-community/svn@994636 9fca08f4-af9d-4005-b8df-a31f2cc04f65
PR Summary
We are currently unable to unintrusively deprecate class-level attributes (because we subclass UserWarning and not DeprecationWarning). Based on a previous dev call, we decided the solution was to "do it anyway". This led to a couple of issues, e.g. #19080 and #19839 and #19850.
The history of the decision to not subclass DeprecationWarning has to do with a decision from core Python in the 2.x days to not show DeprecationWarnings to users. However, there is now a more sophisticated filter in place (see https://www.python.org/dev/peps/pep-0565/).
Users that want to see MatplotlibDeprecationWarning in their CI will now have to
export PYTHONWARNING=d
, launch python with-Wa
, or use warning filters to enable DeprecationWarnings (or MatplotlibDeprecationWarning specifically, depending on their needs).PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).