-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the bug
This regression was noticed in python/typeshed#13198 and prevents us from upgrading pyright past 1.1.389:
Currently, the stubs for icalendar/__init__.pyi contains the following definition:
from .version import version as versionwhere version is defined in icalendar/version.pyi as:
version: Final[str]This fails since trying to update to 1.1.390:
/home/runner/work/typeshed/typeshed/stubs/icalendar/icalendar/__init__.pyi
/home/runner/work/typeshed/typeshed/stubs/icalendar/icalendar/__init__.pyi:48:7 - error: "version" is declared as Final and cannot be reassigned
See this CI run, for example, which is using pyright 1.1.395: https://github.com/python/typeshed/actions/runs/13564502381/job/37914468832?pr=13198
I suspect the problem here is that version is first imported implicitly as a module (from .version), which is then overridden by the import version part (or vice versa). While this is an accurate representation of what happens at runtime, the conflict here is less than helpful. The implicit import is a rather arcane – and certainly not recommended to use – feature, and in this particular instance, the version module name is quickly overridden.
I'd rather wish pyright would not support implicitly imports like this.
VS Code extension or command-line
It's run in typeshed's CI using the GitHub action jakebailey/pyright-action@v2.