-
-
Notifications
You must be signed in to change notification settings - Fork 308
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
docs/add docstrings to synchronous API #2549
Conversation
note that some lower-level routines needed their function signatures updating -- it seems like |
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, and great that it caught some dodgy signatures. I left a couple of suggestions/questions
tests/test_api.py
Outdated
""" | ||
Test that functions in the API module have signatures that are derived from those in the asynchronous API module | ||
""" | ||
if func_name in ("tree", "load", "open", "open_array", "group"): |
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.
If the signature of two functions is different, shouldn't the docstring be different too. ie., this list and the same list above in test_derived_docstrings
should be the same?
In at least tree()
this seems to be correct - the docstring for zarr.api.asynchronous.tree
needs correcting to say it takes an AsyncGroup
as input, at which point it will have a different docstring to zarr.api.synchronous.tree
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 i think you are right -- by construction all of the docstrings should be different in their return type annotation, and so this test is currently incorrect (fortunately I guarded for something like this outcome in the test docstring by stating "derived from" rather than "equal to")
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 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.
Marking as requested changes so we don't forget the test needs fixing (see #2549 (comment))
Co-authored-by: Joe Hamman <[email protected]>
Co-authored-by: Joe Hamman <[email protected]>
Co-authored-by: Joe Hamman <[email protected]>
Co-authored-by: Joe Hamman <[email protected]>
Co-authored-by: Joe Hamman <[email protected]>
Co-authored-by: Joe Hamman <[email protected]>
Co-authored-by: Joe Hamman <[email protected]>
…-python into docs/add-docstrings
I removed the docstring / function signature tests, because I think they are too complex to implement properly right now. I think this is basically ready. |
I add docstrings to the exported functions defined in
api/synchronous.py
, copy exactly the same functions inapi/asynchronous.py
, except for a few places where the sync / async functions diverge.I also add a test to check that docstrings are identical, and another test to check that function signatures are identical, for said paired functions. These tests also get some exceptions for functions that are not quite identical.
closes #2475
TODO: