question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rewrite docstrings

See original GitHub issue

Currently we blindly copy dask.array and dask.dataframe docstrings from NumPy and Pandas. This allows us to avoid rewriting hundreds of docstrings.

However, this fails when the dask operation and the numpy/pandas operation differ slightly, as often occurs when we support only a subset of functionality. This appears to be confusing users who inspect our documentation, try something out, and then receive an error when it doesn’t work (see this example).

There are some efforts to mitigate this, for example derived_from takes a list of unavailable arguments to add to the docstring. However this keyword argument is virtually unused.

Some solutions

  1. Crowd-sourced effort to rewrite docstrings manually
  2. Add disclaimer to all wrapped functions that it is merely a copy
  3. ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
solozcommented, Apr 4, 2017

Hi,

I’ve been using dask - thanks for the work. So its time to start giving back. For start, I’m happy to work on this, #1592 and #1606 and see how I get on with. Also happy to sync with anyone already doing so.

Should put in a pr over the coming days.

1reaction
TomAugspurgercommented, Feb 27, 2020

Talking with @jsignell, we may want to just strip out parameters that aren’t supported by dask.

Rather than

Parameters
----------
rule : DateOffset, Timedelta or str
    The offset string or object representing target conversion.
axis : {0 or 'index', 1 or 'columns'}, default 0  (Not supported in Dask)
    Which axis to use for up- or down-sampling. For `Series` this
    will default to 0, i.e. along the rows. Must be
    `DatetimeIndex`, `TimedeltaIndex` or `PeriodIndex`.
closed : {'right', 'left'}, default None
...

We’d have

Parameters
----------
rule : DateOffset, Timedelta or str
    The offset string or object representing target conversion.
closed : {'right', 'left'}, default None
...

Notes
------
The following paramerts are not supported by dask

* axis
* ...

or put that next to the dask disclaimer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rewriting Python docstrings with a metaclass - Jessica Hamrick
Rewriting Python docstrings with a metaclass ... First (lines 32–43), we rewrite the docstrings for the functions given in attrs .
Read more >
python - How to programmatically change the docstrings in a file
This is exactly what you want to do: 1- Access the docstring of every method and modify it to include the default values....
Read more >
Python Docstrings (With Examples) - Programiz
Python docstrings are the string literals that appear right after the definition of a function, method, class, or module. Let's take an example....
Read more >
A Python Module for intelligent reuse of docstrings — docrep ...
A Python Module for intelligent reuse of docstrings. What's this? The docrep workflow; Installation; How to add custom sections; API Reference. Disclaimer.
Read more >
Python - convert docstring styles - Krystian Safjan's Blog
When refactoring the project one might want to change docstring style e.g. from numpy-style to google-style. At this point tool like Pyment ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found