{ "info": { "author": "Patrick Kidger", "author_email": "contact@kidger.site", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Sphinx", "Framework :: Sphinx :: Extension", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: End Users/Desktop", "Intended Audience :: Science/Research", "Intended Audience :: System Administrators", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3 :: Only", "Topic :: Documentation", "Topic :: Documentation :: Sphinx", "Topic :: Internet :: WWW/HTTP :: Site Management", "Topic :: Software Development :: Documentation" ], "description": "***********\npy2annotate\n***********\nAn extension to Sphinx :code:`autodoc` to augment Sphinx documentation with type annotations, when using Python 2 style type annotations.\n\nThe Problem\n===========\nPython 2 doesn't support type annotations. Thus writing Python 2 / Python 3 agnostic code with type annotations requires `putting the type annotations in comments `__:\n\n.. code-block:: python\n\n def add(x, y):\n # type: (int, int) -> int\n \"\"\"Adds two numbers.\"\"\"\n return x + y\n\nBut now when documentation is generated with `Sphinx `__, the documentation doesn't include type annotations:\n\n.. image:: https://raw.githubusercontent.com/patrick-kidger/py2annotate/master/imgs/without-annotations.png\n :align: center\n\n\n*Example from the* |signatory|_ *project.*\n\n.. _signatory: https://github.com/patrick-kidger/signatory\n.. |signatory| replace:: *Signatory*\n\nThe Solution\n============\n\nThis extension remedies things so that the Sphinx documentation now looks like:\n\n.. image:: https://raw.githubusercontent.com/patrick-kidger/py2annotate/master/imgs/with-annotations.png\n :align: center\n\n.. role:: python(code)\n :language: python\n\n(which is the same as what you'd get using Python 3 style type annotations e.g. :python:`def add(x: int, y: int) -> int`)\n\nInstallation\n============\nVia pip:\n\n.. code-block:: bash\n\n pip install py2annotate\n\nIt's also just a single file, so copy-paste the code if you want.\n\nRequires Python 3.6+.\n\nUsage\n=====\nJust add py2annotate to the list of extensions in :code:`conf.py`:\n\n.. code-block:: python\n\n # conf.py\n ...\n extensions = ['sphinx.ext.autodoc', 'py2annotate']\n ...\n\n(It shouldn't matter whether it comes before or after :code:`autodoc`.)\n\nNote that Sphinx itself must be run using Python 3.6+. This is because py2annotate uses the Python 3 style type\nannotations internally in order to determine the correct annotations.\n\nKnown Issues\n============\nNone so far! File a report if you run into anything. `mypy `__ and `stubgen `__ are used internally though, so your code's formatting must be in a manner that they understand.\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/patrick-kidger/py2annotate", "keywords": "signature", "license": "Apache-2.0", "maintainer": "Patrick Kidger", "maintainer_email": "contact@kidger.site", "name": "py2annotate", "package_url": "https://pypi.org/project/py2annotate/", "platform": "", "project_url": "https://pypi.org/project/py2annotate/", "project_urls": { "Homepage": "https://github.com/patrick-kidger/py2annotate" }, "release_url": "https://pypi.org/project/py2annotate/1.1.1/", "requires_dist": [ "sphinx", "mypy" ], "requires_python": ">=3.6", "summary": "An extension to Sphinx :code:`autodoc` to augment Sphinx documentation with type annotations, when using Python 2 style type annotations.", "version": "1.1.1" }, "last_serial": 5814108, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "9177f1ff5fdaa2fce185f426d917b4c0", "sha256": "e91d378049af36d69c80603c7c3d2076f37f7992519567acfc411b9aae30a290" }, "downloads": -1, "filename": "py2annotate-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9177f1ff5fdaa2fce185f426d917b4c0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.0", "size": 4036, "upload_time": "2019-06-18T00:08:13", "url": "https://files.pythonhosted.org/packages/cf/a1/4fde9274204fee316485c6531d2eb0d453701a81435cc51d81157cb11602/py2annotate-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e1af5e9db7ce18c2040b40ea3a318fdc", "sha256": "06afad4d4d62bbb8746bbbf8432398fcd1c18baa77b72c81a23eeaf4699c5213" }, "downloads": -1, "filename": "py2annotate-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e1af5e9db7ce18c2040b40ea3a318fdc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.0", "size": 4182, "upload_time": "2019-06-18T00:08:15", "url": "https://files.pythonhosted.org/packages/57/a3/c0b798c3972b82b5ea4cad1c089cfb033de622cf18a4e30d099737004ddb/py2annotate-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "37a228e5f34272bde6b5b940b8a2bad5", "sha256": "c2d522847070229ed11ce53ac2568cdaf3b1fb440eb677ca5dcbefdeb7c622a0" }, "downloads": -1, "filename": "py2annotate-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "37a228e5f34272bde6b5b940b8a2bad5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.0", "size": 4124, "upload_time": "2019-06-18T00:12:13", "url": "https://files.pythonhosted.org/packages/4f/07/7b0a89f1ec72b6f2711ce571cfe3869a2239e6079909afa97ae4654d473e/py2annotate-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cdff481acb75c325677045b68583b7f2", "sha256": "97da72770b4ace6adb4cb550f7d97992ac9a72572bf2971e44a75017aa7da204" }, "downloads": -1, "filename": "py2annotate-1.0.1.tar.gz", "has_sig": false, "md5_digest": "cdff481acb75c325677045b68583b7f2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.0", "size": 4268, "upload_time": "2019-06-18T00:12:15", "url": "https://files.pythonhosted.org/packages/c7/00/7af263aec2e52111174f184db6c046fa003904acfbf4cc06caf1ec807022/py2annotate-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "6b16f49be298bceb1ec042359a6fafdc", "sha256": "558e095dc0b44bb73c6b7c1f8d0ff9bbc8cfbdb6114c141546e7264ce0b0b8f7" }, "downloads": -1, "filename": "py2annotate-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6b16f49be298bceb1ec042359a6fafdc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.0", "size": 4124, "upload_time": "2019-06-18T00:18:29", "url": "https://files.pythonhosted.org/packages/5d/40/46912e716daf7167cd6d73bb2ddc1b3edaa7f9ce28023d4859c608d2cb4e/py2annotate-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "578fd3f11217862d77094b3695b108f3", "sha256": "50f2bbae13d5740b9d81a33aabafd1e43494df1627112149af4b82c7bfcb39b5" }, "downloads": -1, "filename": "py2annotate-1.0.2.tar.gz", "has_sig": false, "md5_digest": "578fd3f11217862d77094b3695b108f3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.0", "size": 4269, "upload_time": "2019-06-18T00:18:30", "url": "https://files.pythonhosted.org/packages/2f/5e/89ead7c52fcec5a676d5653b94796b003b9480f0824140118027bab8e0d5/py2annotate-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "66a3c230f9bdd890d9af7f2e6e0078a1", "sha256": "e87e32a87ec7b292950d0a670ab88664c0dd296b2c070568dbbf24bd6f0890b6" }, "downloads": -1, "filename": "py2annotate-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "66a3c230f9bdd890d9af7f2e6e0078a1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 8589, "upload_time": "2019-06-18T12:24:55", "url": "https://files.pythonhosted.org/packages/36/d3/afeff6feb828c077bee041c55f2f6bdf593d8f65d264a511065978378488/py2annotate-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "89ab19fd00aee5c5a62459b27b9229c9", "sha256": "5f8de5604f874a06769e7e37bc203f5a50161bb34856fca453557fd5d3b47766" }, "downloads": -1, "filename": "py2annotate-1.1.0.tar.gz", "has_sig": false, "md5_digest": "89ab19fd00aee5c5a62459b27b9229c9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4765, "upload_time": "2019-06-18T12:24:57", "url": "https://files.pythonhosted.org/packages/31/a8/82f0fb55f32d9f16e63d24165c77e0007a7c479ef7e0d6c3dedf2fb59cce/py2annotate-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "e37d722920059c1e20d6cfcfc6bc641b", "sha256": "d8762e5fb655e7e14332869d09113ef62c22930755989c91ad827334b1314dc4" }, "downloads": -1, "filename": "py2annotate-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e37d722920059c1e20d6cfcfc6bc641b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 4524, "upload_time": "2019-09-11T10:11:51", "url": "https://files.pythonhosted.org/packages/12/51/0b3f5d6859bbe9011d2922a2273445d52fd2722cbc3886d5d61a79716554/py2annotate-1.1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e37d722920059c1e20d6cfcfc6bc641b", "sha256": "d8762e5fb655e7e14332869d09113ef62c22930755989c91ad827334b1314dc4" }, "downloads": -1, "filename": "py2annotate-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e37d722920059c1e20d6cfcfc6bc641b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 4524, "upload_time": "2019-09-11T10:11:51", "url": "https://files.pythonhosted.org/packages/12/51/0b3f5d6859bbe9011d2922a2273445d52fd2722cbc3886d5d61a79716554/py2annotate-1.1.1-py3-none-any.whl" } ] }