A script to add docstrings to Python type stubs using reflection
Project description
docify
A script to add docstrings to Python type stubs using reflection
Features
- Uses LibCST to parse and modify the stub file
- Dynamically imports the actual module to get the runtime docstring
- Handles most
sys.version
andsys.platform
conditional blocks, will only add docstrings to the correct branch - Able to modify files in-place with
-i
or--in-place
- Won't overwrite existing docstrings
- With
-b
or--builtins-only
, will only add docstrings for modules found insys.builtin_module_names
(stdlib modules written in C). - With
--if-needed
, will only add docstrings if the object's (Python) source code is unavailable. Useful for language servers like basedpyright that are able to extract docstrings from source code.
Requirements
Usage
docify.py [-h] [-v] [-q] [-b] [--if-needed] (-i | -o OUTPUT_DIR) INPUT_DIR
A script to add docstrings to Python type stubs using reflection
positional arguments:
INPUT_DIR directory to read stubs from
options:
-h, --help show this help message and exit
-v, --verbose increase verbosity
-q, --quiet decrease verbosity
-b, --builtins-only only add docstrings to modules found in `sys.builtin_module_names`
--if-needed only add a docstring if the object's source code cannot be found
-i, --in-place modify stubs in-place
-o OUTPUT_DIR, --output OUTPUT_DIR
directory to write modified stubs to
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
docify-1.0.0.tar.gz
(7.2 kB
view hashes)
Built Distribution
docify-1.0.0-py3-none-any.whl
(7.9 kB
view hashes)