Auto generate docstring from type-hints.
Project description
docstring_generator
Auto generate docstring from type-hints for python functions and class methods.
How to use it
gendocs_new file.py
gendocs_new mydir/
Options
style
--style
- Docstring style [numpy, google, rest]. [default: numpy]
Add additional information before running gendocs_new
- when adding
$<num>
into your docstring these will then be replaced with parameter at this index - Example:
from typing import List
def foo(val_a: int, val_b: List[int]):
"""
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
$1 Lorem ipsum dolor sit amet
$2 nonumy eirmod tempor invidun
"""
will become (here with numpy style)
from typing import List
def foo(val_a: int, val_b: List[int]):
"""
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
Parameters
----------
val_a : argument of type int
Lorem ipsum dolor sit amet
val_b : argument of type List(int)
nonumy eirmod tempor invidun
"""
FAQ
what happens if I re-run the docstring creation?
- nothing if all stays the same, changed parameter descriptions will be ignored only changes of the function header will be used
Examples
- An example can be found under examples
Installing
- pip install docstring-generator
Versioning
- For the versions available, see the tags on this repository.
Support for older version
- the previous command
gendocs
is still supported for this version.
Authors
- Felix Eisenmenger
License
- This project is licensed under the MIT License - see the LICENSE.md file for details
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
Close
Hashes for docstring-generator-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa9409bc2324aef1dc8f12c8688e8a2ce12d7553e858174ed48a6ab49c907509 |
|
MD5 | 0a7f1add205c399d57d5d8809c1ec8e8 |
|
BLAKE2b-256 | b6961c084d3ebba393cd10577d651245a01053e114be9e7e1886124e6ea78cce |
Close
Hashes for docstring_generator-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 213d838c6e197fd1d6b4e3e30ccd96ab50872214700ff9b758e924ac7286b867 |
|
MD5 | fd051e7fb78d2531a2ede52fd71ff726 |
|
BLAKE2b-256 | aebe24b4c91835a1b558dddbf776d7e27edc1de5f39e6b55c5bb03b2466e9ad7 |