Skip to main content

Documentation Status Latest Version Supported Python versions Development Status License Download format Supported Python implementations

Dirty Models Sphinx extension

Sphinx extension for dirty models

About

Sphinx extension to help developers to write documentation of applications which use Dirty Models.

Features

  • Describe each field with real type.

  • All field types defined on Dirty Models are documented.

  • Use prefixed (doc comment using #: before field) or suffixed (Multiline doc string after field) documentation for each field.

  • Document read only fields.

  • Document default value for each field.

  • Document datetime format on those fields.

  • Able to set a prefix text in model signature.

  • Able to set a prefix text in fields signature.

  • Able to document field type as annotation or as field directive.

  • Able to add models to toctree.

  • Able to add model attributes to toctree.

  • Able to describe model as structure.

Changelog

Version 0.5.0
  • Added option to describe model as structure.

  • Added enum documenter.

  • Added option to hide/show alias.

  • Added option to hide/show read-only tag.

  • Added option to use custom title as model name.

  • No document fields with key hidden set to true on field metadata.

  • Better field type handling.

  • New module autodocumenter autodirtymodule in order to allow to set new options at module level.

Version 0.4.1
  • Fix installation.

Version 0.4.0
  • Document default timezone on TimeField and DatetimeField.

  • Document forced timezone on DatetimeField.

  • Minor fixes.

  • Fix nested classes.

  • Document EnumField.

Version 0.3.0
  • Added option to add models to toctree.

  • Added option to add model attributes to toctree.

  • Added option to set prefix model signature.

  • Added option to set prefix model field signature.

  • Added option to use field type as annotation.

  • Added fields to index.

  • Changed default value label to Default value.

Issues

  • Latex manual document class builder fails when model attributes are in toctree. That is because it creates a fake sections with same ids and remove after toctree is created. So, latex builder does not found references when it try to create links.

Installation

Just use pip to install it:

$ pip install dirty-models-sphinx

And add to Sphinx extensions to your project.

conf.py file:

extensions = [
    'sphinx.ext.autodoc',
    'dirty_models_sphinx'
]

Configuration

It is possible to modify Dirty Models Sphinx extension behavior using configuration in conf.py file.

dirty_model_add_classes_to_toc

If it is True Dirty Models classes will be added to table of content. Default: True.

dirty_model_add_attributes_to_toc

If it is True Dirty Models class attributes will be added to table of content, only if classes were added. Default: True.

dirty_model_class_label

It defines a prefix text for Dirty Model class signatures. It is possible to use None in order to avoid prefix. Default: 'Model'.

dirty_model_property_label

It defines a prefix text for Dirty Model class field signatures. It is possible to use None in order to avoid prefix. Default: 'property'.

dirty_enum_label

It defines a prefix text for enumearions signatures. It is possible to use None in order to avoid prefix. Default: 'Enum'.

dirty_model_hide_alias

It allows to hide field alias.

dirty_model_hide_readonly

It allows to hide read-only tags.

Usage

Just use regular autodocumenter:

.. automodule:: models
    :members:
    :show-inheritance:

Future

Documentation

http://dirty-models-sphinx-extension.readthedocs.io

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dirty-models-sphinx-0.5.0.tar.gz (10.7 kB view details)

Uploaded Source

File details

Details for the file dirty-models-sphinx-0.5.0.tar.gz.

File metadata

  • Download URL: dirty-models-sphinx-0.5.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for dirty-models-sphinx-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a0b7cc8b65e93c5b7c2bba739fcb96be502db9fa4b3943c06fa0cc8e4a626690
MD5 3d6f47f3030eceb359491b51e687658f
BLAKE2b-256 2aa9202550a0938e7354e745e35ebaecfe98ec998376e7bd4a35ce1164e4e30a

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.2

1 file

0.6.1

1 file

0.6.0

1 file

0.5.1

1 file

This release

0.5.0 This release

1 file

0.4.2

1 file

0.4.1

1 file

0.4.0

1 file

0.3.0

1 file

0.2.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page