sphinx-autoschematics provides sphinx extensions for documenting schematics models
Project description
sphinx-autoschematics
This is a Sphinx extension to automatically document Schematics models.
How to use it
In your Sphinx configuration you will need to list autoschematics
as an extension:
extensions = ["autoschematics", "sphinx.ext.autodoc"]
This will provide a new automodel
directive that you can provide the full path of a model to:
.. automodel:: myproject.models.MyModel
The extension will inspect your model and generate documentation from the docstring and the different fields on the model.
Example
Given the following model:
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)
Would produce documentation like:
models.MyModel
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.
foo: Foo
bar:
- bar1
- bar2
-
foo
StringType() - Required: TrueDefault: UndefinedCustom value: True
-
bar
ListType(StringType()) - Required: FalseDefault: Undefined
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sphinx-autoschematics-0.2.0.tar.gz
.
File metadata
- Download URL: sphinx-autoschematics-0.2.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7332b494986cfe0a427b0088ae2e27e2c9f7c565fadd15a63916429a0c09789c |
|
MD5 | c7d96f1dc7d4b91eca970bee99d2e062 |
|
BLAKE2b-256 | 4dd964dbbe045d6b4d0cdb8ab15467d4feef7b33208d5a67fa29c38f1faa58b8 |
File details
Details for the file sphinx_autoschematics-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: sphinx_autoschematics-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06058658aa553176a112eb46babf1493d4d16b0e78a0179eb16d26a9b966836f |
|
MD5 | 8c92bdf3e5fe7c246f16b999477f59e4 |
|
BLAKE2b-256 | 0bccb00531d6021340fde21f7f462749d9a26caed424f26856ff2f9a072d8b42 |