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 details)
Built Distribution
File details
Details for the file docify-1.0.0.tar.gz
.
File metadata
- Download URL: docify-1.0.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.15.4 CPython/3.12.4 Linux/6.9.7-zen1-1-zen
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d779f8348dd8d46796709c0db7d710cbc6354935d90a727c9ff3ab77b4cd3bf |
|
MD5 | 273b946f5ebaaccf6f1f4aaec599e718 |
|
BLAKE2b-256 | b2ccd403e8dbe89826340a18909e0aa26ed917981d41579ba91145e2e1b954c8 |
File details
Details for the file docify-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: docify-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.15.4 CPython/3.12.4 Linux/6.9.7-zen1-1-zen
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 518b4ad32eaec2ff527968055ee74ca2fbf9cabad3eb0e4db830fa06997e5609 |
|
MD5 | 3bcce93f3061a1d6d2282eb28cddafb0 |
|
BLAKE2b-256 | 6ada73125db0a3b9bab370caca1222c25f3043bf2c5d56618903ddffca2441e8 |