{ "info": { "author": "Marko Ristin", "author_email": "marko.ristin@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "sphinx-icontract\n================\n\n.. image:: https://api.travis-ci.com/Parquery/sphinx-icontract.svg?branch=master\n :target: https://api.travis-ci.com/Parquery/sphinx-icontract.svg?branch=master\n :alt: Build Status\n\n.. image:: https://coveralls.io/repos/github/Parquery/sphinx-icontract/badge.svg?branch=master\n :target: https://coveralls.io/github/Parquery/sphinx-icontract?branch=master\n :alt: Coverage\n\n.. image:: https://badge.fury.io/py/sphinx-icontract.svg\n :target: https://pypi.org/project/sphinx-icontract/\n :alt: PyPi\n\n.. image:: https://img.shields.io/pypi/pyversions/sphinx-icontract.svg\n :alt: PyPI - Python Version\n\nSphinx-icontract extends Sphinx to include icontracts of classes and functions in the documentation.\n\nUsage\n=====\nSphinx-icontract is based on the `sphinx.ext.autodoc` module. You need to specify both modules in\n``extensions`` of your Sphinx configuration file (``conf.py``).\n\nHere is an example excerpt:\n\n.. code-block:: python\n\n # Add any Sphinx extension module names here, as strings. They can be\n # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n # ones.\n extensions = [\n 'sphinx.ext.autodoc',\n 'sphinx_icontract'\n ]\n\nImplications\n------------\nSphinx-icontract tries to infer the implications from the conditions and render them as implication (``... \u21d2 ...``).\nWe implemented a rule-based matching that covers most of the practical use cases:\n\n* ``not A or B`` is translated to ``A \u21d2 B``.\n* Expressions are negated, so ``x < y or B`` is translated to ``x >= y \u21d2 B``. More general expressions are negated with\n ``not``: from ``x.y() or B`` to ``not x.y() \u21d2 B``.\n* If-Expressions are translated from ``B if A else True`` to ``A \u21d2 B``.\n\nWe found implications in form of if-expressions to be confusing when read in source code and encourage programmers\nto use disjunction form instead.\n\nCustom Errors\n-------------\nIf you specify custom errors in the contract, sphinx-icontract will try to include the error in the documentation.\n\nThe error type will be inferred from the contract's ``error`` argument. If the error message is given\nas a string literal and there is no contract description, the error message will be used to describe the contract\nso that you do not have to specify the description twice (once in the description of the contract and once\nin the error message).\n\nFor example:\n\n.. code-block:: python\n\n @icontract.pre(lambda x: x > 0, error=lambda: ValueError(\"x positive\"))\n def some_func(x: int) -> None:\n pass\n\nwill be documented as:\n\n.. code-block:: reStructuredText\n\n :requires:\n * :code:`x > 0` (x positive; raise :py:class:`ValueError`)\n\nIf both the description and the error message are given, only the description will be included:\n\n.. code-block:: python\n\n @icontract.pre(lambda x: x > 0, description=\"x must be positive\", error=lambda: ValueError(\"x positive\"))\n def some_func(x: int) -> None:\n pass\n\nwill be rendered as:\n\n.. code-block:: reStructuredText\n\n :requires:\n * :code:`x > 0` (x must be positive; raise :py:class:`ValueError`)\n\n.. danger::\n Be careful when you write contracts with custom errors which are included in the documentation. This might\n lead the caller to (ab)use the contracts as a control flow mechanism.\n\n In that case, the user will expect that the contract is *always* enabled and not only during debug or test.\n (For example, whenever you run `python` interpreter with ``-O`` or ``-OO``, ``__debug__`` will be `False`.\n If you passed ``__debug__`` to your contract's ``enabled`` argument, the contract will *not* be verified in\n ``-O`` mode.)\n\nInstallation\n============\n\n* Install sphinx-icontract with pip:\n\n.. code-block:: bash\n\n pip3 install sphinx-icontract\n\nDevelopment\n===========\n\n* Check out the repository.\n\n* In the repository root, create the virtual environment:\n\n.. code-block:: bash\n\n python3 -m venv venv3\n\n* Activate the virtual environment:\n\n.. code-block:: bash\n\n source venv3/bin/activate\n\n* Install the development dependencies:\n\n.. code-block:: bash\n\n pip3 install -e .[dev]\n\nWe use tox for testing and packaging the distribution:\n\n.. code-block:: bash\n\n tox\n\nPre-commit Checks\n-----------------\nWe provide a set of pre-commit checks that lint and check code for formatting.\n\nNamely, we use:\n\n* `yapf `_ to check the formatting.\n* The style of the docstrings is checked with `pydocstyle `_.\n* Static type analysis is performed with `mypy `_.\n* Various linter checks are done with `pylint `_.\n* Contracts are linted with `pyicontract-lint `_.\n* Doctests are executed using the Python `doctest module `_.\n\nRun the pre-commit checks locally from an activated virtual environment with development dependencies:\n\n.. code-block:: bash\n\n ./precommit.py\n\n* The pre-commit script can also automatically format the code:\n\n.. code-block:: bash\n\n ./precommit.py --overwrite\n\n\nVersioning\n==========\nWe follow `Semantic Versioning `_. The version X.Y.Z indicates:\n\n* X is the major version (backward-incompatible),\n* Y is the minor version (backward-compatible), and\n* Z is the patch version (backward-compatible bug fix).", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Parquery/sphinx-icontract", "keywords": "contracts sphinx extension icontract design-by-contract", "license": "License :: OSI Approved :: MIT License", "maintainer": "", "maintainer_email": "", "name": "sphinx-icontract", "package_url": "https://pypi.org/project/sphinx-icontract/", "platform": "", "project_url": "https://pypi.org/project/sphinx-icontract/", "project_urls": { "Homepage": "https://github.com/Parquery/sphinx-icontract" }, "release_url": "https://pypi.org/project/sphinx-icontract/2.0.0/", "requires_dist": null, "requires_python": "", "summary": "Extend sphinx to include icontracts.", "version": "2.0.0" }, "last_serial": 5410383, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "5f7030d83490a46433467d3649b64ae8", "sha256": "c056c940b0453d03d281b29035124da9921de6b7768be181e38ce0a4c757249f" }, "downloads": -1, "filename": "sphinx-icontract-1.0.0.tar.gz", "has_sig": false, "md5_digest": "5f7030d83490a46433467d3649b64ae8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4346, "upload_time": "2018-09-22T07:59:25", "url": "https://files.pythonhosted.org/packages/39/bf/0a008c118593a7e7ca9391f44519db8d206bc945b8ac3d82b652ed82fdf2/sphinx-icontract-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "7b93ae5f641489e89b38dc2873f03217", "sha256": "2c59c67854ca5f5fa0a20f4bdf412f536ab136a6485bd59d270f956cc15e3ed2" }, "downloads": -1, "filename": "sphinx-icontract-1.0.1.tar.gz", "has_sig": false, "md5_digest": "7b93ae5f641489e89b38dc2873f03217", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4349, "upload_time": "2018-09-22T08:22:49", "url": "https://files.pythonhosted.org/packages/79/54/e2a4f335321a712b99385bd046afbe7e11dfea417162707f501cdd624ffb/sphinx-icontract-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "83493389fe28cc3a0223441efd93e13f", "sha256": "7fe7b510ca74c58c1d65464b7ecbeb35d7cf9604212e534f070a74377cf24f3c" }, "downloads": -1, "filename": "sphinx-icontract-1.1.0.tar.gz", "has_sig": false, "md5_digest": "83493389fe28cc3a0223441efd93e13f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5084, "upload_time": "2018-09-27T21:32:40", "url": "https://files.pythonhosted.org/packages/ac/10/fef39c82aeb6d38a76375de8e89570e2ad6efa79296fd5a4e1ebb78105b6/sphinx-icontract-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "0d9799870d01c2dc49fca131cfea3021", "sha256": "b6854458bced75e26e4fafe1803759ae64b88a56640a0632459bfdf60ab753b5" }, "downloads": -1, "filename": "sphinx-icontract-1.1.1.tar.gz", "has_sig": false, "md5_digest": "0d9799870d01c2dc49fca131cfea3021", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5084, "upload_time": "2018-10-10T05:44:12", "url": "https://files.pythonhosted.org/packages/5d/ad/95059b24cb52b04ff63601c682c924d2b3b0b51f86e2a517386346d02e44/sphinx-icontract-1.1.1.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "793485e4a9092671a0e5e2fb61d475c9", "sha256": "72ada9b54ee69a4e1138b01512d92a1bab8ce5ef50d456f8dd544f5afa7d5c06" }, "downloads": -1, "filename": "sphinx-icontract-1.2.0.tar.gz", "has_sig": false, "md5_digest": "793485e4a9092671a0e5e2fb61d475c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6105, "upload_time": "2018-10-18T07:07:24", "url": "https://files.pythonhosted.org/packages/0e/e6/796f45877d7ef0e00ae90e502b886fb5692516e840a4013b4bf6646471b0/sphinx-icontract-1.2.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "0fedefabcf305ee6399d577127200be0", "sha256": "aca72303e386e4ea56aeb57732ed2fff86360752ddad6645685f963a13bdf151" }, "downloads": -1, "filename": "sphinx-icontract-1.3.0.tar.gz", "has_sig": false, "md5_digest": "0fedefabcf305ee6399d577127200be0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6926, "upload_time": "2018-10-20T06:59:50", "url": "https://files.pythonhosted.org/packages/e3/2b/1e490f241a17aeb4f556055d4fa51bb459b482aff958a6aa257961ccfcd0/sphinx-icontract-1.3.0.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "677a75f28f93da82083577475a7d316e", "sha256": "27274377bf844eb12de0701e37320d405fea5c0d98bf39ab4ff2b25452198428" }, "downloads": -1, "filename": "sphinx-icontract-1.3.1.tar.gz", "has_sig": false, "md5_digest": "677a75f28f93da82083577475a7d316e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6954, "upload_time": "2018-10-21T05:51:12", "url": "https://files.pythonhosted.org/packages/08/b0/84cde2c493dbc115f499f62f7fc3448d09f5aa1c780f85279801e8a2a37a/sphinx-icontract-1.3.1.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "eea3e261381087d73e8af381c9894ed7", "sha256": "c8315afb84174fe462e229334cffb89bb6838050ef5a1c0a452818c620692a24" }, "downloads": -1, "filename": "sphinx-icontract-1.4.0.tar.gz", "has_sig": false, "md5_digest": "eea3e261381087d73e8af381c9894ed7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8627, "upload_time": "2018-10-23T06:06:40", "url": "https://files.pythonhosted.org/packages/63/9b/9704e468b18b18d0192acbc28a8ae9b9d230055208414f90d2088ae71ce9/sphinx-icontract-1.4.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "8b41edd5dd2180e3768b890670a245ba", "sha256": "cd5e672de20eabce152cd99c86e0f20addb8899b6eb564f580fd92ad1fa5353c" }, "downloads": -1, "filename": "sphinx-icontract-2.0.0.tar.gz", "has_sig": false, "md5_digest": "8b41edd5dd2180e3768b890670a245ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8625, "upload_time": "2018-10-24T05:30:40", "url": "https://files.pythonhosted.org/packages/28/e0/e839cfed8759daa8a31a1ec74212f21a27d4ece34e340c020dd7a539c089/sphinx-icontract-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8b41edd5dd2180e3768b890670a245ba", "sha256": "cd5e672de20eabce152cd99c86e0f20addb8899b6eb564f580fd92ad1fa5353c" }, "downloads": -1, "filename": "sphinx-icontract-2.0.0.tar.gz", "has_sig": false, "md5_digest": "8b41edd5dd2180e3768b890670a245ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8625, "upload_time": "2018-10-24T05:30:40", "url": "https://files.pythonhosted.org/packages/28/e0/e839cfed8759daa8a31a1ec74212f21a27d4ece34e340c020dd7a539c089/sphinx-icontract-2.0.0.tar.gz" } ] }