👷using nb-autodoc to generate api docs

This commit is contained in:
hemengyang 2022-01-14 19:58:22 +08:00
parent cc343c981f
commit a47b8c68c0
4 changed files with 46 additions and 3 deletions

View File

@ -25,8 +25,8 @@ jobs:
- name: Install and build - name: Install and build
run: | run: |
poetry run sphinx-build -M markdown ./docs_build ./build poetry run python ./docs_build/autodoc.py
cp -r ./build/markdown/* ./website/docs/api/ cp -r ./build/nonebot/* ./website/docs/api/
yarn prettier yarn prettier
yarn build yarn build

10
docs_build/autodoc.py Normal file
View File

@ -0,0 +1,10 @@
from nb_autodoc import Module, Context
from nb_autodoc.builders.markdown import MarkdownBuilder
context = Context()
module = Module("nonebot", context=context)
builder = MarkdownBuilder(module, output_dir="build")
builder.write()

34
poetry.lock generated
View File

@ -547,6 +547,25 @@ category = "dev"
optional = false optional = false
python-versions = "*" python-versions = "*"
[[package]]
name = "nb-autodoc"
version = "0.1.0"
description = "API doc generator for NoneBot."
category = "dev"
optional = false
python-versions = ">=3.7"
develop = false
[package.dependencies]
attrs = ">=21.4,<22.0"
six = ">=1.6.1"
[package.source]
type = "git"
url = "https://github.com/nonebot/nb-autodoc.git"
reference = "master"
resolved_reference = "ab906e128e52946c5c37de77a06019c77bd34e1d"
[[package]] [[package]]
name = "nonebug" name = "nonebug"
version = "0.2.0" version = "0.2.0"
@ -870,6 +889,14 @@ idna = {version = "*", optional = true, markers = "extra == \"idna2008\""}
[package.extras] [package.extras]
idna2008 = ["idna"] idna2008 = ["idna"]
[[package]]
name = "six"
version = "1.16.0"
description = "Python 2 and 3 compatibility utilities"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]] [[package]]
name = "sniffio" name = "sniffio"
version = "1.2.0" version = "1.2.0"
@ -1226,7 +1253,7 @@ websockets = ["websockets"]
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.7.3" python-versions = "^3.7.3"
content-hash = "38712544050fe96eb806af6db9adfc4c3db776d30da0f7a07280bdf1a3aa3617" content-hash = "a7113dce5c7316f42a109576751a0802b86973278bc0f61b03f226836757a247"
[metadata.files] [metadata.files]
aiodns = [ aiodns = [
@ -1870,6 +1897,7 @@ mypy-extensions = [
{file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"},
{file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"},
] ]
nb-autodoc = []
nonebug = [] nonebug = []
packaging = [ packaging = [
{file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"},
@ -2059,6 +2087,10 @@ rfc3986 = [
{file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"},
{file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"},
] ]
six = [
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
]
sniffio = [ sniffio = [
{file = "sniffio-1.2.0-py3-none-any.whl", hash = "sha256:471b71698eac1c2112a40ce2752bb2f4a4814c22a54a3eed3676bc0f5ca9f663"}, {file = "sniffio-1.2.0-py3-none-any.whl", hash = "sha256:471b71698eac1c2112a40ce2752bb2f4a4814c22a54a3eed3676bc0f5ca9f663"},
{file = "sniffio-1.2.0.tar.gz", hash = "sha256:c4666eecec1d3f50960c6bdf61ab7bc350648da6c126e3cf6898d8cd4ddcd3de"}, {file = "sniffio-1.2.0.tar.gz", hash = "sha256:c4666eecec1d3f50960c6bdf61ab7bc350648da6c126e3cf6898d8cd4ddcd3de"},

View File

@ -44,6 +44,7 @@ pytest-cov = "^3.0.0"
pytest-xdist = "^2.5.0" pytest-xdist = "^2.5.0"
nonebug = { git = "https://github.com/nonebot/nonebug.git" } nonebug = { git = "https://github.com/nonebot/nonebug.git" }
sphinx-markdown-builder = { git = "https://github.com/nonebot/sphinx-markdown-builder.git" } sphinx-markdown-builder = { git = "https://github.com/nonebot/sphinx-markdown-builder.git" }
nb-autodoc = {git = "https://github.com/nonebot/nb-autodoc.git"}
[tool.poetry.extras] [tool.poetry.extras]
quart = ["quart"] quart = ["quart"]