spotify / pedalboard

🎛 🔊 A Python library for audio.
https://spotify.github.io/pedalboard
GNU General Public License v3.0
4.96k stars 249 forks source link

Type checking fails on any symbol exported by `pedalboard` #333

Open mttbernardini opened 1 month ago

mttbernardini commented 1 month ago

I created a minimum failing example here with a workflow matrix that tests using mypy, pyright, pyre and pytype. Of all the type checkers, only pyright is able to properly evaluate the snippet without raising errors and properly infer the type of gain:

import pedalboard

# mypy: Name "pedalboard.Plugin" is not defined [name-defined]
# pyre: Undefined or invalid type [11]: Annotation `pedalboard.Plugin` is not defined as a type.
gain: pedalboard.Plugin

# mypy: Module has no attribute "Gain" [attr-defined]
# pyre: Undefined attribute [16]: Module `pedalboard` has no attribute `Gain`.
gain = pedalboard.Gain()

# mypy, pyre, pytype: Revealed type is "Any"
# pyright: Type of "gain" is "Gain"
reveal_type(gain)

Versions: