Parse Python docstrings in reST, Google and Numpydoc format
Project description
docstring_parser
Parse Python docstrings. Currently support ReST, Google, Numpydoc-style and Epydoc docstrings.
Example usage:
>>> from docstring_parser import parse
>>>
>>>
>>> docstring = parse(
... '''
... Short description
...
... Long description spanning multiple lines
... - First line
... - Second line
... - Third line
...
... :param name: description 1
... :param int priority: description 2
... :param str sender: description 3
... :raises ValueError: if name is invalid
... ''')
>>>
>>> docstring.long_description
'Long description spanning multiple lines\n- First line\n- Second line\n- Third line'
>>> docstring.params[1].arg_name
'priority'
>>> docstring.raises[0].type_name
'ValueError'
Read API Documentation.
Contributing
To set up the project:
pip install --user poetry
git clone https://github.com/rr-/docstring_parser.git
cd docstring_parser
poetry install
poetry run pre-commit install
To run tests:
poetry run pytest
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
docstring_parser-0.15.tar.gz
(26.8 kB
view details)
Built Distribution
File details
Details for the file docstring_parser-0.15.tar.gz
.
File metadata
- Download URL: docstring_parser-0.15.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.5 Linux/5.18.15-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48ddc093e8b1865899956fcc03b03e66bb7240c310fac5af81814580c55bf682 |
|
MD5 | d2a30059fe0b6376d1964b6d9ffca35f |
|
BLAKE2b-256 | e82dea1dfc15b909cc660f657a3a9d698a2916b7f3b05535a2d72e8d7ea3ad5b |
File details
Details for the file docstring_parser-0.15-py3-none-any.whl
.
File metadata
- Download URL: docstring_parser-0.15-py3-none-any.whl
- Upload date:
- Size: 36.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.5 Linux/5.18.15-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1679b86250d269d06a99670924d6bce45adc00b08069dae8c47d98e89b667a9 |
|
MD5 | 4176b7d4890596aba13f4a330dca5d68 |
|
BLAKE2b-256 | 89e332e272db7adcf90e93f73e9a98fd763049ed7c641fb57ab26cb8f3e7e79c |