pycord-v3 icon indicating copy to clipboard operation
pycord-v3 copied to clipboard

Strict type checking on `mypy` doesn't work with Pycord

Open hwittenborn opened this issue 1 year ago • 4 comments

Summary

Using mypy --strict with Pycord seems to cause severe type checking issues

Reproduction Steps

  1. Create a virtual environment
  2. Run pip install mypy py-cord
  3. Create a file named main.py, with the following content:
import discord
bot = discord.Bot()
  1. Run mypy main.py, and see no errors:
Success: no issues found in 1 source file
  1. Run mypy --strict main.py, and see mypy start to freak out:
main.py:2: error: Call to untyped function "Bot" in typed context  [no-untyped-call]

Minimal Reproducible Code

No response

Expected Results

When --strict is used, no errors should be thrown.

Actual Results

When --strict is used, unclear errors are thrown.

Intents

N/A

System Information

  • Python v3.12.3-final
  • py-cord v2.6.None-final
  • aiohttp v3.9.5
  • system info: Linux 6.8.0-38-generic Pycord-Development/pycord#38-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:25:01 UTC 2024

Checklist

  • [X] I have searched the open issues for duplicates.
  • [X] I have shown the entire traceback, if possible.
  • [X] I have removed my token from display, if visible.

Additional Context

I'm not positive if it's related, but just running mypy -p discord from within the same virtual environment is showing

hwittenborn avatar Jul 20 '24 14:07 hwittenborn

Can repro

Paillat-dev avatar Oct 11 '24 09:10 Paillat-dev

py-cord is not strictly type (even typed tbh) and its not planned until next

Lumabots avatar Oct 23 '25 08:10 Lumabots

~~Pycord doesn't even support MyPy. It currently only supports Pyright on basic, as that's what discord.py started with.~~ Apparently it only supports MyPy, looking at in pyproject.toml...

Soheab avatar Oct 23 '25 10:10 Soheab

@Soheab I just transfered this over here on next because we are going to strict type as much as we can over here

Paillat-dev avatar Oct 23 '25 11:10 Paillat-dev