docformatter icon indicating copy to clipboard operation
docformatter copied to clipboard

Support numpy or Google docstrings

Open leotrs opened this issue 4 years ago • 14 comments

Are there any plans to do this? Is this already implemented?

leotrs avatar Aug 25 '20 15:08 leotrs

We could add a new flag --convention same as pydocstyle does.

Pacu2 avatar Dec 30 '20 09:12 Pacu2

Would be a very nice feature !

erwanp avatar Jan 21 '21 11:01 erwanp

While this is still open, I wonder what do people currently use to format their numpy/Google docstrings? I could not find any alternatives to docformatter, and it's hard to believe developers are doing this by hand and not losing their sanity in the process.

ubalklen avatar Mar 29 '22 13:03 ubalklen

I could not find any alternatives to docformatter

@ubalklen there is also https://github.com/dadadel/pyment

The last time I tried it, it had a problem that running pyment -w . (-w is for formatting files in-place) multiple times doesn't produce the same result (it keeps adding docstring for parameters that already have docstrings)

But that should be a solvable problem.

mohammad7t avatar Mar 31 '22 16:03 mohammad7t

Thanks @mhsekhavat. I've just tried pyment, but it doesn't wrap long lines.

ubalklen avatar Mar 31 '22 17:03 ubalklen

any update on this?

Goldziher avatar Aug 08 '22 19:08 Goldziher

@Goldziher I recently started helping out with maintenance. I've been focusing on merging all the open PRs and addressing issues that were related to PEP 257 conventions. Once these are addressed, I'll release a new version (v1.5.0) of docformatter to PyPi. After that I plan to tackle the group of issues related to the various docstring styles (#43, #60, #68, #70, #78, #79). Once that group of issues is addressed, I'll release v1.6.0. Hopefully that'll happen in the next month or so.

weibullguy avatar Aug 10 '22 21:08 weibullguy

@Goldziher I recently started helping out with maintenance. I've been focusing on merging all the open PRs and addressing issues that were related to PEP 257 conventions. Once these are addressed, I'll release a new version (v1.5.0) of docformatter to PyPi. After that I plan to tackle the group of issues related to the various docstring styles (#43, #60, #68, #70, #78, #79). Once that group of issues is addressed, I'll release v1.6.0. Hopefully that'll happen in the next month or so.

Sounds great. Lemme know when it's ready to test on a codebase 😉

Goldziher avatar Aug 11 '22 05:08 Goldziher

Now that I'm thinking of it, I just stumbled upon the docstring_parser library. @weibullguy, are you aware of it? Is it something you ever considered at one point? It seems to be a good library to abstract the support of ReST, Google, Numpydoc-style and Epydoc styles.

kdeldycke avatar Mar 07 '23 08:03 kdeldycke

@kdeldycke I am aware of it now, thanks! It looks promising for dealing with the various syntax flavors.

weibullguy avatar Mar 08 '23 18:03 weibullguy

This would be a great feature.

Am about to convert a library from sphinx-style to google, and will be rewrapping a bunch of lines by hand.

Another library that parses, if you’re not already aware, is Griffe, which is used by mkdocstrings.

ssweber avatar Apr 08 '23 12:04 ssweber

Would be very needed !!!

simonprovost avatar Apr 27 '23 22:04 simonprovost

This has been marked as low urgency, but for me, the lack of support for Google doscstrings means I cannot use docformatter.

mcarans avatar Nov 27 '23 02:11 mcarans

what do people currently use to format their .../Google docstrings?

We did it by hand. And we liked it! (Though now that I'm no longer under G's thumb, I just started looking for such a tool and stumbled onto this issue.)

I could not find any alternatives to docformatter...

I just discovered https://github.com/heavenshell/py-doq which generates NEW docstrings, but explicitly will not update https://github.com/heavenshell/py-doq/issues/30

It seems to me that the various tools out there all touch on the subject, but none hits all of the bullet points (at least the ones I want):

  • Create docstrings from scratch with the same (exactly, or kind of) reasoning as pylint will use to complain (e.g., min-length, no-docstring-rgx)
  • Create docstrings that are almost-but-not-quite to documented specs (or generally, claim to follow documented guidelines for any X, except the rules they don't like and not let you easily make them right)
  • Update docstrings as parms are added/removed/reordered
  • Find the variety of config files consistently (IMO, the only thing pyproject.toml did was fulfill https://xkcd.com/927/, and even the it is suspect)

nexushoratio avatar Dec 08 '23 21:12 nexushoratio