{ "info": { "author": "Davis Kirkendall", "author_email": "davis.e.kirkendall@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Sphinx :: Extension", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Documentation :: Sphinx" ], "description": "|Build Status| |Coverage Status| |PyPi Status|\n\n\nsphinx-autodoc-napoleon-typehints\n=================================\n\nThis extension allows you to use Python 3 annotations for documenting acceptable argument types\nand return value types of functions. This allows you to use type hints in a very natural fashion,\nallowing you to migrate from this:\n\n.. code-block:: python\n\n def format_unit(value, unit):\n \"\"\"\n Formats the given value as a human readable string using the given units.\n\n :param float|int value: a numeric value\n :param str unit: the unit for the value (kg, m, etc.)\n :rtype: str\n \"\"\"\n return '{} {}'.format(value, unit)\n\nto this:\n\n.. code-block:: python\n\n from typing import Union\n\n def format_unit(value: Union[float, int], unit: str) -> str:\n \"\"\"\n Formats the given value as a human readable string using the given units.\n\n :param value: a numeric value\n :param unit: the unit for the value (kg, m, etc.)\n \"\"\"\n return '{} {}'.format(value, unit)\n\n\nThere is also support for google docstrings or numpy docstrings with help of the napoleon\n`napoleon sphinx extention `_.\nThis means that even docstrings like this:\n\n.. code-block:: python\n\n def format_unit_google(self, value: Union[float, int], unit: str, test: Optional[Union[Iterable, str]]) -> str:\n \"\"\"\n Formats the given value as a human readable string using the given units.\n\n Args:\n value: a numeric value\n unit: the unit for the value (kg, m, etc.)\n test: bla bla blathe unit for the value (kg, m, etc.)\n\n Returns:\n This function returns something of\n value: and does not overwrite this part.\n \"\"\"\n return '{} {}'.format(value, unit)\n\n def format_unit_numpy(self, value: Union[float, int], unit: str, test: Optional[Union[Iterable, str]]) -> str:\n \"\"\"\n Formats the given value as a human readable string using the given units.\n\n Parameters\n ----------\n value: a numeric value\n unit: the unit for the value (kg, m, etc.)\n test: bla bla blathe unit for the value (kg, m, etc.)\n\n Returns\n -------\n This function returns something of\n value: and does not overwrite this part.\n \"\"\"\n return '{} {}'.format(value, unit)\n\n\nthe result for which is the same as above\n\n\nInstallation and setup\n----------------------\n\nFirst, use pip to download and install the extension::\n\n $\u00a0pip install sphinx-autodoc-napoleon-typehints\n\nThen, add the extension to your ``conf.py``:\n\n.. code-block:: python\n\n extensions = [\n 'sphinx.ext.autodoc',\n 'sphinx_autodoc_napoleon_typehints'\n ]\n\n\nHow it works\n------------\n\nThe extension listens to the ``autodoc-process-signature`` and ``autodoc-process-docstring``\nSphinx events. In the former, it strips the annotations from the function signature. In the latter,\nit injects the appropriate ``:type argname:`` and ``:rtype:`` directives into the docstring.\n\nOnly arguments that have an existing ``:param:`` directive in the docstring get their respective\n``:type:`` directives added. The ``:rtype:`` directive is added if and only if no existing\n``:rtype:`` is found.\n\nThis extension does not currently have any configuration options.\n\n\nProject links\n-------------\n\n* `Source repository `_\n* `Issue tracker `_\n* The project was originally forked from `here `_\n\n\n.. |Build Status| image:: https://travis-ci.org/daviskirk/sphinx-autodoc-napoleon-typehints.svg?branch=master\n :target: https://travis-ci.org/daviskirk/sphinx-autodoc-napoleon-typehints\n.. |Coverage Status| image:: https://coveralls.io/repos/github/daviskirk/sphinx-autodoc-napoleon-typehints/badge.svg?branch=master\n :target: https://coveralls.io/github/daviskirk/sphinx-autodoc-napoleon-typehints?branch=master\n.. |PyPi Status| image:: https://badge.fury.io/py/sphinx-autodoc-napoleon-typehints.svg\n :target: https://badge.fury.io/py/sphinx-autodoc-napoleon-typehints", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/daviskirk/sphinx-autodoc-napoleon-typehints", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sphinx-autodoc-napoleon-typehints", "package_url": "https://pypi.org/project/sphinx-autodoc-napoleon-typehints/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/sphinx-autodoc-napoleon-typehints/", "project_urls": { "Homepage": "https://github.com/daviskirk/sphinx-autodoc-napoleon-typehints" }, "release_url": "https://pypi.org/project/sphinx-autodoc-napoleon-typehints/2.1.6/", "requires_dist": [ "Sphinx (>=1.4)", "sphinxcontrib-napoleon", "typing" ], "requires_python": "", "summary": "Type hints (PEP 484) support for the Sphinx autodoc extension", "version": "2.1.6" }, "last_serial": 2867088, "releases": { "2.0.1": [], "2.0.3": [ { "comment_text": "", "digests": { "md5": "e2f562956afe549243258f827d822466", "sha256": "5a8527d8113e06b66ad86f8f93c179836a9c5232766b8e5bab061c1ab7e25e73" }, "downloads": -1, "filename": "sphinx-autodoc-napoleon-typehints-2.0.3.tar.gz", "has_sig": false, "md5_digest": "e2f562956afe549243258f827d822466", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12890, "upload_time": "2016-06-04T15:32:18", "url": "https://files.pythonhosted.org/packages/0b/2e/ba554b59085ee6f11c73f1e7e9c2b31a38aa335d44d39778644080443e1b/sphinx-autodoc-napoleon-typehints-2.0.3.tar.gz" } ], "2.1.4": [ { "comment_text": "", "digests": { "md5": "c0b15139142d79f7de21f0541381cb8b", "sha256": "c5ccad899ea836a5545e393276295d34ce023c563dc51d0ba50f1e4d4966ee62" }, "downloads": -1, "filename": "sphinx_autodoc_napoleon_typehints-2.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c0b15139142d79f7de21f0541381cb8b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7077, "upload_time": "2016-09-06T12:16:28", "url": "https://files.pythonhosted.org/packages/82/32/0b18745f6301a4eab9c856752f3cf7f23d5c5eb214d81ac2544f478482ee/sphinx_autodoc_napoleon_typehints-2.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c361a0e1ae728f79dd0e68b101bdc281", "sha256": "0e1307fe0da08ad49d39007c0bfb8e7d917111938c75a78327c89e7f6ae6fd68" }, "downloads": -1, "filename": "sphinx-autodoc-napoleon-typehints-2.1.4.tar.gz", "has_sig": false, "md5_digest": "c361a0e1ae728f79dd0e68b101bdc281", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10889, "upload_time": "2016-09-06T12:16:31", "url": "https://files.pythonhosted.org/packages/8a/f2/90e7419c37c1f153d0637736f3915360c70c9ca439b6428e9fe34bc2c867/sphinx-autodoc-napoleon-typehints-2.1.4.tar.gz" } ], "2.1.6": [ { "comment_text": "", "digests": { "md5": "9e2fbfe2fb45d15d131b568f80f79c3d", "sha256": "ad2f6a89eff950b30b65097f41a9f7065df168998a5fab16bb94df2d6b45e087" }, "downloads": -1, "filename": "sphinx_autodoc_napoleon_typehints-2.1.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9e2fbfe2fb45d15d131b568f80f79c3d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7535, "upload_time": "2017-05-11T13:54:53", "url": "https://files.pythonhosted.org/packages/7f/0e/2d453296810270564bbafb6603d4cca2598f02fa9fb49c3177ba7ea40da0/sphinx_autodoc_napoleon_typehints-2.1.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "12182b1c73e9538b003931a9f55a99c7", "sha256": "67e36dc22d03362ab95c41d33b3a86fd8a7561a73648df112cdb57f989e1dae9" }, "downloads": -1, "filename": "sphinx-autodoc-napoleon-typehints-2.1.6.tar.gz", "has_sig": false, "md5_digest": "12182b1c73e9538b003931a9f55a99c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13109, "upload_time": "2017-05-11T13:54:55", "url": "https://files.pythonhosted.org/packages/05/0b/8ccc320b7fdfbb8e57cafefb5d7fb45db383f651dca2eb1fd74b8f3d6f1a/sphinx-autodoc-napoleon-typehints-2.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9e2fbfe2fb45d15d131b568f80f79c3d", "sha256": "ad2f6a89eff950b30b65097f41a9f7065df168998a5fab16bb94df2d6b45e087" }, "downloads": -1, "filename": "sphinx_autodoc_napoleon_typehints-2.1.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9e2fbfe2fb45d15d131b568f80f79c3d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7535, "upload_time": "2017-05-11T13:54:53", "url": "https://files.pythonhosted.org/packages/7f/0e/2d453296810270564bbafb6603d4cca2598f02fa9fb49c3177ba7ea40da0/sphinx_autodoc_napoleon_typehints-2.1.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "12182b1c73e9538b003931a9f55a99c7", "sha256": "67e36dc22d03362ab95c41d33b3a86fd8a7561a73648df112cdb57f989e1dae9" }, "downloads": -1, "filename": "sphinx-autodoc-napoleon-typehints-2.1.6.tar.gz", "has_sig": false, "md5_digest": "12182b1c73e9538b003931a9f55a99c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13109, "upload_time": "2017-05-11T13:54:55", "url": "https://files.pythonhosted.org/packages/05/0b/8ccc320b7fdfbb8e57cafefb5d7fb45db383f651dca2eb1fd74b8f3d6f1a/sphinx-autodoc-napoleon-typehints-2.1.6.tar.gz" } ] }