Sphinx 扩展,用于自动文档化带有apischema注释的类/函数
项目描述
Sphinx 扩展,用于自动文档化带有apischema注释的类/函数
PyPI |
pip install 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}"
生成如下文档
项目详情
sphinx-apischema-0.1.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 9e5d6c3f407fdd1c6b60b3769a5a5265265e0a542dd021f0f7e526cfa3df45e2 |
|
MD5 | 4051778c199ac5171fec0035f961d9ed |
|
BLAKE2b-256 | 423922f2a873715c5aac40ae74225c6cce6a7dc2352966746295772e7d714480 |
sphinx_apischema-0.1-py3-none-any.whl的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | be8b057a38e585d00bec70c9a5ab6d133bb3d933e61c5aebadd15fc0c2129d7b |
|
MD5 | df33558ef857f98e2c48a870d2d59924 |
|
BLAKE2b-256 | 5566f35aa4939f6ff45fbf4e74aa67327decdfb4bb656dea09df27ba28817c41 |