Skip to main content

discord.py stubs

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discord.py-stubs-1.7.2.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

discord.py_stubs-1.7.2-py3-none-any.whl (63.1 kB view details)

Uploaded Python 3

File details

Details for the file discord.py-stubs-1.7.2.tar.gz.

File metadata

  • Download URL: discord.py-stubs-1.7.2.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.10 Linux/5.4.0-1047-azure

File hashes

Hashes for discord.py-stubs-1.7.2.tar.gz
Algorithm Hash digest
SHA256 1282385b93ed15dccc3fc072c9f6d8acaeb961197349500044e08f14c8a7a89f
MD5 8869684531bab1a615fc608d316cb7bf
BLAKE2b-256 f90879ad574eabd2693ff51ed67437a5478b696c8ae5b1639684d217c670ac68

See more details on using hashes here.

File details

Details for the file discord.py_stubs-1.7.2-py3-none-any.whl.

File metadata

  • Download URL: discord.py_stubs-1.7.2-py3-none-any.whl
  • Upload date:
  • Size: 63.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.10 Linux/5.4.0-1047-azure

File hashes

Hashes for discord.py_stubs-1.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 20577a31e231383bbafaedf23996c58ca079deb75e41b0a7c60c98300a0fd425
MD5 1b74a3e5e2db8761db4280eb0106e62c
BLAKE2b-256 2bb133fd7656aa82d1ff813ec3890800b3c5f717beffb213a366c0c01091f333

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page