Skip to content

Make AstropyDeprecationWarnings appear by default in py2.7 - #1871

Merged
embray merged 1 commit into
astropy:masterfrom
eteq:astropy-deprecation-show
Dec 9, 2013
Merged

embray merged 1 commit into
astropy:masterfrom
eteq:astropy-deprecation-show

Conversation

@eteq

@eteq eteq commented Dec 6, 2013

Copy link
Copy Markdown
Member

This came up in a discussion in astropy/astropy-APEs#2 . As it stands right now, AstropyDeprecationWarnings are not shown when they are raised with warnings.warn in python 2.7. This is due to python's default behavior of hiding DeprecationWarning (which is AstropyDeprecationWarning's superclass) in py2.7 given that it is the last 2.x release.

This makes sense for python deprecations, but we probably do want user's to see our deprecation warnings, as they often deal with something they'll have to change in future astropy releases. So we should figure out how to adjust the defaults so that AstropyDeprecationWarning is shown by default and has to be manually turned off by the user.

cc @embray @astrofrog

@embray

embray commented Dec 6, 2013

Copy link
Copy Markdown
Member

We've already changed the @deprecated decorator to use AstropyDeprecationWarning. So I think all we have to do is not make AstropyDeprecationWarning subclassed on Python's DeprecationWarning.

we do this because in py2.7, DeprecationWarning and subclasses are hidden by default, but we want astropy's deprecations to get shown by default
@eteq

eteq commented Dec 6, 2013

Copy link
Copy Markdown
Member Author

Oh, duh, I guess that's an easy way to do it!

In a moment I will attach code to this issue that does exactly what @embray says here. I tested it and the AstropyDeprecationWarnings do indeed now show up.

@astrofrog

Copy link
Copy Markdown
Member

👍

@embray

embray commented Dec 9, 2013

Copy link
Copy Markdown
Member

I also think, in retrospect, it makes more sense to use our own warning rather than mix in with Python's own deprecation warnings.

embray added a commit that referenced this pull request Dec 9, 2013
Make `AstropyDeprecationWarning`s appear by default in py2.7
@embray
embray merged commit 05d4345 into astropy:master Dec 9, 2013
@embray

embray commented Dec 9, 2013

Copy link
Copy Markdown
Member

Should also mention this in the changelog probably, since users will start to see these more when they didn't before.

embray added a commit that referenced this pull request Feb 12, 2014
Make `AstropyDeprecationWarning`s appear by default in py2.7
embray added a commit that referenced this pull request Feb 12, 2014
Make `AstropyDeprecationWarning`s appear by default in py2.7
mwcraig added a commit to mwcraig/astropy that referenced this pull request Jun 24, 2015
Closes astropy#1871 by using an earlier version of HDF5
dhomeier pushed a commit to dhomeier/astropy that referenced this pull request Aug 11, 2015
Closes astropy#1871 by using an earlier version of HDF5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants