You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We often reuse NumPy functions' docstrings. This is convenient as we don't take up maintaining docstrings (or more likely allowing them to go stale) when we don't have anything new to add. However there are few downsides to this approach (and possibly others I'm unaware of).
Mainly these sorts of things confuse new users and leave them wondering about what Dask actually supports. This is not a great situation for us to be in. There are a few ways we can improve this.
Manually copy and tweak docstrings when they deviate.
Scrub things in our wrapper function (e.g. versionadded, missing args, examples).
Add a note to the docs pointing out how the docstrings are made.
Add any missing behavior (though still need to handle version added).
This could be an issue with Pandas too. I don't work with that part of the code enough to know.
In general I agree that there is definitely some work that we can do here. I suggest the following concrete steps:
First, we add a disclaimer to the top of the wrapped docstring automatically. For example this might look like the following:
ORIGINALTITLEOFDOCSTRINGNote: thisdocstringwasautomaticallycopiedfromMODULE.FUNCTION_NAMESomediscrepanciesmayexistbetweenthatfunctionandthisDaskversion.
<thisisoptional>InparticulartheparametersX, Y, andZareunsupported</thisisoptional>ORIGINALBODYOFDOCSTRING
for example
Compute the arithmetic mean along the specified axis.
Note: this docstring was automatically copied from numpy.mean
Some discrepancies may exist between that function and this Dask version.
Returns the average of the array elements. The average is taken over
the flattened array by default, otherwise over the specified axis.
`float64` intermediate and return values are used for integer inputs.
The unsupported paramaters are made available if the person wrapping the function uses the ua_args keyword to the derived_from function, where all of this is done.
If ua_args is not specified, and if the function signature uses neither *args nor **kwargs, then we inspect the function signatures of both the wrapped and wrapping functions and note any paramters that are missing automatically.
This issue should be doable by someone with relatively little direct experience with Dask, but would be a very meaningful contribution. I'm marking this as a good first issue.
Lets just stay here for now. The other one is more broad and suggests rewriting docstrings. This one focuses on the (I think) more likely solution of handling things systematically.
Activity
[-]Improving docstring wrapping with NumPy functions[/-][+]Improving docstring wrapping functions[/+]mrocklin commentedon Nov 30, 2018
This is also related to #1815
In general I agree that there is definitely some work that we can do here. I suggest the following concrete steps:
First, we add a disclaimer to the top of the wrapped docstring automatically. For example this might look like the following:
for example
The unsupported paramaters are made available if the person wrapping the function uses the
ua_argskeyword to the derived_from function, where all of this is done.dask/dask/utils.py
Line 470 in 7247ce6
If
ua_argsis not specified, and if the function signature uses neither*argsnor**kwargs, then we inspect the function signatures of both the wrapped and wrapping functions and note any paramters that are missing automatically.This issue should be doable by someone with relatively little direct experience with Dask, but would be a very meaningful contribution. I'm marking this as a good first issue.
jakirkham commentedon Nov 30, 2018
Ah did not see that issue when I opened this one. Happy to consolidate as needed.
mrocklin commentedon Nov 30, 2018
Lets just stay here for now. The other one is more broad and suggests rewriting docstrings. This one focuses on the (I think) more likely solution of handling things systematically.