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

renamed and deprecated Observations and Observations class for the gemini and mast module #1885

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tinuademargaret
Copy link
Contributor

No description provided.

@astropy-bot astropy-bot bot added the gemini label Nov 4, 2020
@codecov
Copy link

codecov bot commented Nov 4, 2020

Codecov Report

Merging #1885 (e68e664) into main (96f63eb) will increase coverage by 1.56%.
The diff coverage is 100.00%.

❗ Current head e68e664 differs from pull request most recent head 65cbaad. Consider uploading reports for the commit 65cbaad to get more accurate results

@@            Coverage Diff             @@
##             main    #1885      +/-   ##
==========================================
+ Coverage   62.87%   64.44%   +1.56%     
==========================================
  Files         133      200      +67     
  Lines       17246    15961    -1285     
==========================================
- Hits        10844    10286     -558     
+ Misses       6402     5675     -727     
Impacted Files Coverage Δ
astroquery/gemini/__init__.py 100.00% <100.00%> (ø)
astroquery/gemini/core.py 69.56% <100.00%> (-1.13%) ⬇️
astroquery/mast/__init__.py 100.00% <100.00%> (ø)
astroquery/mast/observations.py 75.52% <100.00%> (-0.90%) ⬇️
astroquery/heasarc/core.py 21.48% <0.00%> (-52.31%) ⬇️
astroquery/utils/system_tools.py 52.17% <0.00%> (-31.16%) ⬇️
astroquery/mast/core.py 78.26% <0.00%> (-12.37%) ⬇️
astroquery/gaia/core.py 61.31% <0.00%> (-10.63%) ⬇️
astroquery/esa/hubble/core.py 76.10% <0.00%> (-10.03%) ⬇️
astroquery/utils/url_helpers.py 85.00% <0.00%> (-9.12%) ⬇️
... and 162 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@tinuademargaret tinuademargaret changed the title renamed and deprecated Observations and Observations class for the gemini module renamed and deprecated Observations and Observations class for the gemini and mast module Nov 4, 2020
@bsipocz bsipocz added the mast label Nov 4, 2020
@bsipocz bsipocz added this to the v0.4.2 milestone Nov 4, 2020
Copy link
Member

@ceb8 ceb8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a massive breaking change for users, we need to have a deprecation period where the old syntax still works but a deprecation message is displayed. Check out https://docs.astropy.org/en/stable/api/astropy.utils.decorators.deprecated.html#astropy.utils.decorators.deprecated

@@ -4,6 +4,14 @@
Service fixes and enhancements
------------------------------

observations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be two changelog entries, one under MAST and one under Gemeni.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a massive breaking change for users, we need to have a deprecation period where the old syntax still works but a deprecation message is displayed. Check out https://docs.astropy.org/en/stable/api/astropy.utils.decorators.deprecated.html#astropy.utils.decorators.deprecated

Would it be a good idea to assign the old name of the class to the new name
e.g ObservationsClass = GeminiObservationsClass()
and display a deprecated message saying ObservationsClass is deprecated. Use GeminiObservationsClass instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use this PR as an example for renaming and deprecating a class: astropy/astropy#9445

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks @bsipocz

@ceb8
Copy link
Member

ceb8 commented Nov 11, 2020

@olyoberdorf You probably want to take a look at this too.

@olyoberdorf
Copy link

Gemini is very new, but the deprecation work would be essentially identical to what's needed for MAST. So you may as well do both. Also, thanks for working on my module :)

Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good to me, and I only have some minor comments, one of them needs input from @ceb8.

However, the documentation should also be updated before we merge this.

@@ -528,4 +530,11 @@ def _gemini_json_to_table(json):
"release",
"dec"]


@deprecated(since='v0.4.1', alternative='GeminiObservationsClass')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're in 0.4.2 dev cycle, so this should say deprecated since v0.4.2

CHANGES.rst Outdated
gemini
^^^^^^

- Renamed and deprecated Observations and ObservationsClass in GEMINI module. [#1885]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is nitpicking, so I only point out to show better practice: changelog should point out what has changed, and what the new solution is. No need to mention the module name in the changelog as the section above already contains that information. The backticks are to highlight the class names when rendered for the documentation.

Suggested change
- Renamed and deprecated Observations and ObservationsClass in GEMINI module. [#1885]
- Renamed and deprecated ``Observations`` and ``ObservationsClass`` to ``GeminiObservations`` and ``GeminiObservationsClass`` . [#1885]

CHANGES.rst Outdated
mast
^^^^

- Renamed and deprecated Observations and ObservationsClass in MAST module. [#1885]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly

Suggested change
- Renamed and deprecated Observations and ObservationsClass in MAST module. [#1885]
- Renamed and deprecated ``Observations`` and ``ObservationsClass`` to ``MastObservations`` and ``MastObservationsClass``. [#1885]


__all__ = ['Observations', 'ObservationsClass', 'conf']
__all__ = ['Observations', 'ObservationsClass', 'GeminiObservations', 'GeminiObservationsClass', 'conf']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't recommend wildchar imports, so removing the old class names from the namespace is probably safe.

@bsipocz
Copy link
Member

bsipocz commented Nov 14, 2020

Oh, and as I see there are some conflicts due to a PR that has been merged in the meantime, so this will need a rebase at some point (better to do it once you've done the docs updates, too).

Also, note to maintainers that travis is gone, and I have to fix the CI before we can reasonably merge anything.

@ceb8
Copy link
Member

ceb8 commented Nov 16, 2020

@bsipocz Which of your comments did you need my input on?

Also thanks for remembering the documentation! Super important!

@bsipocz
Copy link
Member

bsipocz commented Apr 20, 2021

This needs a rebase due to conflicts. I may try to get to it before release to make sure the deprecations end up in the release.

@pep8speaks
Copy link

pep8speaks commented Jul 1, 2021

Hello @tinumide! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-05-05 08:04:42 UTC

Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tiny comments. Fixing these and the pep8 issues should make this ready to go I think

@@ -21,7 +22,13 @@
from ..exceptions import AuthenticationWarning


__all__ = ['Observations', 'ObservationsClass'] # specifies what to import
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are some remnants here from the conflict resolutions

@@ -526,4 +533,11 @@ def _gemini_json_to_table(json):
"release",
"dec"]


@deprecated(since='v0.4.2', alternative='GeminiObservationsClass')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is now 0.4.3

@@ -852,5 +851,11 @@ def service_request_async(self, service, params, pagesize=None, page=None, **kwa
return self._portal_api_connection.service_request_async(service, params, pagesize, page, **kwargs)


@deprecated(since='v0.4.2', alternative='MastObservationsClass')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.4.3

@bsipocz
Copy link
Member

bsipocz commented Jul 2, 2021

Good news, I see the docs build error on this branch locally, too. Bad news, I don't see the reason, the same build passes. See inline comment for the fix.

The deprecation of the instances in a way that the warning is not raised at module import time is I suppose the last outstanding issue, but there I don't yet have a solution.

@bsipocz
Copy link
Member

bsipocz commented Jul 2, 2021

And I spotted one more issue, if you do an import the deprecation warnings should not show. I only have an ugly workaround for the class instance and I'm not sure how I could force it to emit a deprecation when used, but not when the module is imported.

Python 3.9.1 (default, Jan 11 2021, 15:50:22) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.20.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import astroquery.mast
WARNING: AstropyDeprecationWarning: The ObservationsClass class is deprecated and may be removed in a future version.
        Use MastObservationsClass instead. [astroquery.mast.observations]

Maybe @pllim you have a nice idea to work this around?

@@ -30,13 +30,13 @@ class Conf(_config.ConfigNamespace):

conf = Conf()

from .cutouts import TesscutClass, Tesscut, ZcutClass, Zcut
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this line unchanged, that will fix the docs build.

pass


GeminiObservations = GeminiObservationsClass()
Observations = ObservationsClass()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is causing the warning. I guess the brute force way is to silence the warning just for this line...?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the issue is that if I put a filter in __init__.py, then we rightly don't get the warning at module import time. However, then we don't get it at all for any usage of Observations, and that's what probably users used the most as the docs is full of Observations.xzy().

@bsipocz
Copy link
Member

bsipocz commented Jul 3, 2021

I'm sorry, but this has to wait for the next release, I just can't find a way to have all our cases covered, to make sure all users who use the old names to see the warning, but those using the new one don't.

@bsipocz bsipocz modified the milestones: v0.4.3, v0.4.4 Jul 3, 2021
@bsipocz bsipocz modified the milestones: v0.4.4, v0.4.5 Nov 12, 2021
@bsipocz bsipocz modified the milestones: v0.4.5, v4 Dec 25, 2021
@bsipocz
Copy link
Member

bsipocz commented Mar 18, 2022

Heads up @ceb8 @jaymedina @tomdonaldson @olyoberdorf: I would like to go ahead with this sooner rather than later. Would you be still on board? Basically we already followed the same logic with the new class in mast, calling it e.g. MastMissions.

It is understood that we'll need long deprecation period, for both modules so for a while all the users will experience is a deprecation warning at the time of import.

As I see the last comments in here, this got stalled with some issues around getting the right warning in all situations. Besides fixing that, do you see any blockers with the proposed idea?

@olyoberdorf
Copy link

olyoberdorf commented Mar 18, 2022 via email

renamed and deprecated Observations and Observations class in mast module

added changelog entry

gemini observations old syntax now works

gemini observations old syntax still works

added old syntax to init

some corrections

mast observations old syntax still works

changes requested

updated gemini doc

updated mast doc

renamed and deprecated Observations and Observations class

fixed pep8 issues and corrected deprecated version

added Zcut

renamed obesrvation in test files

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

Successfully merging this pull request may close these issues.

None yet

6 participants