-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is discord.py-stubs no longer needed as of discord.py 2.0.0 ? #171
Comments
our virtualenv needs to additionally install * pip install mypy * pip install types-decorator * pip install types-requests this should definitely noted, and maybe even explicitly supported somehow, maybe it's time for a requirements.txt file (and/or a separate requirements-dev.txt file), and dropping the reference to (and support of) pyv. note that you should **not** `pip install discord.py-stubs`. the last version of this is 1.7.3, and it must be consistent with discord.py (currently 2.0.1), and doing so forces a downgrade. and discord.utils.setup_logging (which we use in slack2discord.py) doesn't exist in 1.7.3 but it appears to be no longer needed, as discord.py now has mypy typing hints as of 2.0.0. see: bryanforbes/discord.py-stubs#171 Rapptz/discord.py#5935 Rapptz/discord.py#7342
|
Sure, I'll add something to the README But while I've got your attention, I think I know why I was a bit confused initially, and I'm wondering if you have a clue what's going on. I'm in the process of adding mypy typing hints to my project, and it's currently passing. However, when I run mypy, every other time (precisely), it gives me the warning I included above, about not being able to find an implementation or library stub for discord.ext.commands. As in, I can put it in a tight loop, not touching anything at all, and it alternates fail, pass, fail, pass, etc. See below. Any clue what might be going on? Could this be an issue with discord.py? A bug in mypy? I know mypy does some local caching (there's a
|
The offending line is at https://github.com/Rapptz/discord.py/blob/8f19cfe72925a1dd493c8e92525186d34915d0a9/discord/app_commands/commands.py#L72:
UPDATE: I think it should be:
Making that change locally in my virtualenv fixes the issue. No clue why the behavior would fail in the way it did without that change, though. Anyway, it's outside the scope of this repo, I'll file an issue in discord.py UPDATE2: There's already an issue: Regardless, that is indeed outside of the scope of this stub, although if I was going to put a disclaimer about it not being needed, but mypy doesn't quite work yet (which I think is the case, as the fix hasn't been released), that might influence my text. So for the immediate time I'm going to hold off a day or so and see if I get a response to any of my comments. |
our virtualenv needs to additionally install * pip install mypy * pip install types-decorator * pip install types-requests this should definitely noted, and maybe even explicitly supported somehow, maybe it's time for a requirements.txt file (and/or a separate requirements-dev.txt file), and dropping the reference to (and support of) pyv. note that you should **not** `pip install discord.py-stubs`. the last version of this is 1.7.3, and it must be consistent with discord.py (currently 2.0.1), and doing so forces a downgrade. and discord.utils.setup_logging (which we use in slack2discord.py) doesn't exist in 1.7.3 but it appears to be no longer needed, as discord.py now has mypy typing hints as of 2.0.0. see: bryanforbes/discord.py-stubs#171 Rapptz/discord.py#5935 Rapptz/discord.py#7342
our virtualenv needs to additionally install * pip install mypy * pip install types-decorator * pip install types-requests this should definitely noted, and maybe even explicitly supported somehow, maybe it's time for a requirements.txt file (and/or a separate requirements-dev.txt file), and dropping the reference to (and support of) pyv. note that you should **not** `pip install discord.py-stubs`. the last version of this is 1.7.3, and it must be consistent with discord.py (currently 2.0.1), and doing so forces a downgrade. and discord.utils.setup_logging (which we use in slack2discord.py) doesn't exist in 1.7.3 but it appears to be no longer needed, as discord.py now has mypy typing hints as of 2.0.0. see: bryanforbes/discord.py-stubs#171 Rapptz/discord.py#5935 Rapptz/discord.py#7342
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:
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.)
The text was updated successfully, but these errors were encountered: