-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Support docstring formats: Google, NumPy, ReST #132
Comments
Hello! Thanks but I don't follow. What's an IR?What do you mean by diff? Why would I need Python code reversed from... what? 😅 And what does all this have to do with docstrings? |
I didn't quite get what IR @SamuelMarks refers to, but regardless, it would be great if griffe could parse Google and NumPy docstrings as well. I see that https://mkdocstrings.github.io/griffe/griffe.json has a Since cdd-python knows how to convert between docstring formats, maybe it could be used. |
See also gh-5. |
On second inspection, I see on https://github.com/mkdocstrings/griffe/blob/7bf49528541e211af37c2ac5c1a74a4523699c65/src/griffe/docstrings/parsers.py that there are already several parsers, so those styles are already supported? |
@pawamoy @astrojuanlu What my library allows you to do is to parse/emit docstrings (and other things, like functions and IR refers to intermediate representation.
Specifically on the docstring side you can parse/emit; with/without explicit type annotations; in ReST; NumPy; and Google formats. As for how to use the library, see the docstring docstring: https://github.com/offscale/cdd-python/blob/d6226df/cdd/docstring/parse.py#L8-L39 ; TL;DR import cdd.docstring.parse
import cdd.docstring.emit
ir = cdd.docstring.parse.docstring("my docstring goes here")
print(cdd.docstring.emit.docstring(ir, docstring_format="numpydoc")) |
Thanks @SamuelMarks for the explanation, it's a bit more clear now (I still don't understand how Griffe could use your project though, unless I dive a bit more in the code/docs or you give examples). @astrojuanlu Griffe is able to parse Google, Numpy and Sphinx docstrings, you can specify the style to parse with the |
I'll close this as there does not seem to be anything actionable for Griffe here. Feel free to comment further 🙂 |
GitHub just suggested your repo to me, maybe you want to use my library?
https://github.com/offscale/cdd-python
You could implement
diff
s betwixt the IR (a dictionary) and then reverse it down to the Python code that produced that IR and highlighting where they differ. Wouldn't be so difficult.Anyway just my 2¢
The text was updated successfully, but these errors were encountered: