{"id":25187233,"url":"https://github.com/v2dha/alphadoc","last_synced_at":"2025-05-07T14:30:07.240Z","repository":{"id":54878759,"uuid":"314046283","full_name":"V2dha/alphadoc","owner":"V2dha","description":"Automatic docstring generator that supports and generates a number of specified and widely used docstring style conventions for documentation in Python.","archived":false,"fork":false,"pushed_at":"2021-04-15T09:49:07.000Z","size":5187,"stargazers_count":6,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T11:01:36.838Z","etag":null,"topics":["docstring-generator","docstrings-formats","documentation-generator"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/alphadoc/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/V2dha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-18T20:10:23.000Z","updated_at":"2024-06-05T08:32:49.000Z","dependencies_parsed_at":"2022-08-14T05:31:00.533Z","dependency_job_id":null,"html_url":"https://github.com/V2dha/alphadoc","commit_stats":null,"previous_names":["mlh-fellowship/alphadoc"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/V2dha%2Falphadoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/V2dha%2Falphadoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/V2dha%2Falphadoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/V2dha%2Falphadoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/V2dha","download_url":"https://codeload.github.com/V2dha/alphadoc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252895387,"owners_count":21821150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docstring-generator","docstrings-formats","documentation-generator"],"created_at":"2025-02-09T19:45:30.669Z","updated_at":"2025-05-07T14:30:07.154Z","avatar_url":"https://github.com/V2dha.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alphadoc\n\n[![PyPI version](https://img.shields.io/pypi/v/alphadoc.svg?color=green\u0026style=for-the-badge)](https://pypi.org/project/pdoc3)\n![ISSUES](https://img.shields.io/github/issues-closed/V2dha/alphadoc?color=blue\u0026style=for-the-badge)\n![PULL REQUESTS](https://img.shields.io/github/issues-pr-closed/V2dha/alphadoc?color=orange\u0026style=for-the-badge)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/alphadoc?style=for-the-badge)\n    \nAutomatic docstring generator and style guide that supports a number of specified conventions for documentation in Python.\n\nFeatures\n--------\n* Auto-generates docstrings with a customizable template for functions.\n* Support for common and widely used docstrings formats such as Numpy, Google, ReStructured Text and Epytext (Javadoc)\n\nInstallation\n------------\nUsing pip:\n\n    $ pip install alphadoc\n\nDemo\n-----\n\u003cimg src=\"demo/demo.gif\"\u003e\n\nUsage\n-----\nalphadoc takes your filename and format type as arguments\n\n    $ alphadoc \u003cfilename\u003e -d \u003cdoc_format\u003e\n\nSee `alphadoc --help` for more command-line switches and options!\n\nOptions :\n```\nUsage: alphadoc [OPTIONS] FILENAME\n\n  Automatic docstring generator and style guide that  supports a\n  number of specified conventions for formatting  as well as\n  documentation in Python.\n\nOptions:\n  -d, --doc_format TEXT  Specified format for docstrings from Options-\n                         ReST : For ReStructured Text (default); Epytext\n                         :  For Epytext (Javadoc); Google : For Google-\n                         Style ; Numpydoc : For Numpydoc\n\n  --help                 Show this message and exit.\n```\nExample :\n\nBefore alphadoc\n```python\nimport ast\nimport sys\n\ndef top_level_functions(body):\n    return (f for f in body if isinstance(f, ast.FunctionDef))\n\ndef parse_ast(filename):\n    with open(filename, \"rt\") as file:\n        return ast.parse(file.read(), filename=filename)\n\ndef get_func(filename):\n    tree = parse_ast(filename)\n    func_list = []\n    for func in top_level_functions(tree.body):\n        func_list.append(func.name)\n    return func_list\n```\nAfter alphadoc \n\nDocstring format:\n\n* **ReStructured Text** (default) \n```python\nimport ast\nimport sys\n\ndef top_level_functions(body):\n    \"\"\"\n        This is reST style.\n\n        :param param1: this is a first param\n        :param param2: this is a second param\n        :returns: this is a description of what is returned\n        :raises keyError: raises an exception\n    \"\"\"\n    return (f for f in body if isinstance(f, ast.FunctionDef))\n\ndef parse_ast(filename):\n    \"\"\"\n        This is reST style.\n\n        :param param1: this is a first param\n        :param param2: this is a second param\n        :returns: this is a description of what is returned\n        :raises keyError: raises an exception\n    \"\"\"\n    with open(filename, \"rt\") as file:\n        return ast.parse(file.read(), filename=filename)\n\ndef get_func(filename):\n    \"\"\"\n        This is reST style.\n\n        :param param1: this is a first param\n        :param param2: this is a second param\n        :returns: this is a description of what is returned\n        :raises keyError: raises an exception\n    \"\"\"\n    tree = parse_ast(filename)\n    func_list = []\n    for func in top_level_functions(tree.body):\n        func_list.append(func.name)\n    return func_list\n```\n* **Epytext (Javadoc)** \n```python\nimport ast\nimport sys\n\ndef top_level_functions(body):\n    \"\"\"\n        This is javadoc style.\n\n        @param param1: this is a first param\n        @param param2: this is a second param\n        @return: this is a description of what is returned\n        @raise keyError: raises an exception\n    \"\"\"\n    return (f for f in body if isinstance(f, ast.FunctionDef))\n\ndef parse_ast(filename):\n    \"\"\"\n        This is javadoc style.\n\n        @param param1: this is a first param\n        @param param2: this is a second param\n        @return: this is a description of what is returned\n        @raise keyError: raises an exception\n    \"\"\"\n    with open(filename, \"rt\") as file:\n        return ast.parse(file.read(), filename=filename)\n\ndef get_func(filename):\n    \"\"\"\n        This is javadoc style.\n\n        @param param1: this is a first param\n        @param param2: this is a second param\n        @return: this is a description of what is returned\n        @raise keyError: raises an exception\n    \"\"\"\n    tree = parse_ast(filename)\n    func_list = []\n    for func in top_level_functions(tree.body):\n        func_list.append(func.name)\n    return func_list\n```\n* **Google** \n```python\nimport ast\nimport sys\n\ndef top_level_functions(body):\n    \"\"\"\n            This is an example of Google style.\n            \n            Args:\n            param1: This is the first param.\n            param2: This is a second param.\n\n            Returns:\n            This is a description of what is returned.\n\n            Raises:\n            KeyError: Raises an exception.\n    \"\"\"\n    return (f for f in body if isinstance(f, ast.FunctionDef))\n\ndef parse_ast(filename):\n    \"\"\"\n            This is an example of Google style.\n            \n            Args:\n            param1: This is the first param.\n            param2: This is a second param.\n\n            Returns:\n            This is a description of what is returned.\n\n            Raises:\n            KeyError: Raises an exception.\n    \"\"\"\n    with open(filename, \"rt\") as file:\n        return ast.parse(file.read(), filename=filename)\n\ndef get_func(filename):\n    \"\"\"\n            This is an example of Google style.\n            \n            Args:\n            param1: This is the first param.\n            param2: This is a second param.\n\n            Returns:\n            This is a description of what is returned.\n\n            Raises:\n            KeyError: Raises an exception.\n    \"\"\"\n    tree = parse_ast(filename)\n    func_list = []\n    for func in top_level_functions(tree.body):\n        func_list.append(func.name)\n    return func_list\n```\n* **Numpydoc** \n```python\nimport ast\nimport sys\n\ndef top_level_functions(body):\n    \"\"\"\n        Numpydoc description of a kind\n        of very exhautive numpydoc format docstring.\n\n        Parameters\n        ----------\n        first : array_like\n            the 1st param name `first`\n        second :\n            the 2nd param\n        third : {'value', 'other'}, optional\n            the 3rd param, by default 'value'\n\n        Returns\n        -------\n        string\n            a value in a string\n\n        Raises\n        ------\n        KeyError\n            when a key error\n        OtherError\n            when an other error\n    \"\"\"\n    return (f for f in body if isinstance(f, ast.FunctionDef))\n\ndef parse_ast(filename):\n    \"\"\"\n        Numpydoc description of a kind\n        of very exhautive numpydoc format docstring.\n\n        Parameters\n        ----------\n        first : array_like\n            the 1st param name `first`\n        second :\n            the 2nd param\n        third : {'value', 'other'}, optional\n            the 3rd param, by default 'value'\n\n        Returns\n        -------\n        string\n            a value in a string\n\n        Raises\n        ------\n        KeyError\n            when a key error\n        OtherError\n            when an other error\n    \"\"\"\n    with open(filename, \"rt\") as file:\n        return ast.parse(file.read(), filename=filename)\n\ndef get_func(filename):\n    \"\"\"\n        Numpydoc description of a kind\n        of very exhautive numpydoc format docstring.\n\n        Parameters\n        ----------\n        first : array_like\n            the 1st param name `first`\n        second :\n            the 2nd param\n        third : {'value', 'other'}, optional\n            the 3rd param, by default 'value'\n\n        Returns\n        -------\n        string\n            a value in a string\n\n        Raises\n        ------\n        KeyError\n            when a key error\n        OtherError\n            when an other error\n    \"\"\"\n    tree = parse_ast(filename)\n    func_list = []\n    for func in top_level_functions(tree.body):\n        func_list.append(func.name)\n    return func_list\n```\n\nReferences\n-----------\nhttp://daouzli.com/blog/docstring.html\n\n\nContributing\n-----------\nalphadoc is fully Open-Source and open for contributions! We request you to respect our contribution guidelines as defined in our [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) and [CONTRIBUTING.md](CONTRIBUTING.md)\n\n## Contributors \n\n\u003ca href=\"https://github.com/MLH-Fellowship/alphadoc/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=MLH-Fellowship/alphadoc\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv2dha%2Falphadoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv2dha%2Falphadoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv2dha%2Falphadoc/lists"}