microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.69k stars 767 forks source link

Pylance seemingly smarter than pyright about literal values. #6153

Closed fau-st closed 1 month ago

fau-st commented 1 month ago

Environment data

Code Snippet

from enum import Enum
from typing import Literal, TypeAlias, Union, reveal_type

class SomeEnum(Enum):
    ENUM_VALUE = "VALUE"

_ENUM_VALUE = SomeEnum.ENUM_VALUE

MyTypeAlias: TypeAlias = Union[Literal[_ENUM_VALUE], None]

class SomeClass:
    member: MyTypeAlias

reveal_type(SomeClass.member)

Repro Steps

  1. Use pylance in VSCode to check the snippet.
  2. Do the same with pyright (Playground )

Expected behavior

Both tools report the same issues.

Actual behavior

pylance doesn't report an issue but pyright does. I tried to follow USING_WITH_PYRIGHT.md but I can't seem to find what's the difference between the tools.

Revealed type is "Literal[SomeEnum.ENUM_VALUE] | None" for pylance but "Unknown | None" for pyright (plus the reportInvalidTypeForm error).

It looks like pylance is able to infer that _ENUM_VALUE is a litteral value.

Logs

Trace logging ``` 2024-07-16 16:00:08.755 [info] (Client) Pylance async client (2024.7.1) started with python extension (2024.10.0) 2024-07-16 16:00:09.120 [info] [Info - 4:00:09 PM] (1616284) Pylance language server 2024.7.1 (pyright version 1.1.369, commit 1168be71) starting 2024-07-16 16:00:09.120 [info] [Info - 4:00:09 PM] (1616284) Server root directory: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist 2024-07-16 16:00:09.124 [info] [Info - 4:00:09 PM] (1616284) Starting service instance "pyright_bug" 2024-07-16 16:00:09.147 [info] [Info - 4:00:09 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 16:00:09.147 [info] [Info - 4:00:09 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (global)" 2024-07-16 16:00:09.147 [info] [Info - 4:00:09 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 16:00:09.148 [info] [Info - 4:00:09 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 16:00:09.148 [info] [Info - 4:00:09 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 16:00:09.148 [info] [Info - 4:00:09 PM] (1616284) Auto-excluding **/.* 2024-07-16 16:00:09.166 [info] [Info - 4:00:09 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 16:00:09.203 [info] [Info - 4:00:09 PM] (1616284) No source files found. 2024-07-16 16:00:09.538 [info] [Info - 4:00:09 PM] (1616284) Background analysis(1) root directory: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist 2024-07-16 16:00:09.540 [info] [Info - 4:00:09 PM] (1616284) Background analysis(1) started 2024-07-16 16:00:09.594 [info] [Info - 4:00:09 PM] (1616284) Indexer background runner(2) root directory: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist (index) 2024-07-16 16:00:09.594 [info] [Info - 4:00:09 PM] (1616284) Indexing(2) started 2024-07-16 16:00:09.838 [info] [Info - 4:00:09 PM] (1616284) scanned(2) 13 files over 1 exec env 2024-07-16 16:00:10.014 [info] [Info - 4:00:10 PM] (1616284) indexed(2) 3 files over 1 exec env 2024-07-16 16:00:10.022 [info] [Info - 4:00:10 PM] (1616284) Indexing finished(2). 2024-07-16 16:00:22.731 [info] [Info - 4:00:22 PM] (1616284) Found 1 source file 2024-07-16 16:01:16.499 [info] [Info - 4:01:16 PM] (1616284) Starting service instance "" 2024-07-16 16:01:16.516 [info] [Info - 4:01:16 PM] (1616284) Setting pythonPath for service "": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 16:01:16.516 [info] [Info - 4:01:16 PM] (1616284) Setting environmentName for service "": "3.12.0 (global)" 2024-07-16 16:01:16.516 [info] [Info - 4:01:16 PM] (1616284) No include entries specified; assuming / 2024-07-16 16:01:16.516 [info] [Info - 4:01:16 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 16:01:16.516 [info] [Info - 4:01:16 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 16:01:16.516 [info] [Info - 4:01:16 PM] (1616284) Auto-excluding **/.* 2024-07-16 16:01:16.533 [info] [Info - 4:01:16 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 16:01:16.561 [info] [Error - 4:01:16 PM] (1616284) File or directory "/" does not exist. 2024-07-16 16:01:16.561 [info] [Info - 4:01:16 PM] (1616284) No source files found. 2024-07-16 16:01:16.835 [info] [Info - 4:01:16 PM] (1616284) Background analysis(3) root directory: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist 2024-07-16 16:01:16.837 [info] [Info - 4:01:16 PM] (1616284) Background analysis(3) started 2024-07-16 16:48:25.170 [info] [Info - 4:48:25 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 16:48:25.171 [info] [Info - 4:48:25 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (global)" 2024-07-16 16:48:25.172 [info] [Info - 4:48:25 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 16:48:25.178 [info] [Info - 4:48:25 PM] (1616284) Pyproject file "/local/home/fau-st/temp/pyright_bug/pyproject.toml" has no "[tool.pyright]" section. 2024-07-16 16:48:25.178 [info] [Info - 4:48:25 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 16:48:25.178 [info] [Info - 4:48:25 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 16:48:25.178 [info] [Info - 4:48:25 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 16:48:25.178 [info] [Info - 4:48:25 PM] (1616284) Auto-excluding **/.* 2024-07-16 16:48:25.185 [info] [Info - 4:48:25 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 16:48:25.229 [info] [Info - 4:48:25 PM] (1616284) Found 1 source file 2024-07-16 16:48:25.270 [info] [Info - 4:48:25 PM] (1616284) Setting pythonPath for service "": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 16:48:25.270 [info] [Info - 4:48:25 PM] (1616284) Setting environmentName for service "": "3.12.0 (global)" 2024-07-16 16:48:25.270 [info] [Info - 4:48:25 PM] (1616284) No include entries specified; assuming / 2024-07-16 16:48:25.270 [info] [Info - 4:48:25 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 16:48:25.270 [info] [Info - 4:48:25 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 16:48:25.270 [info] [Info - 4:48:25 PM] (1616284) Auto-excluding **/.* 2024-07-16 16:48:25.292 [info] [Info - 4:48:25 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 16:48:25.333 [info] [Error - 4:48:25 PM] (1616284) File or directory "/" does not exist. 2024-07-16 16:48:25.333 [info] [Info - 4:48:25 PM] (1616284) No source files found. 2024-07-16 16:48:25.727 [info] [Info - 4:48:25 PM] (1616284) Indexer background runner(4) root directory: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist (index) 2024-07-16 16:48:25.727 [info] [Info - 4:48:25 PM] (1616284) Indexing(4) started 2024-07-16 16:48:25.938 [info] [Info - 4:48:25 PM] (1616284) scanned(4) 13 files over 1 exec env 2024-07-16 16:48:26.231 [info] [Info - 4:48:26 PM] (1616284) indexed(4) 3 files over 1 exec env 2024-07-16 16:48:26.246 [info] [Info - 4:48:26 PM] (1616284) Indexing finished(4). 2024-07-16 16:48:33.220 [info] [Info - 4:48:33 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 16:48:33.220 [info] [Info - 4:48:33 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (global)" 2024-07-16 16:48:33.220 [info] [Info - 4:48:33 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 16:48:33.220 [info] [Info - 4:48:33 PM] (1616284) Pyproject file "/local/home/fau-st/temp/pyright_bug/pyproject.toml" has no "[tool.pyright]" section. 2024-07-16 16:48:33.220 [info] [Info - 4:48:33 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 16:48:33.220 [info] [Info - 4:48:33 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 16:48:33.220 [info] [Info - 4:48:33 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 16:48:33.220 [info] [Info - 4:48:33 PM] (1616284) Auto-excluding **/.* 2024-07-16 16:48:33.246 [info] [Info - 4:48:33 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 16:48:33.284 [info] [Info - 4:48:33 PM] (1616284) Found 1 source file 2024-07-16 16:48:33.327 [info] [Info - 4:48:33 PM] (1616284) Setting pythonPath for service "": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 16:48:33.328 [info] [Info - 4:48:33 PM] (1616284) Setting environmentName for service "": "3.12.0 (global)" 2024-07-16 16:48:33.328 [info] [Info - 4:48:33 PM] (1616284) No include entries specified; assuming / 2024-07-16 16:48:33.328 [info] [Info - 4:48:33 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 16:48:33.328 [info] [Info - 4:48:33 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 16:48:33.328 [info] [Info - 4:48:33 PM] (1616284) Auto-excluding **/.* 2024-07-16 16:48:33.356 [info] [Info - 4:48:33 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 16:48:33.395 [info] [Error - 4:48:33 PM] (1616284) File or directory "/" does not exist. 2024-07-16 16:48:33.396 [info] [Info - 4:48:33 PM] (1616284) No source files found. 2024-07-16 16:48:33.799 [info] [Info - 4:48:33 PM] (1616284) Indexer background runner(5) root directory: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist (index) 2024-07-16 16:48:33.799 [info] [Info - 4:48:33 PM] (1616284) Indexing(5) started 2024-07-16 16:48:34.102 [info] [Info - 4:48:34 PM] (1616284) scanned(5) 13 files over 1 exec env 2024-07-16 16:48:34.266 [info] [Info - 4:48:34 PM] (1616284) indexed(5) 3 files over 1 exec env 2024-07-16 16:48:34.279 [info] [Info - 4:48:34 PM] (1616284) Indexing finished(5). 2024-07-16 16:48:55.166 [info] [Info - 4:48:55 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 16:48:55.166 [info] [Info - 4:48:55 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (global)" 2024-07-16 16:48:55.166 [info] [Info - 4:48:55 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 16:48:55.166 [info] [Info - 4:48:55 PM] (1616284) Pyproject file "/local/home/fau-st/temp/pyright_bug/pyproject.toml" has no "[tool.pyright]" section. 2024-07-16 16:48:55.166 [info] [Info - 4:48:55 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 16:48:55.166 [info] [Info - 4:48:55 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 16:48:55.166 [info] [Info - 4:48:55 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 16:48:55.166 [info] [Info - 4:48:55 PM] (1616284) Auto-excluding **/.* 2024-07-16 16:48:55.190 [info] [Info - 4:48:55 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 16:48:55.234 [info] [Info - 4:48:55 PM] (1616284) Found 1 source file 2024-07-16 16:48:55.264 [info] [Info - 4:48:55 PM] (1616284) Setting pythonPath for service "": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 16:48:55.265 [info] [Info - 4:48:55 PM] (1616284) Setting environmentName for service "": "3.12.0 (global)" 2024-07-16 16:48:55.265 [info] [Info - 4:48:55 PM] (1616284) No include entries specified; assuming / 2024-07-16 16:48:55.265 [info] [Info - 4:48:55 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 16:48:55.265 [info] [Info - 4:48:55 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 16:48:55.265 [info] [Info - 4:48:55 PM] (1616284) Auto-excluding **/.* 2024-07-16 16:48:55.287 [info] [Info - 4:48:55 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 16:48:55.331 [info] [Error - 4:48:55 PM] (1616284) File or directory "/" does not exist. 2024-07-16 16:48:55.331 [info] [Info - 4:48:55 PM] (1616284) No source files found. 2024-07-16 16:48:55.794 [info] [Info - 4:48:55 PM] (1616284) Indexer background runner(6) root directory: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist (index) 2024-07-16 16:48:55.794 [info] [Info - 4:48:55 PM] (1616284) Indexing(6) started 2024-07-16 16:48:56.013 [info] [Info - 4:48:56 PM] (1616284) scanned(6) 13 files over 1 exec env 2024-07-16 16:48:56.227 [info] [Info - 4:48:56 PM] (1616284) indexed(6) 3 files over 1 exec env 2024-07-16 16:48:56.236 [info] [Info - 4:48:56 PM] (1616284) Indexing finished(6). 2024-07-16 17:34:47.833 [info] [Info - 5:34:47 PM] (1616284) Reloading configuration file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:34:47.834 [info] [Info - 5:34:47 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 17:34:47.834 [info] [Info - 5:34:47 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (global)" 2024-07-16 17:34:47.834 [info] [Info - 5:34:47 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:34:47.835 [info] [Info - 5:34:47 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 17:34:47.835 [info] [Info - 5:34:47 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 17:34:47.835 [info] [Info - 5:34:47 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 17:34:47.835 [info] [Info - 5:34:47 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 17:34:47.835 [info] [Info - 5:34:47 PM] (1616284) Auto-excluding **/.* 2024-07-16 17:34:47.846 [info] [Info - 5:34:47 PM] (1616284) Found 1 source file 2024-07-16 17:34:54.110 [info] [Info - 5:34:54 PM] (1616284) Reloading configuration file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:34:54.110 [info] [Info - 5:34:54 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 17:34:54.110 [info] [Info - 5:34:54 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (global)" 2024-07-16 17:34:54.111 [info] [Info - 5:34:54 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:34:54.111 [info] [Info - 5:34:54 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 17:34:54.111 [info] [Info - 5:34:54 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 17:34:54.111 [info] [Info - 5:34:54 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 17:34:54.111 [info] [Info - 5:34:54 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 17:34:54.111 [info] [Info - 5:34:54 PM] (1616284) Auto-excluding **/.* 2024-07-16 17:34:54.121 [info] [Info - 5:34:54 PM] (1616284) Found 1 source file 2024-07-16 17:34:55.274 [info] [Info - 5:34:55 PM] (1616284) Reloading configuration file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:34:55.275 [info] [Info - 5:34:55 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/bin/python" 2024-07-16 17:34:55.275 [info] [Info - 5:34:55 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (global)" 2024-07-16 17:34:55.275 [info] [Info - 5:34:55 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:34:55.276 [info] [Info - 5:34:55 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 17:34:55.276 [info] [Info - 5:34:55 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 17:34:55.276 [info] [Info - 5:34:55 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 17:34:55.276 [info] [Info - 5:34:55 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 17:34:55.276 [info] [Info - 5:34:55 PM] (1616284) Auto-excluding **/.* 2024-07-16 17:34:55.294 [info] [Info - 5:34:55 PM] (1616284) Found 1 source file 2024-07-16 17:35:37.339 [info] [Info - 5:35:37 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python" 2024-07-16 17:35:37.339 [info] [Info - 5:35:37 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (pyright_bug venv)" 2024-07-16 17:35:37.339 [info] [Info - 5:35:37 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:35:37.361 [info] [Info - 5:35:37 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 17:35:37.361 [info] [Info - 5:35:37 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 17:35:37.361 [info] [Info - 5:35:37 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 17:35:37.361 [info] [Info - 5:35:37 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 17:35:37.361 [info] [Info - 5:35:37 PM] (1616284) Auto-excluding **/.* 2024-07-16 17:35:37.408 [info] [Info - 5:35:37 PM] (1616284) Found 1 source file 2024-07-16 17:35:37.428 [info] [Info - 5:35:37 PM] (1616284) Setting pythonPath for service "": "/local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python" 2024-07-16 17:35:37.428 [info] [Info - 5:35:37 PM] (1616284) Setting environmentName for service "": "3.12.0 (pyright_bug venv)" 2024-07-16 17:35:37.428 [info] [Info - 5:35:37 PM] (1616284) No include entries specified; assuming / 2024-07-16 17:35:37.428 [info] [Info - 5:35:37 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 17:35:37.428 [info] [Info - 5:35:37 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 17:35:37.428 [info] [Info - 5:35:37 PM] (1616284) Auto-excluding **/.* 2024-07-16 17:35:37.458 [info] [Info - 5:35:37 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 17:35:37.590 [info] [Error - 5:35:37 PM] (1616284) File or directory "/" does not exist. 2024-07-16 17:35:37.590 [info] [Info - 5:35:37 PM] (1616284) No source files found. 2024-07-16 17:35:37.842 [info] [Info - 5:35:37 PM] (1616284) Indexer background runner(7) root directory: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist (index) 2024-07-16 17:35:37.842 [info] [Info - 5:35:37 PM] (1616284) Indexing(7) started 2024-07-16 17:35:38.015 [info] [Info - 5:35:38 PM] (1616284) scanned(7) 13 files over 1 exec env 2024-07-16 17:35:38.187 [info] [Info - 5:35:38 PM] (1616284) indexed(7) 3 files over 1 exec env 2024-07-16 17:35:38.197 [info] [Info - 5:35:38 PM] (1616284) Indexing finished(7). 2024-07-16 17:36:28.215 [info] [Info - 5:36:28 PM] (1616284) Reloading configuration file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:36:28.216 [info] [Info - 5:36:28 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python" 2024-07-16 17:36:28.216 [info] [Info - 5:36:28 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (pyright_bug venv)" 2024-07-16 17:36:28.217 [info] [Info - 5:36:28 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:36:28.217 [info] [Info - 5:36:28 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 17:36:28.217 [info] [Info - 5:36:28 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 17:36:28.218 [info] [Info - 5:36:28 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 17:36:28.218 [info] [Info - 5:36:28 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 17:36:28.218 [info] [Info - 5:36:28 PM] (1616284) Auto-excluding **/.* 2024-07-16 17:36:28.218 [info] [Warn - 5:36:28 PM] (1616284) The useLibraryCodeForTypes has been specified in both the config file and the client settings. The value in the config file (true) will take precedence 2024-07-16 17:36:28.233 [info] [Info - 5:36:28 PM] (1616284) Found 1 source file 2024-07-16 17:36:46.148 [info] [Info - 5:36:46 PM] (1616284) Reloading configuration file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:36:46.148 [info] [Info - 5:36:46 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python" 2024-07-16 17:36:46.148 [info] [Info - 5:36:46 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (pyright_bug venv)" 2024-07-16 17:36:46.148 [info] [Info - 5:36:46 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:36:46.149 [info] [Info - 5:36:46 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 17:36:46.149 [info] [Info - 5:36:46 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 17:36:46.149 [info] [Info - 5:36:46 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 17:36:46.149 [info] [Info - 5:36:46 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 17:36:46.149 [info] [Info - 5:36:46 PM] (1616284) Auto-excluding **/.* 2024-07-16 17:36:46.162 [info] [Info - 5:36:46 PM] (1616284) Found 1 source file 2024-07-16 17:39:47.510 [info] (1616284) No configuration file found. 2024-07-16 17:39:47.510 [info] (1616284) pyproject.toml file found at /local/home/fau-st/temp/pyright_bug. 2024-07-16 17:39:47.510 [info] [Info - 5:39:47 PM] (1616284) Setting pythonPath for service "pyright_bug": "/local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python" 2024-07-16 17:39:47.510 [info] [Info - 5:39:47 PM] (1616284) Setting environmentName for service "pyright_bug": "3.12.0 (pyright_bug venv)" 2024-07-16 17:39:47.510 [info] [Info - 5:39:47 PM] (1616284) Loading pyproject.toml file at /local/home/fau-st/temp/pyright_bug/pyproject.toml 2024-07-16 17:39:47.519 [info] [Info - 5:39:47 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 17:39:47.519 [info] (1616284) Assuming Python platform Linux 2024-07-16 17:39:47.519 [info] [Info - 5:39:47 PM] (1616284) No include entries specified; assuming /local/home/fau-st/temp/pyright_bug 2024-07-16 17:39:47.519 [info] [Info - 5:39:47 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 17:39:47.519 [info] [Info - 5:39:47 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 17:39:47.519 [info] [Info - 5:39:47 PM] (1616284) Auto-excluding **/.* 2024-07-16 17:39:47.548 [info] [Info - 5:39:47 PM] (1616284) Search paths for file:///local/home/fau-st/temp/pyright_bug 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/temp/pyright_bug 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/temp/pyright_bug/typings 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stubs/... 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/bundled/stubs 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/lib-dynload 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) Adding fs watcher for library directories: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12 file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/lib-dynload file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) Adding fs watcher for directories: file:///local/home/fau-st/temp/pyright_bug 2024-07-16 17:39:47.549 [info] (1616284) Searching for source files 2024-07-16 17:39:47.549 [info] [Info - 5:39:47 PM] (1616284) Found 1 source file 2024-07-16 17:39:47.566 [info] (1616284) pytest configurations: {"message":"script","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]} 2024-07-16 17:39:47.566 [info] (1616284) Server settings returned for workspace: undefined: { "autoSearchPaths": true, "disableLanguageServices": false, "openFilesOnly": false, "useLibraryCodeForTypes": true, "watchForSourceChanges": true, "watchForLibraryChanges": true, "watchForConfigChanges": true, "typeCheckingMode": "strict", "diagnosticSeverityOverrides": { "reportShadowedImports": "warning" }, "logLevel": "log", "autoImportCompletions": true, "indexing": false, "completeFunctionParens": false, "enableExtractCodeAction": true, "indexOptions": { "packageDepths": [ [ "sklearn", 2, false ], [ "matplotlib", 2, false ], [ "scipy", 2, false ], [ "django", 2, false ], [ "flask", 2, false ], [ "fastapi", 2, false ] ], "userFileIndexingLimit": 2000 }, "variableInlayTypeHints": false, "callArgumentNameInlayHints": "partial", "functionReturnInlayTypeHints": true, "pytestParametersInlayTypeHints": true, "importFormat": "absolute", "includeFileSpecs": [], "excludeFileSpecs": [], "ignoreFileSpecs": [], "formatOnType": true, "taskListTokens": [], "enablePytestSupport": true, "gotoDefinitionInStringLiteral": true, "remapDiagnostics": false, "intelliCodeEnabled": true, "pythonPath": { "_key": "/local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python", "_filePath": "/local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python", "_query": "", "_fragment": "", "_originalString": "file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python", "_isCaseSensitive": true }, "pythonEnvironmentName": "3.12.0 (pyright_bug venv)", "fixAll": [], "extraCommitChars": false, "autoFormatStrings": false, "autoIndent": true, "supportRestructuredText": false, "collectModuleInfo": false, "nodeExecutable": "", "notebookRunStartupCommands": "", "editorIndentConfig": { "defaultTabSequence": " ", "tabSize": 4 } } 2024-07-16 17:39:47.570 [info] (1616284) No pyproject.toml file found. 2024-07-16 17:39:47.570 [info] [Info - 5:39:47 PM] (1616284) Setting pythonPath for service "": "/local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python" 2024-07-16 17:39:47.570 [info] [Info - 5:39:47 PM] (1616284) Setting environmentName for service "": "3.12.0 (pyright_bug venv)" 2024-07-16 17:39:47.570 [info] [Info - 5:39:47 PM] (1616284) No include entries specified; assuming / 2024-07-16 17:39:47.570 [info] [Info - 5:39:47 PM] (1616284) Auto-excluding **/node_modules 2024-07-16 17:39:47.570 [info] [Info - 5:39:47 PM] (1616284) Auto-excluding **/__pycache__ 2024-07-16 17:39:47.570 [info] [Info - 5:39:47 PM] (1616284) Auto-excluding **/.* 2024-07-16 17:39:47.588 [info] [Info - 5:39:47 PM] (1616284) Assuming Python version 3.12.0.final.0 2024-07-16 17:39:47.588 [info] (1616284) Assuming Python platform Linux 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) Search paths for file:///%3Cdefault%20workspace%20root%3E 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) / 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) //typings 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stubs/... 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/bundled/stubs 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/lib-dynload 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) /local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) Adding fs watcher for library directories: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12 file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/lib-dynload file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages 2024-07-16 17:39:47.621 [info] [Info - 5:39:47 PM] (1616284) Adding fs watcher for directories: file:///%3Cdefault%20workspace%20root%3E 2024-07-16 17:39:47.622 [info] (1616284) Searching for source files 2024-07-16 17:39:47.622 [info] [Error - 5:39:47 PM] (1616284) File or directory "/" does not exist. 2024-07-16 17:39:47.622 [info] [Info - 5:39:47 PM] (1616284) No source files found. 2024-07-16 17:39:47.623 [info] (1616284) pytest configurations: {"message":"spawn /local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python ENOENT","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]} 2024-07-16 17:39:47.623 [info] (1616284) pytest configurations: {"message":"script","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]} 2024-07-16 17:39:47.632 [info] (1616284) pytest configurations: {"message":"spawn /local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python ENOENT","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]} 2024-07-16 17:39:47.645 [info] (1616284) Attempting to resolve using local imports: __builtins__ 2024-07-16 17:39:47.646 [info] (1616284) [BG(1)] analyzing: file:///local/home/fau-st/temp/pyright_bug/case.py ... 2024-07-16 17:39:47.646 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/temp/pyright_bug/case.py (20ms) 2024-07-16 17:39:47.695 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 1ms] (50ms) 2024-07-16 17:39:47.706 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/builtins.pyi (10ms) 2024-07-16 17:39:47.706 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/temp/pyright_bug/case.py (1ms) 2024-07-16 17:39:47.718 [info] (1616284) [BG(1)] checking: file:///local/home/fau-st/temp/pyright_bug/case.py ... 2024-07-16 17:39:47.718 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (10ms) 2024-07-16 17:39:47.722 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/typing.pyi (4ms) 2024-07-16 17:39:47.727 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/types.pyi [fs read 0ms] (4ms) 2024-07-16 17:39:47.731 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/types.pyi (3ms) 2024-07-16 17:39:47.735 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 0ms] (2ms) 2024-07-16 17:39:47.736 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (1ms) 2024-07-16 17:39:47.738 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/abc.pyi [fs read 0ms] (1ms) 2024-07-16 17:39:47.739 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/abc.pyi (0ms) 2024-07-16 17:39:47.764 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/enum.py [fs read 0ms] (24ms) 2024-07-16 17:39:47.773 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/enum.py (8ms) 2024-07-16 17:39:47.775 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/enum.pyi [fs read 0ms] (2ms) 2024-07-16 17:39:47.777 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/enum.pyi (1ms) 2024-07-16 17:39:47.808 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/typing.py [fs read 0ms] (30ms) 2024-07-16 17:39:47.808 [info] [Info - 5:39:47 PM] (1616284) Could not import '_typing' in file '/local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/typing.py' 2024-07-16 17:39:47.808 [info] [Info - 5:39:47 PM] (1616284) Looking in stubPath 'file:///local/home/fau-st/temp/pyright_bug/typings' 2024-07-16 17:39:47.808 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve stub package using root path 'file:///local/home/fau-st/temp/pyright_bug/typings' 2024-07-16 17:39:47.808 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve using root path 'file:///local/home/fau-st/temp/pyright_bug/typings' 2024-07-16 17:39:47.808 [info] [Info - 5:39:47 PM] (1616284) Looking in root directory of execution environment 'file:///local/home/fau-st/temp/pyright_bug' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve stub package using root path 'file:///local/home/fau-st/temp/pyright_bug' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve using root path 'file:///local/home/fau-st/temp/pyright_bug' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Looking for typeshed stdlib path 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Looking for typeshed stdlib path 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve using root path 'file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Typeshed path not found 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Finding python search paths 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Executing interpreter: '/local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/bin/python' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Skipping '/local/home/fau-st/.pyenv/versions/3.12.0/lib/python312.zip' because it is not a valid directory 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Received 3 paths from interpreter 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/lib-dynload 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Looking in python search path 'file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve stub package using root path 'file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve using root path 'file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Looking in python search path 'file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/lib-dynload' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve stub package using root path 'file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/lib-dynload' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve using root path 'file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/lib-dynload' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Looking in python search path 'file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve stub package using root path 'file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve using root path 'file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Looking in bundled stubs path 'file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/bundled/stubs' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve stub package using root path 'file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/bundled/stubs' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Attempting to resolve using root path 'file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/bundled/stubs' 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Looking for typeshed third-party path 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Looking for typeshed stubs path 2024-07-16 17:39:47.809 [info] [Info - 5:39:47 PM] (1616284) Typeshed path not found 2024-07-16 17:39:47.830 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/typing.py (21ms) 2024-07-16 17:39:47.841 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/typing_extensions.pyi [fs read 0ms] (10ms) 2024-07-16 17:39:47.843 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/typing_extensions.pyi (2ms) 2024-07-16 17:39:47.844 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/collections/abc.pyi [fs read 0ms] (0ms) 2024-07-16 17:39:47.844 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/collections/abc.pyi ... 2024-07-16 17:39:47.844 [info] (1616284) [BG(1)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_collections_abc.pyi [fs read 0ms] (0ms) 2024-07-16 17:39:47.845 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_collections_abc.pyi (1ms) 2024-07-16 17:39:47.845 [info] (1616284) [BG(1)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/collections/abc.pyi (1ms) 2024-07-16 17:39:47.848 [info] (1616284) [BG(1)] checking: file:///local/home/fau-st/temp/pyright_bug/case.py (142ms) 2024-07-16 17:39:47.848 [info] [Info - 5:39:47 PM] (1616284) Heap stats: total_heap_size=69MB, used_heap_size=45MB, cross_worker_used_heap_size=45MB, total_physical_size=61MB, total_available_size=4042MB, heap_size_limit=4096MB 2024-07-16 17:39:47.848 [info] (1616284) [BG(1)] analyzing: file:///local/home/fau-st/temp/pyright_bug/case.py (223ms) 2024-07-16 17:39:47.849 [info] (1616284) [BG(1)] indexing: file:///local/home/fau-st/temp/pyright_bug/case.py [found 4] (0ms) 2024-07-16 17:39:47.849 [info] (1616284) Indexing Done: file:///local/home/fau-st/temp/pyright_bug/case.py 2024-07-16 17:39:48.035 [info] [Info - 5:39:48 PM] (1616284) Indexer background runner(8) root directory: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist (index) 2024-07-16 17:39:48.036 [info] [Info - 5:39:48 PM] (1616284) Indexing(8) started 2024-07-16 17:39:48.113 [info] (1616284) [IDX(8)] scan packages file:///local/home/fau-st/temp/pyright_bug ... 2024-07-16 17:39:48.113 [info] (1616284) [IDX(8)] read stdlib indices (17ms) 2024-07-16 17:39:48.265 [info] (1616284) [IDX(8)] scan packages file:///local/home/fau-st/temp/pyright_bug (170ms) 2024-07-16 17:39:48.265 [info] [Info - 5:39:48 PM] (1616284) scanned(8) 13 files over 1 exec env 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] index packages file:///local/home/fau-st/temp/pyright_bug ... 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] index execution environment file:///local/home/fau-st/temp/pyright_bug ... 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/__phello__/__init__.py [skipped: no '__all__' defined] (0ms) 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/concurrent/__init__.py [skipped: no '__all__' defined] (0ms) 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/idlelib/__init__.py [skipped: no '__all__' defined] (0ms) 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/lib2to3/__init__.py [skipped: no '__all__' defined] (0ms) 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/pydoc_data/__init__.py [skipped: no '__all__' defined] (1ms) 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/test/__init__.py [skipped: no '__all__' defined] (0ms) 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/turtledemo/__init__.py [skipped: no '__all__' defined] (0ms) 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/urllib/__init__.py [skipped: no '__all__' defined] (0ms) 2024-07-16 17:39:48.424 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/wsgiref/__init__.py [skipped: no '__all__' defined] (0ms) 2024-07-16 17:39:48.440 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/xml/__init__.py ... 2024-07-16 17:39:48.441 [info] (1616284) [IDX(8)] parsing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/xml/__init__.py [fs read 0ms] (16ms) 2024-07-16 17:39:48.490 [info] (1616284) [IDX(8)] parsing: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 1ms] (48ms) 2024-07-16 17:39:48.505 [info] (1616284) [IDX(8)] binding: file:///local/home/fau-st/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/builtins.pyi (14ms) 2024-07-16 17:39:48.505 [info] (1616284) [IDX(8)] binding: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/xml/__init__.py (0ms) 2024-07-16 17:39:48.506 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/xml/__init__.py [found 0] (82ms) 2024-07-16 17:39:48.506 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/lib/python3.12/xmlrpc/__init__.py [skipped: no '__all__' defined] (0ms) 2024-07-16 17:39:48.507 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages/pip/__init__.py ... 2024-07-16 17:39:48.507 [info] (1616284) [IDX(8)] parsing: file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages/pip/__init__.py [fs read 0ms] (1ms) 2024-07-16 17:39:48.507 [info] (1616284) [IDX(8)] binding: file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages/pip/__init__.py (0ms) 2024-07-16 17:39:48.508 [info] (1616284) [IDX(8)] indexing: file:///local/home/fau-st/.pyenv/versions/3.12.0/envs/pyright_bug/lib/python3.12/site-packages/pip/__init__.py [found 2] (2ms) 2024-07-16 17:39:48.511 [info] (1616284) [IDX(8)] index execution environment file:///local/home/fau-st/temp/pyright_bug [found 732 in 3 files] (90ms) 2024-07-16 17:39:48.511 [info] (1616284) [IDX(8)] index packages file:///local/home/fau-st/temp/pyright_bug [found 732 in 1 exec envs] (97ms) 2024-07-16 17:39:48.511 [info] [Info - 5:39:48 PM] (1616284) indexed(8) 3 files over 1 exec env 2024-07-16 17:39:48.527 [info] [Info - 5:39:48 PM] (1616284) Indexing finished(8). ```
erictraut commented 1 month ago

This is due to the fact that pylance is using a slightly-older version of pyright. Once pylance upgrades to the latest version, you will see the same error in both places.

Your code is using a variable in a type annotation, which is explicitly forbidden by the python typing spec. There was a bug in pyright where it didn't always report this error, and I recently fixed the bug.

Here's the correct way to define this type alias:

MyTypeAlias: TypeAlias = Literal[SomeEnum.ENUM_VALUE] | None

Or using Python 3.12 syntax:

type MyTypeAlias = Literal[SomeEnum.ENUM_VALUE] | None
fau-st commented 1 month ago

Thank you very much for the quick answer :+1: I'm aware this snippet uses invalid constructs, it's from a third party library and I wanted to be sure where the error was coming from. Is CHANGELOG.md the right place to know about the pyright version shipped with pylance or can it be fetched somewhere else?