-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Validator + converting array_like to array-like in docstrings #41295
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
DOC: Validator + converting array_like to array-like in docstrings #41295
Conversation
Hi @kemcbride - solid effort here, nice! I'll take a close look later in the 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.
lgtm, thanks @kemcbride
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.
Looking in more detail, I'm not exactly sure how this happens, but it seems like this decorator must be generating text with "array_like" in it. I kind of want to declare it out of scope for this PR, but I can dig into it more if needed.
Here's the part of the docstring which uses array_like
:
Lines 8100 to 8101 in 67c9385
>>> def custom_resampler(array_like): | |
... return np.sum(array_like) + 5 |
So, the check should probably exclude examples
Or just use a different variable name in the example |
Nice, thanks for updating! From a quick look it looks good, will check again at the weekend |
Boom. I think this is it! Looks like I only needed to fix the one use of Re-running the validator thing, using the script that's used for ci: https://gist.github.com/kemcbride/0f769423475aeb3aa4f92122cb307cdd, Looks good, return code = 0 Running the validator tests: https://gist.github.com/kemcbride/93adecdef7717fd0d4ceb689e87775ee Thanks for the quick review! |
Pinging just as a reminder @MarcoGorelli |
Hey @kemcbride - I'm a bit busy ATM with trying to get some things in to 1.3, as that's probably the last minor version before 2.0 and so that last chance for a while (2 years, maybe) to get some deprecations in, mind if I come back to this once 1.3 is in? Should just be a few weeks at most |
…ylike_hyphen_in_docstrings_not_underscore
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.
Thanks @kemcbride , I just did a slight fixup to make this more consistent with other checks
If you fancy trying a similar issue, there's #41719 still open
urgh. @MarcoGorelli please don't merge to master |
ah so sorry @simonjayhawkins - shall I revert these? |
I don't think that will make much difference. may need to start again as we have a commit for the release and a commit for the new tag and I doubt these will now push to master. These are created locally and only pushed once tests and checks on the documentation build have completed. normally need a 1-2 hour window with no commits to master. We could maybe change the scripts to not created the commits, and manually tag the hash where we want to branch and then manually tag the first commit after with the dev tag. The sdist has been built on a tagged branch with an extra commit, but that shouldn't matter for the sdist. |
Ouch...
OK, this was completely my fault, but for next time could there be a group mention somewhere advising to not merge anything? I won't make this mistake again, but if any new committers are added there's a risk they might For what it's worth, I'm free most of today to help out with anything if needed, though I understand there's probably not much I could do here at this point |
no worries. vary rarely goes smoothly.
That's my fault. I didn't realize i'd left the group mention out of the 1.3 RLS issue. (and I've done the same for 1.4) so that core/triage would get the notifications. |
Thanks. It might get messy when we get to the conda stage. I might need help on that. |
@MarcoGorelli when merging PRs that close issues can you also add the milestone to the closed issue. |
…andas-dev#41295) * Converting array_like to array-like in docstrings & comments * Add docstring validation check for array_like vs. array-like * Add unit test for arraylike validator, and fix example in core/generic.py * make method of PandasDocstring Co-authored-by: Marco Gorelli <[email protected]>
First try at any open source stuff! This one looked pretty doable, hopefully it's there's nothing wrong with it/let me know!
I'm not sure whether I should be checking these boxes, or a reviewer should. I believe this fixes the issue since it adds the validator, though it's not a particularly clever validator.
It technically is an added test, and it technically works - I re-added one of the entries and got a successful (correct) result for its failure... (amongst the infinite other validation failures 😢 )
I assume linting will run after the PR is submitted, but I'll look into running it locally, too.
More on the validator:
GL
as the code after looking through the numpy docstring validation guide and the pandas docstring validation guide - I think it stands for "General" and that seems like the best categorization for this message.raw_doc
for this but there was another property likeclean_doc
as well. I could just iterate through each section, too. 🤷Using the validator to pick up any missed docstring changes:
Actually, looking into those two remaining results - those are docstrings generated by lines like:
10220 @doc(NDFrame.resample, **_shared_doc_kwargs)
Looking in more detail, I'm not exactly sure how this happens, but it seems like this decorator must be generating text with "array_like" in it. I kind of want to declare it out of scope for this PR, but I can dig into it more if needed.
I suspect maybe the
Substitution
decorator tool can help, possibly. It seems kind of cheesy to add something that will substitute array_like for array-like in a docstring - eg, it might be the result of a function whose param is actually calledarray_like
, which, I'm pretty sure they do exist. I'm open to feedback on that.