-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ 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
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
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.
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 |
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.
There should be two changelog entries, one under MAST and one under Gemeni.
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.
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
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.
You can use this PR as an example for renaming and deprecating a class: astropy/astropy#9445
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.
Nice! Thanks @bsipocz
@olyoberdorf You probably want to take a look at this too. |
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 :) |
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.
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.
astroquery/gemini/core.py
Outdated
@@ -528,4 +530,11 @@ def _gemini_json_to_table(json): | |||
"release", | |||
"dec"] | |||
|
|||
|
|||
@deprecated(since='v0.4.1', alternative='GeminiObservationsClass') |
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.
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] |
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.
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.
- 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] |
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.
similarly
- Renamed and deprecated Observations and ObservationsClass in MAST module. [#1885] | |
- Renamed and deprecated ``Observations`` and ``ObservationsClass`` to ``MastObservations`` and ``MastObservationsClass``. [#1885] |
astroquery/gemini/__init__.py
Outdated
|
||
__all__ = ['Observations', 'ObservationsClass', 'conf'] | ||
__all__ = ['Observations', 'ObservationsClass', 'GeminiObservations', 'GeminiObservationsClass', 'conf'] |
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.
I think we don't recommend wildchar imports, so removing the old class names from the namespace is probably safe.
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. |
@bsipocz Which of your comments did you need my input on? Also thanks for remembering the documentation! Super important! |
96f228a
to
9f45736
Compare
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. |
9f45736
to
f3c1630
Compare
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 |
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.
Some tiny comments. Fixing these and the pep8 issues should make this ready to go I think
astroquery/gemini/core.py
Outdated
@@ -21,7 +22,13 @@ | |||
from ..exceptions import AuthenticationWarning | |||
|
|||
|
|||
__all__ = ['Observations', 'ObservationsClass'] # specifies what to import | |||
<<<<<<< HEAD |
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.
there are some remnants here from the conflict resolutions
astroquery/gemini/core.py
Outdated
@@ -526,4 +533,11 @@ def _gemini_json_to_table(json): | |||
"release", | |||
"dec"] | |||
|
|||
|
|||
@deprecated(since='v0.4.2', alternative='GeminiObservationsClass') |
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.
this is now 0.4.3
astroquery/mast/observations.py
Outdated
@@ -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') |
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.
0.4.3
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. |
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.
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 |
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.
Keep this line unchanged, that will fix the docs build.
71e377d
to
ecfc7fd
Compare
pass | ||
|
||
|
||
GeminiObservations = GeminiObservationsClass() | ||
Observations = ObservationsClass() |
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.
This line is causing the warning. I guess the brute force way is to silence the warning just for this line...?
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.
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()
.
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. |
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. 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? |
Hi Brigitta,
Yeah still on board. I don’t recall any other problems. I’m on vacation
but I am back this weekend.
…On Fri, Mar 18, 2022 at 12:23 PM Brigitta Sipőcz ***@***.***> wrote:
Heads up @ceb8 <https://github.com/ceb8> @jaymedina
<https://github.com/jaymedina> @tomdonaldson
<https://github.com/tomdonaldson> @olyoberdorf
<https://github.com/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?
—
Reply to this email directly, view it on GitHub
<#1885 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACKOSDNTXBHFATOFQT4PA2TVAQAMNANCNFSM4TJUHZZA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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
No description provided.