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

At this time, the version number of discord.py-stubs will follow the version number of discord.py it corresponds to and append one more version segment that indicates the sequence of releases for the stubs. For instance, if you are using discord.py version 1.3.4, you would use discord.py-stubs version 1.3.4.X where X is an integer.

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.5.0.1.tar.gz (41.9 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.5.0.1-py3-none-any.whl (59.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: discord.py-stubs-1.5.0.1.tar.gz
  • Upload date:
  • Size: 41.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.2 CPython/3.8.6 Darwin/19.6.0

File hashes

Hashes for discord.py-stubs-1.5.0.1.tar.gz
Algorithm Hash digest
SHA256 c0ab074a1a865012e74b13ee96d7a3fd0ff9033b0ae96f40fcd37f7de29a9c90
MD5 a14aabf80ff9844706c331a0682c1489
BLAKE2b-256 63614bd2ff5415b8be5caff90e3ca675a566d51a9f90e0cca3bb7c0aabc8180a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord.py_stubs-1.5.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 622309362184c086d0aa27a0700f0205ecee581f1ebde3d4e5bb17ad29964e8d
MD5 f3c63c1b45d242706d0d816a16c9dd8c
BLAKE2b-256 1569c05f617ebddaf0bca1961c1b5405a80139edb54768686ed3499622a56a60

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