sphinx-autoschematics provides sphinx extenions 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.1.1.tar.gz
.
File metadata
- Download URL: sphinx-autoschematics-0.1.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcb7ebec51cbf3a7f2da4259ed512a44436ee570c56d3ea37c83ec2f1f1bc93b |
|
MD5 | b410fedb5d02a930b6669436432b0070 |
|
BLAKE2b-256 | 1da0101998bce5becc8a87e5575db227f661e0dc5ce173bc7aab24f4ebef7a2b |
File details
Details for the file sphinx_autoschematics-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: sphinx_autoschematics-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 167035c70451178e14f06143ceb80da815e1bdca3afc1d12781fab8d8b5542fa |
|
MD5 | 3faa93e9d35b4b9606f546b829510b5e |
|
BLAKE2b-256 | 10f54eb3a77aeec7c11a44f76feca7c4fc6ef596d794041e8655adc1477ddc8e |