{ "info": { "author": "Chad Dombrova", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Build Tools" ], "description": "\n=======\nDoc 484\n=======\n\n.. image:: https://travis-ci.org/chadrik/doc484.svg?branch=master\n :target: https://travis-ci.org/chadrik/doc484\n :alt: CI Status\n\nGenerate PEP 484 type annotations from docstrings\n=================================================\n\n``doc484`` provides a script to find type declarations within your docstrings and convert them to PEP 484 type comments. It supports the three major docstring conventions `numpy `_, `google `_, and `restructuredText (sphinx) `_\n\nRegardless of docstring convention you choose, the types declared within your docstrings should following the guidelines in `PEP 484 `_, especially use of the `typing `_ module, where necessary.\n\nWhy Use This?\n=============\n\nIf you answer affirmative to at least 2 of these, this project is probably for you:\n\n- You're stuck supporting python 2.7, so you have to use type comments, instead of the type annotations supported in 3.5+\n- Your projects have existing docstrings with types that are already mostly correct\n- You find it easier to maintain and comprehend types specified alongside the description of an argument\n\nExamples\n========\n\nBasic\n~~~~~\n\nBefore\n------\n\n.. code:: python\n\n from typing import Optional\n\n def maxlines(input, numlines=None):\n \"\"\"\n Trim a string to a maximum number of lines.\n\n Parameters\n ----------\n input : str\n numlines : Optional[int]\n maximum number of lines\n\n Returns\n -------\n str\n \"\"\"\n if numlines is None:\n return input\n return '\\n'.join(input.split('\\n')[:numlines])\n\n\nAfter ``doc484``\n----------------\n\n.. code:: python\n\n from typing import Optional\n\n def maxlines(input, numlines=None):\n # type: (str, Optional[int]) -> str\n \"\"\"\n Trim a string to a maximum number of lines.\n\n Parameters\n ----------\n input : str\n numlines : Optional[int]\n maximum number of lines\n\n Returns\n -------\n str\n \"\"\"\n if numlines is None:\n return input\n return '\\n'.join(input.split('\\n')[:numlines])\n\n\nThe file is now properly inspectable by mypy or PyCharm.\n\nAdvanced\n~~~~~~~~\n\nA more complex example demonstrates some of the added readability that comes from specifying types within your docstrings.\nBelow we use numpy format to document a generator of tuples:\n\nBefore\n------\n\n.. code:: python\n\n from typing import *\n\n def itercount(input, char):\n \"\"\"\n Iterate over input strings and yield a tuple of the string with `char`\n removed, and the number of occurrences of `char`.\n\n Parameters\n ----------\n input : Iterable[str]\n char : str\n character to remove and count\n\n Yields\n ------\n stripped : str\n input string with all occurrences of `char` removed\n count : int\n number of occurrences of `char`\n \"\"\"\n for x in input:\n yield x.strip(char), x.count(char)\n\n\nAfter ``doc484``\n----------------\n\n.. code:: python\n\n from typing import *\n\n def itercount(input, char):\n # type: (Iterable[str], str) -> Iterator[Tuple[str, int]]\n \"\"\"\n Iterate over input strings and yield a tuple of the string with `char`\n removed, and the number of occurrences of `char`.\n\n Parameters\n ----------\n input : Iterable[str]\n char : str\n character to remove and count\n\n Yields\n ------\n stripped : str\n input string with all occurrences of `char` removed\n count : int\n number of occurrences of `char`\n \"\"\"\n for x in input:\n yield x.strip(char), x.count(char)\n\nInstalling\n==========\n\n.. code::\n\n pip install doc484\n\n\nUsage\n=====\n\n.. code::\n\n doc484 -h\n\nBy default ``doc484`` will *not* modify files, instead it will print out a diff of what would be modified. When you're ready to make changes, add the ``--write`` flag.\n\nCheck the scripts directory for an example of how to automatically run ``doc484`` on modified files in your git or mercurial repository.\n\n\nConfiguration\n=============\n\nYou can override any of the command line options using an ini-style configuration file.\nBy default, ``doc484`` looks for a setup.cfg file in the current working directory, but you can also provide a config explicitly using the ``--config`` option.\n\nFor example, to override the number of processes to use when converting, and specify the docstring format for the project, add this to your setup.cfg and run ``doc484`` from the directory where this config file resides:\n\n.. code:: ini\n\n [doc484]\n processes = 12\n format = numpy\n\nTODO\n====\n\n- automatically insert ``typing`` imports\n- add option to convert docstrings to function annotations (for python 3.5+)\n- finish support for fixing non-PEP484-compliant docstrings (e.g. ``list of str``)\n- convert ``doctypes`` utility script to python?\n\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/chadrik/doc484", "keywords": "mypy,typing,pep484,docstrings,annotations", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "doc484", "package_url": "https://pypi.org/project/doc484/", "platform": "", "project_url": "https://pypi.org/project/doc484/", "project_urls": { "Homepage": "https://github.com/chadrik/doc484" }, "release_url": "https://pypi.org/project/doc484/0.3.5/", "requires_dist": [ "docutils", "coverage ; extra == 'tests'", "pytest (==3.6.2) ; extra == 'tests'", "tox (==2.7.0) ; extra == 'tests'" ], "requires_python": "", "summary": "Generate PEP 484 type comments from docstrings", "version": "0.3.5" }, "last_serial": 5382912, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "95cd68326250c7d7520d60f805161747", "sha256": "4f0a34bba737c19d2054defd79b3d41adcfd37b594ebc3c67dc61bd8799261a5" }, "downloads": -1, "filename": "doc484-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "95cd68326250c7d7520d60f805161747", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 31888, "upload_time": "2018-08-03T18:49:51", "url": "https://files.pythonhosted.org/packages/df/40/a09b09b06ccb947511089b9f21dee83b88abf48232e400d9f83947e648da/doc484-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f67cf976787b9f7b86532971552499c9", "sha256": "5bd23987ccfb15878b2b93e36606fc87bec108073c49242c30e38004a34d2a5a" }, "downloads": -1, "filename": "doc484-0.2.0.tar.gz", "has_sig": false, "md5_digest": "f67cf976787b9f7b86532971552499c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19986, "upload_time": "2018-08-03T18:49:52", "url": "https://files.pythonhosted.org/packages/40/84/f0360864ace7e53e3966cb73fc2d4f415736d16b569e2ff1114c808ff7bb/doc484-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "1a29cafe48ca27aa2146fbbc4732d524", "sha256": "c25decd6f60899801f6a7b88ed3f59115549985c32f824f560f8d48a40f2bf80" }, "downloads": -1, "filename": "doc484-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1a29cafe48ca27aa2146fbbc4732d524", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20484, "upload_time": "2018-11-13T20:44:55", "url": "https://files.pythonhosted.org/packages/16/06/3bd73d2abc8802aab0c7f129ab283a6a4c9c1ba9d273aeda15035b1893c6/doc484-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c1a11157ae61dedc64b46ce860e1cac9", "sha256": "727ba72ba4bd8fe5a2c502d5d0931a510fcafcd2423d130ac9bd13cab425202b" }, "downloads": -1, "filename": "doc484-0.3.0.tar.gz", "has_sig": false, "md5_digest": "c1a11157ae61dedc64b46ce860e1cac9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19896, "upload_time": "2018-11-13T20:44:56", "url": "https://files.pythonhosted.org/packages/38/7c/3b24681c000fee7eb6fe1d2cc0e8cb268a09db7027f790186345411ecdae/doc484-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "13e8e1bd1f848f46b47fef32bea50233", "sha256": "34bd806f92bcf29ee0b7018e5ae70f09f666545257cf29125e4d46d15750dbb4" }, "downloads": -1, "filename": "doc484-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "13e8e1bd1f848f46b47fef32bea50233", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20486, "upload_time": "2018-12-08T00:51:17", "url": "https://files.pythonhosted.org/packages/f1/f0/c676ca42fbadf68ef6e8dedbe622eb4c0472a63d621c636c4f86fec7ca5c/doc484-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "707dff74e84f9e5435f0fb02d8059479", "sha256": "4a0227e9646d0d6efb4a3c9389c678a3a4138daa6ebbf8a8025897c1104d72d4" }, "downloads": -1, "filename": "doc484-0.3.1.tar.gz", "has_sig": false, "md5_digest": "707dff74e84f9e5435f0fb02d8059479", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19895, "upload_time": "2018-12-08T00:51:18", "url": "https://files.pythonhosted.org/packages/73/ae/7aa47cc5d2f1ede82bc0892e166bdf8e453738f438006f498c14a507bbec/doc484-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "9167f95c31b7f84915d28b2abbb3f9aa", "sha256": "0ba232b75a13f71fb30b6dcb0df5482b36817403ac872ed0d76cbbb3a39aac99" }, "downloads": -1, "filename": "doc484-0.3.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9167f95c31b7f84915d28b2abbb3f9aa", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20527, "upload_time": "2019-01-17T19:04:23", "url": "https://files.pythonhosted.org/packages/0c/22/9848657bebff298e2b82eb86532dd65972c901bfddde7e31fcbecd639b9d/doc484-0.3.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2a72f8e4722f8b4dd6cf3c38100054f6", "sha256": "9f8f3c8f6711d3a706dd96101fad011b051a8e514d635a2b237b05d9ff32d778" }, "downloads": -1, "filename": "doc484-0.3.2.tar.gz", "has_sig": false, "md5_digest": "2a72f8e4722f8b4dd6cf3c38100054f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19926, "upload_time": "2019-01-17T19:04:25", "url": "https://files.pythonhosted.org/packages/43/60/221fcf22e5feb49183cb0549f85050fb9dee1ef7955fd0b8c51ad2611ada/doc484-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "8a0601259a146f33a3f5c3a6b711aa2d", "sha256": "503115a135880ad983d151409729d7bc0381ba8f83458108f022751f2fff1234" }, "downloads": -1, "filename": "doc484-0.3.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8a0601259a146f33a3f5c3a6b711aa2d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20536, "upload_time": "2019-01-17T19:21:22", "url": "https://files.pythonhosted.org/packages/9b/2b/8d302062f660eeb036c41497480d63ca5e7dcf203a3b0fa85bc439970676/doc484-0.3.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8222ab8a0cd7bb1a736876e35f6aec19", "sha256": "32cc8508ecc78f7ae825aa47ddcc557cf565e290058390955e84cb635320eece" }, "downloads": -1, "filename": "doc484-0.3.3.tar.gz", "has_sig": false, "md5_digest": "8222ab8a0cd7bb1a736876e35f6aec19", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19928, "upload_time": "2019-01-17T19:21:24", "url": "https://files.pythonhosted.org/packages/da/42/ca8c885e3b3a694e411c0cb8154c93b05cc76ac4a673c7d283d0dab45408/doc484-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "b9f42724a516f6c26a443821c0db613e", "sha256": "174eccb447dba711c6354c8bb35c8ce7855dd61529c15cacaa6ad329062e449c" }, "downloads": -1, "filename": "doc484-0.3.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b9f42724a516f6c26a443821c0db613e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 21274, "upload_time": "2019-04-24T03:41:45", "url": "https://files.pythonhosted.org/packages/6b/de/81b4785608907227799177f73afa200aec910dffc2da1ffd1cee32793876/doc484-0.3.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5af0d35a1ef2542b83f32862e266c0ce", "sha256": "043ff44841f0ec79300047f1128ea8defa86beb07719dbbb4efeda662f9d9ca0" }, "downloads": -1, "filename": "doc484-0.3.4.tar.gz", "has_sig": false, "md5_digest": "5af0d35a1ef2542b83f32862e266c0ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19853, "upload_time": "2019-04-24T03:41:47", "url": "https://files.pythonhosted.org/packages/86/c6/4f0976c77d4ce6f9b9282875352084e689d21696f3e4489be2d274885bbf/doc484-0.3.4.tar.gz" } ], "0.3.5": [ { "comment_text": "", "digests": { "md5": "a6b251e93da0150ac20305cf072e6daf", "sha256": "e3c8fe4cfbe2dc5c643525268593536187d22308f95cc70cc7786c7a4fa7361a" }, "downloads": -1, "filename": "doc484-0.3.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a6b251e93da0150ac20305cf072e6daf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 21287, "upload_time": "2019-06-10T18:25:08", "url": "https://files.pythonhosted.org/packages/55/56/8cd949918eeeff2b839a07a5eb92c5769195b44b128d8da4622bb4a590c0/doc484-0.3.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1b87075283bf46e6b9ddafd89f5bdc71", "sha256": "4146c512215846c956c3214a45a79d6e51e6ad4e5ac05857f0f32af51b86cba9" }, "downloads": -1, "filename": "doc484-0.3.5.tar.gz", "has_sig": false, "md5_digest": "1b87075283bf46e6b9ddafd89f5bdc71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19841, "upload_time": "2019-06-10T18:25:10", "url": "https://files.pythonhosted.org/packages/92/60/b6028b34b9f2911ef81580ed87c8c5f74e2beb20ea2245ff991bf7c20fde/doc484-0.3.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a6b251e93da0150ac20305cf072e6daf", "sha256": "e3c8fe4cfbe2dc5c643525268593536187d22308f95cc70cc7786c7a4fa7361a" }, "downloads": -1, "filename": "doc484-0.3.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a6b251e93da0150ac20305cf072e6daf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 21287, "upload_time": "2019-06-10T18:25:08", "url": "https://files.pythonhosted.org/packages/55/56/8cd949918eeeff2b839a07a5eb92c5769195b44b128d8da4622bb4a590c0/doc484-0.3.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1b87075283bf46e6b9ddafd89f5bdc71", "sha256": "4146c512215846c956c3214a45a79d6e51e6ad4e5ac05857f0f32af51b86cba9" }, "downloads": -1, "filename": "doc484-0.3.5.tar.gz", "has_sig": false, "md5_digest": "1b87075283bf46e6b9ddafd89f5bdc71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19841, "upload_time": "2019-06-10T18:25:10", "url": "https://files.pythonhosted.org/packages/92/60/b6028b34b9f2911ef81580ed87c8c5f74e2beb20ea2245ff991bf7c20fde/doc484-0.3.5.tar.gz" } ] }