Pycord-Development / pycord

Pycord is a modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python
https://docs.pycord.dev
MIT License
2.7k stars 458 forks source link

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

Open hwittenborn opened 1 month ago

hwittenborn commented 1 month ago

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()
  4. Run mypy main.py, and see no errors:
    Success: no issues found in 1 source file
  5. 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

Checklist

Additional Context

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