crescent-ext-docstrings


Namecrescent-ext-docstrings JSON
Version 0.2.2 PyPI version JSON
download
home_page
SummaryA docstring parser for hikari-crescent.
upload_time2023-10-11 18:54:35
maintainer
docs_urlNone
authorLunarmagpie
requires_python>=3.8,<3.12
licenseMPL-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # crescent-ext-docstrings

A docstring parser for [hikari-crescent](https://github.com/magpie-dev/hikari-crescent).

## Installation
```
pip install crescent-ext-docstrings
```

## Usage

This extension works for both class commands and function commands.

```python
import crescent
from crescent.ext import docstrings

bot = crescent.Bot("...")

@bot.include
@docstrings.parse_doc
@crescent.command
async def example(ctx: crescent.Context, a: str, b: str) -> None:
    """
    This is the command's description.
    
    :param a:
        This is the first param's description.
    :param b:
        This is the first param's description.
    """
    await ctx.respond(f"{a=},{b=}")

@bot.include
@docstrings.parse_doc
@crescent.command(name="class_example")
class ClassExample:
    """
    Other doc styles are supported. This is google doc style.
    
    Args:
        a: This is the first param's description.
        b: This is the first param's description.
    """

    a = crescent.option(str)
    b = crescent.option(str)

    async def callback(self, ctx: crescent.Context) -> None:
        await ctx.respond(f"{self.a=},{self.b=}")

bot.run()

```

### Doc Styles
Since this library relies on [docstring-parser](https://github.com/rr-/docstring_parser), the styles Rest, Google, Numpy, and Epydoc are supported. If no style is specified, the style will be inferred.

```python
import docstrings

@bot.include
@docstrings.parse_doc(style=docstrings.Style.REST)
@crescent.command
async def example(ctx: crescent.Command, a: str) -> None:
    """
    Rest style description.

    :param a:
        The parameter.
    """
    ...

```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "crescent-ext-docstrings",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.12",
    "maintainer_email": "",
    "keywords": "",
    "author": "Lunarmagpie",
    "author_email": "Bambolambo0@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/43/79/fcb552fd599043b979ece8b8f1573bcc99493be4dc75d14a6254237f5517/crescent_ext_docstrings-0.2.2.tar.gz",
    "platform": null,
    "description": "# crescent-ext-docstrings\n\nA docstring parser for [hikari-crescent](https://github.com/magpie-dev/hikari-crescent).\n\n## Installation\n```\npip install crescent-ext-docstrings\n```\n\n## Usage\n\nThis extension works for both class commands and function commands.\n\n```python\nimport crescent\nfrom crescent.ext import docstrings\n\nbot = crescent.Bot(\"...\")\n\n@bot.include\n@docstrings.parse_doc\n@crescent.command\nasync def example(ctx: crescent.Context, a: str, b: str) -> None:\n    \"\"\"\n    This is the command's description.\n    \n    :param a:\n        This is the first param's description.\n    :param b:\n        This is the first param's description.\n    \"\"\"\n    await ctx.respond(f\"{a=},{b=}\")\n\n@bot.include\n@docstrings.parse_doc\n@crescent.command(name=\"class_example\")\nclass ClassExample:\n    \"\"\"\n    Other doc styles are supported. This is google doc style.\n    \n    Args:\n        a: This is the first param's description.\n        b: This is the first param's description.\n    \"\"\"\n\n    a = crescent.option(str)\n    b = crescent.option(str)\n\n    async def callback(self, ctx: crescent.Context) -> None:\n        await ctx.respond(f\"{self.a=},{self.b=}\")\n\nbot.run()\n\n```\n\n### Doc Styles\nSince this library relies on [docstring-parser](https://github.com/rr-/docstring_parser), the styles Rest, Google, Numpy, and Epydoc are supported. If no style is specified, the style will be inferred.\n\n```python\nimport docstrings\n\n@bot.include\n@docstrings.parse_doc(style=docstrings.Style.REST)\n@crescent.command\nasync def example(ctx: crescent.Command, a: str) -> None:\n    \"\"\"\n    Rest style description.\n\n    :param a:\n        The parameter.\n    \"\"\"\n    ...\n\n```\n",
    "bugtrack_url": null,
    "license": "MPL-2.0",
    "summary": "A docstring parser for hikari-crescent.",
    "version": "0.2.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "567226f971201764c5c482fef1e78189b0e65547b7366b601c2c8921420cc76d",
                "md5": "7c1443d3b31e03cc0e5d1908d3aa5e1a",
                "sha256": "8dd79873a392727c973a708eaca51b6883321dcc9b09c26b799e4ff2c30dc218"
            },
            "downloads": -1,
            "filename": "crescent_ext_docstrings-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7c1443d3b31e03cc0e5d1908d3aa5e1a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.12",
            "size": 3342,
            "upload_time": "2023-10-11T18:54:34",
            "upload_time_iso_8601": "2023-10-11T18:54:34.426522Z",
            "url": "https://files.pythonhosted.org/packages/56/72/26f971201764c5c482fef1e78189b0e65547b7366b601c2c8921420cc76d/crescent_ext_docstrings-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4379fcb552fd599043b979ece8b8f1573bcc99493be4dc75d14a6254237f5517",
                "md5": "8390b883696230d7e2911b6c19b8dc11",
                "sha256": "76ba0723fd89d3abd3d4205d364db21858080aee687a504476fe35c3cbf8ca4b"
            },
            "downloads": -1,
            "filename": "crescent_ext_docstrings-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8390b883696230d7e2911b6c19b8dc11",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.12",
            "size": 2396,
            "upload_time": "2023-10-11T18:54:35",
            "upload_time_iso_8601": "2023-10-11T18:54:35.376291Z",
            "url": "https://files.pythonhosted.org/packages/43/79/fcb552fd599043b979ece8b8f1573bcc99493be4dc75d14a6254237f5517/crescent_ext_docstrings-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-11 18:54:35",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "crescent-ext-docstrings"
}
        
Elapsed time: 0.16047s