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

ENH: Add more text to registry.search docstring for the types of constraints that can be used #426

Merged
merged 3 commits into from
Jul 26, 2023

Conversation

zoghbi-a
Copy link
Contributor

This is an enhancement to the registry search docstring. It adds a list of constraints that can be used.

The purpose of these additions is to make the docstring sufficient for the user who is not familiar with the available constraints to use the search method without a need to dig the documentation to find them.

I copied the relevant text from the the documentation page

@zoghbi-a zoghbi-a changed the title ENH: Add more text to registry.search for the types of constraints that can be used ENH: Add more text to registry.search docstring for the types of constraints that can be used Feb 21, 2023
@bsipocz bsipocz added this to the v1.4.1 milestone Feb 21, 2023
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.

Thanks. One minor comment, and also please remove training writespaces

Unrelated to the PR: I wonder whether anyone would be against adding all these as optional arguments rather than hide them in *constraints?

(from the API point of view I'm very much against the practice of *args, **kwargs, as more often than not they hide away bugs and usage errors, and if there is a finite set of possibilities that can be passed in those iterables)

@@ -122,6 +122,36 @@ def search(*constraints: rtcons.Constraint, includeaux: bool = False, maxrec: in
*constraints : `rtcons.Constraint` instances
The constraints (keywords to match, positions to cover, ...)
that the returned records need to satisfy.
The accepted constraints are:

- keywords: one or more freetext words, mached in the title,
Copy link
Member

Choose a reason for hiding this comment

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

Add an indent here and for all the other items in the list to make the rendering nicer.

Suggested change
- keywords: one or more freetext words, mached in the title,
- keywords: one or more freetext words, mached in the title,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the updated version better?

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 whitepace linting issue is still there, as well as some extra whitespace with the rendering (https://pyvo--426.org.readthedocs.build/en/426/api/pyvo.registry.regtap.search.html#pyvo.registry.regtap.search), I'll just add a commit that fixes all those rather than going back and forth with it.

Copy link
Member

@bsipocz bsipocz Feb 22, 2023

Choose a reason for hiding this comment

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

here it is with the new commit:
https://pyvo--426.org.readthedocs.build/en/426/api/pyvo.registry.regtap.search.html#pyvo.registry.regtap.search

Apparently, the rendering reuses the link and only serves the latest version.

@msdemlei
Copy link
Contributor

msdemlei commented Feb 22, 2023 via email

@bsipocz
Copy link
Member

bsipocz commented Feb 22, 2023

What worries me a bit (and that's the reason I initially tried to get
away with a link to the list of constraints) is how to keep this up
to date as constraints are added or changed. If anyone reading this
has a good (and preferably pragmatic) idea, please let me know.

I would make them mandatory keyword arguments. That would allow us to easily insert an additional one, and would require people to be explicit. As to removing, or renaming then we can use the astropy deprecation procedure for renaming/removing parameters.

@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Merging #426 (2bb3d54) into main (f10aff5) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #426   +/-   ##
=======================================
  Coverage   79.81%   79.81%           
=======================================
  Files          52       52           
  Lines        5989     5989           
=======================================
  Hits         4780     4780           
  Misses       1209     1209           
Impacted Files Coverage Δ
pyvo/registry/regtap.py 79.03% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@msdemlei
Copy link
Contributor

msdemlei commented Feb 23, 2023 via email

@bsipocz bsipocz modified the milestones: v1.4.1, v1.5 Mar 2, 2023
@bsipocz
Copy link
Member

bsipocz commented Jul 26, 2023

I go ahead with the merge as the discussion side-tracked towards how to better expose the constraints to the API. I still think that's the way forward, but in the meantime documenting the currently possible constraints is an improvement.

@bsipocz bsipocz modified the milestones: v1.5, v1.4.2 Jul 26, 2023
@bsipocz bsipocz merged commit a394cc8 into astropy:main Jul 26, 2023
@bsipocz
Copy link
Member

bsipocz commented Jul 26, 2023

Thanks @zoghbi-a!

bsipocz added a commit that referenced this pull request Aug 16, 2023
ENH: Add more text to registry.search docstring for the types of constraints that can be used
@zoghbi-a zoghbi-a deleted the enhance-registry-docstring branch September 19, 2023 02:21
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

3 participants