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.versionandsys.platformconditional blocks, will only add docstrings to the correct branch - Able to modify files in-place with
-ior--in-place - Won't overwrite existing docstrings
- With
-bor--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.
Installation
Install from PyPI:
pip install docify
docify
# or
python -m docify
Or from conda-forge:
conda install conda-forge::docify
docify
# or
python -m docify
Or just download and run the script directly:
# Install dependencies
pip install libcst tqdm # tqdm is optional, and is only used if not running with -q
python docify.py
# or
python -m docify
# or
chmod +x docify.py
./docify.py
Usage
docify [-h] [-V] [-v] [-q] [-b] [--if-needed] (-i | -o OUTPUT_DIR) INPUT_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, --version show program's version number 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
--workers WORKERS set the number of worker processes to use. Use 1 to disable multiple processes, and 0 to auto-detect using the number of processors (default)
-i, --in-place modify stubs in-place
-o, --output OUTPUT_DIR
directory to write modified stubs to
Metadata
Release files for docify 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| docify-1.2.1.tar.gz | 30.6 kB | Without provenance | Details for docify-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| docify-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for docify-1.2.1-py3-none-any.whl |
Total release size: 40.2 kB
Release files / docify-1.2.1.tar.gz
| Download URL | docify-1.2.1.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed565259a3b20cd754438405b7830e12579f2223bb3c3f13c8e9318c258bc0a8
|
|
BLAKE2b-256 checksum How to use checksums |
f7658df7c9dbddefd5bc31474a9f2cdaa75b9f56a0c4d4b196957ef4b9aaf509
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / docify-1.2.1-py3-none-any.whl
| Download URL | docify-1.2.1-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5527e54b3b6c4e6ce13b31a0e68756e6a2fc01840a5247b457e49d88d87f9fa
|
|
BLAKE2b-256 checksum How to use checksums |
856dc7fc3387a7c91d57e1350d6c4b7ac0093b266eb4f0e78030622d2807e483
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for docify 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.