Skip to main content

discord.py-stubs

License Checked with mypy Code style: black

This package contains type stubs to provide more precise static types and type inference for discord.py.

Installation

pip install discord.py-stubs

NOTE: Because discord.py uses namespace packages for its extensions, mypy must be configured to use namespace packages either with the --namespace-packages command line flag, or by setting namespace_packages = True in your mypy configuration file. See the import discovery section of the mypy documentation for more details.

Usage Notes

In most cases, installing this package will enable developers to type check their discord.py bots using mypy out of the box. However, if developers wish to subclass the classes in discord.ext.commands they will need to follow the mypy documentation outlining how to use classes that are generic in stubs but not at runtime:

from typing import TYPE_CHECKING
from discord.ext import commands

class MyContext(commands.Context):
    ...

if TYPE_CHECKING:
    Cog = commands.Cog[MyContext]
else:
    Cog = commands.Cog

class MyCog(Cog):
    ...

In order to avoid this issue, developers can use discord-ext-typed-commands:

from discord.ext import typed_commands

class MyContext(typed_commands.Context):
    ...

class MyCog(typed_commands.Cog[MyContext]):
    ...

Development

Make sure you have poetry installed.

poetry install
poetry run pre-commit install --hook-type pre-commit --hook-type post-checkout

Version numbering scheme

The major and minor version numbers of discord.py-stubs will match the major and minor version numbers of the discord.py release the stubs represent. For instance, if you are using discord.py version 1.7.4, you would use discord.py-stubs version 1.7.X where X is the latest patch version of the stubs. Using semver dependency specifications, discord.py-stubs version ~1.7 is designed to work with discord.py version ~1.7.

In addition, discord.py-stubs will indicate which versions of the runtime library are compatible through its dependency information (as suggested in PEP-561).

Metadata

Release files for discord.py-stubs 1.7.3

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

Source distribution (sdist)

Source distribution for discord.py-stubs 1.7.3
File Size Uploaded Provenance Actions
discord.py-stubs-1.7.3.tar.gz 44.5 kB Without provenance Details for discord.py-stubs-1.7.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for discord.py-stubs 1.7.3
File Interpreter ABI Platform Actions
discord.py_stubs-1.7.3-py3-none-any.whl Python 3 none any Details for discord.py_stubs-1.7.3-py3-none-any.whl

Total release size: 107.5 kB

Release files / discord.py-stubs-1.7.3.tar.gz

Download URL discord.py-stubs-1.7.3.tar.gz
Size 44.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d28d218540217794ff12b7c0afd8ee4d65fc91bd169c53475781ac99413819ec
BLAKE2b-256 checksum
How to use checksums
41f23ac03d1270079c86a60e7677c402564144439e890b5873dbe146032e24e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.10 Linux/5.4.0-1047-azure

Release files / discord.py_stubs-1.7.3-py3-none-any.whl

Download URL discord.py_stubs-1.7.3-py3-none-any.whl
Size 63.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec6283e08beff4660c2d28a3fb48f501eb74988d8d6e5859b3838ac897016c95
BLAKE2b-256 checksum
How to use checksums
455110e21662776254ba3e721c64413a910596c90d9c237bae50c1f1f37e50c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.10 Linux/5.4.0-1047-azure

Security for discord.py-stubs 1.7.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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