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
-
fooStringType() - Required: TrueDefault: UndefinedCustom value: True
-
barListType(StringType()) - Required: FalseDefault: Undefined
Metadata
Release files for sphinx-autoschematics 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sphinx-autoschematics-0.2.0.tar.gz | 9.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sphinx_autoschematics-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / sphinx-autoschematics-0.2.0.tar.gz
| Download URL | sphinx-autoschematics-0.2.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7332b494986cfe0a427b0088ae2e27e2c9f7c565fadd15a63916429a0c09789c
|
|
BLAKE2b-256 checksum How to use checksums |
4dd964dbbe045d6b4d0cdb8ab15467d4feef7b33208d5a67fa29c38f1faa58b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sphinx_autoschematics-0.2.0-py3-none-any.whl
| Download URL | sphinx_autoschematics-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06058658aa553176a112eb46babf1493d4d16b0e78a0179eb16d26a9b966836f
|
|
BLAKE2b-256 checksum How to use checksums |
0bccb00531d6021340fde21f7f462749d9a26caed424f26856ff2f9a072d8b42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|