[DOC] Docstring style should be made clear in `contributing` page
See original GitHub issueBrief Description of Fix
Currently, the docs do not clearly describe the coding standards that the project probably should adhere to.
I believe this should be added to the Contributing
page.
For reference, it should look something like this:
We recommend that you write docstrings before you write a test for the function, and that you write the test before writing the function implementation. This is an example of combining doc- and test-driven development together, to clarify what the function is intended to do before actually implementing it. Use the following example to help guide you on how to write your new function docstring properly.
def new_janitor_function(df, param1, param2):
“””
One line that describes what the function does.
Further elaboration on the function. Use one or more paragraphs to do any of the following:
1. Provide more detail on intended usage
2. Clearly state assumptions on what the input dataframe should look like.
3. Identify edge cases that will cause the function to raise an error.
4. Other things that you want the end-user to know about before using the function.
Method chaining example:
.. code-block:: python
df = df.new_janitor_function(param1, param2)
Functional example:
.. code-block:: python
df = new_janitor_function(df, param1, param2)
:param param1: A description of param1.
:param param2: A description of param2.
:return: A description of the dataframe that is returned.
“””
# now put your function implementation here
Relevant Context
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
SymPy Docstrings Style Guide
A documentation string (docstring) is a string literal that occurs as the first statement in a module, function, class, or method definition.
Read more >Python Docstrings Tutorial : Examples & Format for Pydoc ...
See Python Docstrings. Learn about the different types of docstrings & various docstring formats like Sphinx, Numpy, and Pydoc with examples now.
Read more >Contributing to the documentation - Pandas
The docstrings provide a clear explanation of the usage of the individual functions, while the documentation in this folder consists of tutorial-like overviews ......
Read more >Documenting Python Code: A Complete Guide
Documenting your Python code is all centered on docstrings. These are built-in strings that, when configured correctly, can help your users and yourself ......
Read more >What are the most common Python docstring formats? [closed]
good answer. I dare say where you can change default docstring format in PyCharm (JetBrains): Settings --> Tools --> Python Integrated Tools -->...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@hectormz I like that issue as well and I had the exact same questions on Friday when trying to extend a function feature (for example, it was not very clear to me at first about where the test data was loaded). If you and @ericmjl are both comfortable with me taking a stab at it, please combine the two issues. Can’t guarantee to get the skeleton examples right at first try, but I am sure you guys can help me iterate.
@shandou you caught a bug of mine!
I used to use it to isolate just the test that I’m currently hacking on. It must have slipped into the library.
The correct way to isolate just the test that we are writing, borrowing the example above, is to do:
This will run only the tests that contain the substring
test_shuffle
. Usually that is good enough to avoid running the full test suite.mypy
is used during development. I have a PR open to usemypy
in CI, but I’m still not clear what we’d be checking for though. I think we can ignoremypy
for the time being.