sphinx-autoschematics 为文档化电路图模型提供 Sphinx 扩展
项目描述
sphinx-autoschematics
这是一个用于自动文档化 Schematics 模型的 Sphinx 扩展。
如何使用它
在您的 Sphinx 配置中,您需要将 autoschematics
列为扩展
extensions = ["autoschematics", "sphinx.ext.autodoc"]
这将为您提供一个新的 automodel
指令,您可以为模型提供完整路径
.. automodel:: myproject.models.MyModel
扩展将检查您的模型,并根据模型上的 docstring 和不同字段生成文档
示例
假设以下模型
from schematics import types
from schematics.models import Model
from schematics.types import compound
class MyModel(Model):
"""MyModel defines the structure of data when interacting with SomeService
Just like in Sphinx .rst files you can use restructured text directives in the
docstring to provide rich content in the generated docs.
.. code-block:: yaml
foo: Foo
bar:
- bar1
- bar2
"""
foo = types.StringType(
required=True,
metadata=dict(
custom_value=True
)
)
bar = compound.ListType(types.StringType, default=list)
将生成以下文档
models.MyModel
MyModel 定义了与 SomeService 交互时的数据结构
就像在 Sphinx .rst 文件中一样,您可以在 docstring 中使用 restructured text 指令,以在生成的文档中提供丰富内容
foo: Foo
bar:
- bar1
- bar2
-
foo
StringType() - 必需: True默认值: Undefined自定义值: True
-
bar
ListType(StringType()) - 必需: False默认值: Undefined
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源代码分发
sphinx-autoschematics-0.2.0.tar.gz (9.4 kB 查看哈希值)
构建分发
关闭
sphinx-autoschematics-0.2.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 7332b494986cfe0a427b0088ae2e27e2c9f7c565fadd15a63916429a0c09789c |
|
MD5 | c7d96f1dc7d4b91eca970bee99d2e062 |
|
BLAKE2b-256 | 4dd964dbbe045d6b4d0cdb8ab15467d4feef7b33208d5a67fa29c38f1faa58b8 |
关闭
sphinx_autoschematics-0.2.0-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 06058658aa553176a112eb46babf1493d4d16b0e78a0179eb16d26a9b966836f |
|
MD5 | 8c92bdf3e5fe7c246f16b999477f59e4 |
|
BLAKE2b-256 | 0bccb00531d6021340fde21f7f462749d9a26caed424f26856ff2f9a072d8b42 |