Skip to content
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

Add docstring #11

Open
MarcCote opened this issue May 22, 2015 · 13 comments
Open

Add docstring #11

MarcCote opened this issue May 22, 2015 · 13 comments

Comments

@MarcCote
Copy link
Member

Make sure we provide useful docstring.

@ASalvail
Copy link
Member

We need to find a format asap.
Some suggestions : http://stackoverflow.com/a/24385103

@mgermain
Copy link
Member

De ton link "Note that the reST is recommended by the PEP 287
https://www.python.org/dev/peps/pep-0287"

Donc worst case on fallback sur cella, mais j'aime bien cella de google je
le trouve pas mal plus claire. Un ou l'autre me derange pas.

On Tue, Jul 14, 2015 at 4:43 PM, ASalvail [email protected] wrote:

We need to find a format asap.
Some suggestions : http://stackoverflow.com/a/24385103


Reply to this email directly or view it on GitHub
#11 (comment).

@MarcCote
Copy link
Member Author

Because Python is dynamically typed, APIs can be somewhat confusing without clear docstrings. Personally, I found Numpydoc much clearer since it provides information about what a given function expects in inputs (it is also usable by Sphinx as the others).

That being said, we should use a format that is supported by readthedocs.org. An online documentation is infinitely better than the best offline format.

@mgermain
Copy link
Member

I don't see the advantage of numpy over google. The main diff is that numpy
takes more space.
On Jul 15, 2015 15:49, "Marc-Alexandre Côté" [email protected]
wrote:

Because Python is dynamically typed, APIs can be somewhat confusing
without clear docstrings. Personally, I found Numpydoc much clearer since
it provides information about what a given function expects in inputs (it
is also usable by Sphinx as the others).

That being said, we should use a format that is supported by
readthedocs.org
https://read-the-docs.readthedocs.org/en/latest/getting_started.html.
An online documentation is infinitely better than the best offline format.


Reply to this email directly or view it on GitHub
#11 (comment).

@MarcCote
Copy link
Member Author

In the google format the type of the parameter will have to be specified as text in the description of the parameter anyway. The information is still there but might be less easy to see it at first glance. I also don't think space is an issue if it helps to be clearer.

@ASalvail
Copy link
Member

Personally, I'm used to the numpy format.
It is long (quite long actually) and not supported for automatic docstring generation (that I know of).

Two criterion I'd look at : I want sphinx to work with it (giving us the online doc), but especially, I want the docstrings to be mostly generated automatically. Otherwise, we'll simple put off writing doc until it's too late.

@ASalvail
Copy link
Member

Nevermind : https://github.com/dadadel/pyment generates numpydocs. That'd be my first choice.
Anyone against?

@ASalvail ASalvail reopened this Jul 16, 2015
@MarcCote
Copy link
Member Author

"Pyment will generate docstrings where it doesn't exist. It will complete where it is partial. Or it will simply convert where the format is not the wanted one."

So, basically we can write the docstring in the format we want and pyment will convert it to reST. :D

@ASalvail
Copy link
Member

Interesting thing to add :
https://www.python.org/dev/peps/pep-0484/
https://www.jetbrains.com/pycharm/help/type-hinting-in-pycharm.html

Unless decided otherwise, I'll add these type hints to functions (if only for docstring autogen).

@MarcCote
Copy link
Member Author

@ASalvail have you check that it does help pyment generate docstring including parameters type? Do you know, if it is compatible with numpy style docstring? Obviously pep-0484 only shows examples using reST (PEP 287).

@MarcCote
Copy link
Member Author

Also, is it supported by python 3.3 or only python 3.5?

@ASalvail
Copy link
Member

The annotations, yes. The specific annotations that'll become standard in 3.5, no. You can still put them in, it won't make any error, but it'll be supported for use by introspection tools.

@ASalvail
Copy link
Member

It does help in pycharm; I don't know about the doc generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants