Skip to main content

Extend sphinx to include icontracts.

Project description

sphinx-icontract

Build Status Coverage PyPi PyPI - Python Version

Sphinx-icontract extends Sphinx to include icontracts of classes and functions in the documentation.

Usage

Sphinx-icontract is based on the sphinx.ext.autodoc module. You need to specify both modules in extensions of your Sphinx configuration file (conf.py).

Here is an example excerpt:

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx_icontract'
]

Installation

  • Install sphinx-icontract with pip:

pip3 install sphinx-icontract

Development

  • Check out the repository.

  • In the repository root, create the virtual environment:

python3 -m venv venv3
  • Activate the virtual environment:

source venv3/bin/activate
  • Install the development dependencies:

pip3 install -e .[dev]

We use tox for testing and packaging the distribution:

tox

Pre-commit Checks

We provide a set of pre-commit checks that lint and check code for formatting.

Namely, we use:

  • yapf to check the formatting.

  • The style of the docstrings is checked with pydocstyle.

  • Static type analysis is performed with mypy.

  • Various linter checks are done with pylint.

  • Contracts are linted with pyicontract-lint.

  • Doctests are executed using the Python doctest module.

Run the pre-commit checks locally from an activated virtual environment with development dependencies:

./precommit.py
  • The pre-commit script can also automatically format the code:

./precommit.py  --overwrite

Versioning

We follow Semantic Versioning. The version X.Y.Z indicates:

  • X is the major version (backward-incompatible),

  • Y is the minor version (backward-compatible), and

  • Z is the patch version (backward-compatible bug fix).

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

sphinx-icontract-1.1.1.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file sphinx-icontract-1.1.1.tar.gz.

File metadata

  • Download URL: sphinx-icontract-1.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/20.10.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2+

File hashes

Hashes for sphinx-icontract-1.1.1.tar.gz
Algorithm Hash digest
SHA256 b6854458bced75e26e4fafe1803759ae64b88a56640a0632459bfdf60ab753b5
MD5 0d9799870d01c2dc49fca131cfea3021
BLAKE2b-256 5dad95059b24cb52b04ff63601c682c924d2b3b0b51f86e2a517386346d02e44

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page