Skip to main content

crescent-ext-docstrings

A docstring parser for hikari-crescent.

Installation

pip install crescent-ext-docstrings

Usage

This extension works for both class commands and function commands.

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, the styles Rest, Google, Numpy, and Epydoc are supported. If no style is specified, the style will be inferred.

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.
    """
    ...

Metadata

Release files for crescent-ext-docstrings 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crescent-ext-docstrings 0.2.2
File Size Uploaded
crescent_ext_docstrings-0.2.2.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crescent-ext-docstrings 0.2.2
File Interpreter ABI Platform
crescent_ext_docstrings-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 5.7 kB

Release files / crescent_ext_docstrings-0.2.2.tar.gz

Download URL crescent_ext_docstrings-0.2.2.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
76ba0723fd89d3abd3d4205d364db21858080aee687a504476fe35c3cbf8ca4b
BLAKE2b-256 checksum
How to use checksums
4379fcb552fd599043b979ece8b8f1573bcc99493be4dc75d14a6254237f5517
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.8.18 Linux/6.2.0-1012-azure

Release files / crescent_ext_docstrings-0.2.2-py3-none-any.whl

Download URL crescent_ext_docstrings-0.2.2-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dd79873a392727c973a708eaca51b6883321dcc9b09c26b799e4ff2c30dc218
BLAKE2b-256 checksum
How to use checksums
567226f971201764c5c482fef1e78189b0e65547b7366b601c2c8921420cc76d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.8.18 Linux/6.2.0-1012-azure

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page