简介
nb-autodoc 是一个从 Python 源码的 类型注解 和 Docstring 自动生成 API 文档的工具。
本工具从包里查找所有的模块并导入,解析各模块的抽象语法树、运行时类型,链接内部对象,解析函数签名和 docstring 语法树,最终生成完整、可靠、带有链接的 API 文档。
主要特性
-
基于 AST 的类型分析系统
-
现代的类型展示,如
X | Y、list[str]、(*args) -> Any -
stub (.pyi) 支持
-
TYPE_CHECKING 支持
-
Re-export 支持,从 AST 解析导入引用
-
Overload 重载函数支持
用法
从 pip 安装:
pip install nb-autodoc
运行 nb-autodoc:
nb-autodoc {package_name}
其他命令行选项:
Usage: nb-autodoc [OPTIONS] MODULE
Options:
-o, --output-dir DIRECTORY [default: build]
-s, --skip TEXT skip import modules
-u, --undoc TEXT undocument modules
--markdown-linkmode [heading_id|vuepress]
[default: heading_id]
--help Show this message and exit.
提示: 使用 --undoc 而不是 --skip,后者会跳过模块的导入和分析。
Metadata
Release files for nb-autodoc 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nb_autodoc-1.0.4.tar.gz | 63.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nb_autodoc-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 116.0 kB
Release files / nb_autodoc-1.0.4.tar.gz
| Download URL | nb_autodoc-1.0.4.tar.gz |
|---|---|
| Size | 63.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57566cc074aa46de5d367bc6406364ade87956f7d0e6e30ce5fc2af64af912a0
|
|
BLAKE2b-256 checksum How to use checksums |
fc3607ffb6434e5a8554f89a5e1f405da67df8399b2f18a221199a3012e10010
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.2 CPython/3.11.4 Linux/6.6.87.2-microsoft-standard-WSL2
|
Release files / nb_autodoc-1.0.4-py3-none-any.whl
| Download URL | nb_autodoc-1.0.4-py3-none-any.whl |
|---|---|
| Size | 53.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68a75ee461dfc895efd5c31ced653dc7de1983605f65e701541d0eb172290032
|
|
BLAKE2b-256 checksum How to use checksums |
3d698c46be71fab80e7fee5b474eccf2efd234d5c72022a834807d54766199ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.2 CPython/3.11.4 Linux/6.6.87.2-microsoft-standard-WSL2
|