跳转到主要内容

Sphinx 扩展,用于自动文档化带有apischema注释的类/函数

项目描述

Code CI Docs CI Test Coverage Latest PyPI version Apache License

Sphinx 扩展,用于自动文档化带有apischema注释的类/函数

PyPI

pip install sphinx-apischema

源代码

https://github.com/dls-controls/sphinx-apischema

文档

https://dls-controls.github.io/sphinx-apischema

更新日志

https://github.com/dls-controls/sphinx-apischema/blob/master/CHANGELOG.rst

如果你的类看起来像这样

from dataclasses import dataclass
from apischema import schema
from typing_extensions import Annotated as A

@dataclass
class MyClass:
    """Holds some very useful information about an object.

    We might use this in a registry of all the objects we have
    """

    name: A[str, schema(description="The name of the object")]
    age: A[float, schema(description="How old it is", min=0.0, max=1000.0)] = 5

    def summary(
        self,
        hide_age: A[bool, schema(description="Be secretive about the true age")] = True,
    ) -> str:
        """Return a nicely formatted summary of the object"""
        age = "***" if hide_age else self.age
        return f"{self.name}: {age}"

生成如下文档

MyClass

查看更多详细文档: https://dls-controls.github.io/sphinx-apischema

项目详情


下载文件

下载适合您平台的应用程序。如果不确定选择哪个,请了解有关 安装包 的更多信息。

源分发

上传时间:

打包分发

上传时间: Python 3

由以下支持