-
-
Notifications
You must be signed in to change notification settings - Fork 422
Addresses Issue #3138 - ESO - Enable Table Access Protocol (TAP) queries #3339
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
base: main
Are you sure you want to change the base?
Conversation
720fbd9
to
22d0c30
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3339 +/- ##
==========================================
+ Coverage 70.07% 70.67% +0.59%
==========================================
Files 232 233 +1
Lines 19893 19839 -54
==========================================
+ Hits 13940 14021 +81
+ Misses 5953 5818 -135 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
76675d2
to
c32f348
Compare
a987745
to
4b775f8
Compare
Hi @bsipocz , could you please give us a time estimate of the review process? No pressure at all though, we only need to plan our activities internally. Thanks a lot in advance. |
@juanmcloaiza - sorry for the delay. I'll try to get to the review this week. |
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'm sorry to have this many comments and thank you for your patience while waiting for this review.
I acknowledge that this seems to a lot, but most of them are minor and/or helping API consistency with the other modules and/or making the code cleaner and easier to read and follow; which will be helpful for the future maintenance.
astroquery/eso/core.py
Outdated
|
||
import astropy.table |
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.
L28 explicitly imports from here, remove this one add to that list as necessary
astroquery/eso/core.py
Outdated
import astropy.utils.data | ||
import keyring | ||
import requests.exceptions | ||
from astropy.table import Table, Column | ||
from astropy.utils.decorators import deprecated_renamed_argument | ||
from bs4 import BeautifulSoup | ||
from pyvo.dal import TAPService | ||
import pyvo.dal.exceptions as pde |
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.
can you directly import the classes here? It's quite obvious reading the code that those are coming from pyvo (and this alias is not helping to make it more obvious anyway)
astroquery/eso/core.py
Outdated
"problem; the service may be offline.") | ||
elif b"# No data returned !" not in content: | ||
return True | ||
__doctest_skip__ = ['EsoClass.*'] |
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.
why do we skip doctesting?
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 know this is not a valid answer, but "because it was so in the main branch, L30", so I left it like that. I'll address this comment later, when I have a valid answer.
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.
OK, I removed the flag __doctest_skip__
.
astroquery/eso/core.py
Outdated
"problem; the service may be offline.") | ||
elif b"# No data returned !" not in content: | ||
return True | ||
__doctest_skip__ = ['EsoClass.*'] | ||
|
||
|
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.
have an explicit __all__
with listing the public API
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.
__all__
is present in eso/__init__.py
(L28):
__all__ = ['Eso', 'EsoClass',
'Conf', 'conf',
]
Is this what you're referring to? Perhaps I'm missing the point.
@property | ||
def maxrec(self): |
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.
Why does maxrec need to be a class properly rather than a parameter for the query functions? After all it should be specific to individual queries rather than being set on the instance. (See the other modules)
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 also discussed this point internally. While both maxrec
and top
limit the number of results, their intent is different. top
is part of the ADQL query, used limit the result size from a logical/scientific standpoint. maxrec
, on the other hand, is a TAP server parameter used as a safety cap regardless of the query’s intent. For example, I'd use maxrec
to avoid system overload when I'm on my laptop, and for quickly testing the notebook’s logic and plots before the "real-thing-run" that could last some hours.
Since maxrec
reflects user's environment rather than query logic, it makes more sense to have it as a configurable property, rather than a per-query argument (as top
). Regarding other modules: if they don’t yet distinguish between maxrec
and top
, I’d warmly suggest they do, since it’s an important conceptual separation.
Please let me know your thoughts on this, before I proceed to make any changes. I'd very much appreciate if we can leave maxrec
as an instance property, though :)
astroquery/eso/core.py
Outdated
@deprecated_renamed_argument(('request_all_objects', 'request_id'), (None, None), | ||
since=['0.4.7', '0.4.7']) |
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 bit unrelated so no need to do it in this PR, but 0.4.7 was a while ago, so these deprecations can be now removed.
astroquery/eso/utils.py
Outdated
return where_constraints | ||
|
||
|
||
def reorder_columns(table: Table, |
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 have multiple questions here:
- is this really necessary? Why the default column order is not suffucient?
- but if this is necessary, then please just go by suggested way for table column reordering from the astropy docs, "Select or reorder columns" on this page: https://docs.astropy.org/en/stable/table/modify_table.html
Also, minor nitpicking, but all the other functions here are private, why is this one not?
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.
Hmmm... but the function is already doing exactly what the docs suggest (isn't it?)...
From the docs:
new_order = ['a', 'c', 'b'] # List or tuple
t_acb = t[new_order]
From the ESO module:
[...]
last_cols = first_cols + last_cols # this is a list of column names
table = table[last_cols]
The code above those two lines is just computing the list of column names.
Other than that,
- the function is now private, good point.
- yes, the reordering is necessary, because the default is alphabetical order and the first fields are long urls and other info that is not legible and take much space. The reorder was suggested by several beta testers, which were expecting the columns in the order that this function generates.
if not isinstance(table, Table): | ||
return table |
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.
Is this an expected case?
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, table
may be a string or an int, depending on the user parameters query_str_only
only and count_only
.
I admit this is not the best software design at this point, but a complete refactoring would have taken more time from both developers and reviewers. We will come with better encapsulation, separation of concerns, etc in the next pull request. Our aim for now was to switch to TAP with as little impact as possible to the API and to the overall code.
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 haven't reviewed the tests, but running them returned 77 failures, so please have a look.
pytest -P eso -R
should work if you have all the test dependencies installed.
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.
All tests were passing originally, but now I updated the fork from upstream and indeed, they are failing. I'll have a look.
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.
tests are passing again ✅
@@ -4,6 +4,33 @@ | |||
ESO Queries (`astroquery.eso`) | |||
****************************** | |||
|
|||
.. warning:: |
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 very good! Thanks for adding.
3742bb9
to
d3be2af
Compare
@bsipocz, thanks a lot for your comments, I have addressed most of them (the easy ones); for the rest, I'd still need some feedback from you. If you can give me feedback today, I can work immediately on it and push and update by tomorrow. Afterwards, I won't be able to work on Astroquery for the next couple of weeks. Just so you know, in case you can squeeze this review in your day 🤓 Thanks again! 👍 |
@juanmcloaiza - I'm sorry, it's very unlikely that I can get back to this today, but I'll try to do it soon so you can pick it up again in a few weeks time. |
Closes #3138
Changes:
Switch querying interface from WDB to TAP in querying functions:
Deprecate arguments:
open_form
cache
New functionality:
query_tap_service
(with authentication as well)cone_ra
,cone_dec
,cone_radius
argumentscount_only
argument