You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type-check the whole package with pyright or basedpyright #792
Citry's users type-check their apps with mypy or with pyright (directly, through Pylance in VS Code, or through basedpyright). Citry's types should work the same in each of them.
Today the gate (scripts/check.py) runs mypy over the Python packages, but runs pyright only on the typing contract tests, such as test_events_typing.py. Checking the whole package with pyright or basedpyright would also catch errors that mypy misses. One example from django-components: a function created inside a loop that refers to the loop variable.
What django-components found when it tried basedpyright:
basedpyright's default mode is stricter than pyright's, so the config needs a list of rules to turn off.
Pylance and pyright report basedpyright-only rule names as invalid config. And when a pyrightconfig.json file exists, both tools ignore the [tool.basedpyright] or [tool.pyright] section of pyproject.toml completely. So one shared config cannot serve every editor and the gate at once.
Most of the errors came from untyped Django code. Citry does not depend on Django, so it should see far fewer.
Running more than one type checker over the same code may also turn up cases where mypy, pyright and basedpyright disagree, which may lead to issues filed upstream in those projects.
Activity