Skip to content

Conversation

@snbianco
Copy link
Contributor

@snbianco snbianco commented Sep 3, 2025

Support for resolving multiple object names at once with resolve_object(), including automatic batching into groups of up to 30 names per request to the service.

Some notes:

  • I refactored the batching code into another utils function, _batched_request. I also use this function for getting products via MastMissions.get_product_list.
  • I wanted to cause as few breaking changes as possible, so the format of the return depends on the value of the resolve_all flag and whether or not multiple objects are being passed in. I detail input combinations and what they return in the function docstring and the documentation.
  • When passing in multiple objects, and an object can't be resolved for whatever reason, I opt to warn the user that that particular object was not resolved rather than fail the entire call. When passing in a single object, the call will fail with an error if the object can't be resolved.

@snbianco snbianco added the mast label Sep 3, 2025
@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 98.57143% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.55%. Comparing base (e48e283) to head (2c588eb).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
astroquery/mast/utils.py 98.52% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3398      +/-   ##
==========================================
+ Coverage   70.50%   70.55%   +0.04%     
==========================================
  Files         232      232              
  Lines       19999    20019      +20     
==========================================
+ Hits        14101    14124      +23     
+ Misses       5898     5895       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@snbianco snbianco requested a review from bsipocz September 4, 2025 19:28
@snbianco snbianco marked this pull request as ready for review September 4, 2025 19:28
@snbianco snbianco marked this pull request as draft September 8, 2025 16:18
@snbianco snbianco marked this pull request as ready for review September 15, 2025 22:11
@bsipocz bsipocz added this to the v0.4.11 milestone Sep 16, 2025
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.

I have one minor comment, otherwise it looks good.

There are also a bunch of super minor whitespace issues for the docs due to the changed printings, could you please fix those up, too?

params[param_key] = items
resp = request_func(params)
resp.raise_for_status()
return extract_func(resp)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't be the return value be a list in all cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed this to always return a list of results for simplicity. In MastMissions.get_product_list, we only return the responses in a list if they are the product of batching.

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.

Thank you!

@bsipocz bsipocz merged commit 5ed0079 into astropy:main Sep 18, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants