Skip to content

Is discord.py-stubs no longer needed as of discord.py 2.0.0 ? #171

@richfromm

Description

@richfromm

Apologies if opening an issue is not the best way to ask this question, I wasn't sure how else to.

I have some code using discord.py (https://github.com/richfromm/slack2discord) to which I'm adding mypy support. I had earlier seen the warning:

/Users/rich/.virtualenvs/slack2discord/lib/python3.10/site-packages/discord/app_commands/commands.py:72: error: Cannot find implementation or library stub for module named "discord.ext.commands"
/Users/rich/.virtualenvs/slack2discord/lib/python3.10/site-packages/discord/app_commands/commands.py:72: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

Which caused me to find and try installing this library.

But I see that if I first install the latest discord.py (currently 2.0.1), when I install discord.py-stubs, it downgrades discord.py to 1.7.3.

Looking further, I see that 1.7.3 is the latest release of discord.py-stubs (see https://github.com/bryanforbes/discord.py-stubs/tags), and that 1.7.3 is the end of the 1.x line for discord.py (see https://github.com/Rapptz/discord.py/tags), and that the versions need to match (https://github.com/bryanforbes/discord.py-stubs#version-numbering-scheme).

So I was about to open an issue asking when this stubs library would be updated for 2.0.0. and 2.0.1, but taking a look at the diffs in discord.py 2.0.0, I see that it now already includes mypy typing hints:
Rapptz/discord.py@v1.7.3...v2.0.0

And indeed, if I start over with a fresh virtualenv, I am no longer seeing the above error when running mypy with discord.py 2.0.1 installed and discord.py-stubs not installed at all.

So is this library no longer needed moving forward, and if so, should that be noted in the README ? (I can add some text and open a PR if you agree and would like me to take care of it.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions