Parser for Numpy, Sphinx, and Google-style docstrings
Project description
docstring-utils
Simple parser for Numpy, Sphinx, and Google-style docstrings
📥 Installation
pip install -U docstring-utils
Requirements: Python 3.7+
🧑💻 Usage
Parse docstring
from docstring_utils import parse_docstring
def example(arg1: str, arg2: int) -> int:
"""Example of a Google-style docstring.
Args:
arg1 (str): Description of `arg1`.
arg2 (int): Description of `arg2`.
Returns:
int: Description of `return` value.
"""
return 0
result = parse_docstring(example, filter_args=True)
print(result.description) # "Example of a Google-style docstring."
args = result.args.values()
print(args[0].name) # "arg1"
print(args[0].description) # "Description of `arg1`."
print(args[0].type) # "str"
print(result.return_value.type) # "int"
print(result.return_value.description) # "Description of `return` value."
🧰 Development
Running tests
-
Install
toxwith the commandpip install -U tox -
Run tests with the command
tox
Linting
Run the following command to lint with flake8
python setup.py lint
(Note: The exact command may vary depending on your Python version and environment)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docstring-utils-1.0.0.tar.gz.
File metadata
- Download URL: docstring-utils-1.0.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecbafb71ed041c63a3ba906d600fc564b90bc25b580b63a6c0d9f85d6075eda5
|
|
| MD5 |
818c37af8a0e74cee962acc73de57435
|
|
| BLAKE2b-256 |
734b58b1ca65a59840aea1b068660798f5eb370f6c6f3f7da465940e74b49aed
|
File details
Details for the file docstring_utils-1.0.0-py3-none-any.whl.
File metadata
- Download URL: docstring_utils-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3eb2eaa6a7824e4b32204e0e1dbce057fe91e101a53f128836bcfbc2a7020460
|
|
| MD5 |
fe5a1705da8fdea0826073bdf8f978a1
|
|
| BLAKE2b-256 |
676f31a220cb9097961292f4868a37670c32c450b7019ef9f7cb65fdabd3c958
|