pylance-release
pylance-release copied to clipboard
Auto import doesn't suggest re-exports in stdlib
Environment data
- Language Server version: 2024.4.1
- OS and version: Windows 11 Home (23H2)
- Python version: 3.12.2
Code Snippet
abspath
Repro Steps
- Enable auto-import completions.
- Place cursor after
abspath - Ctrl+Enter
Expected behavior
First suggestion is ntpath.abspath (like altsep & realpath) and can be imported with Tab.
Actual behavior
ntpath.abspath is not in the list:
Logs
2024-04-05 12:05:07.077 [info] (Client) Pylance async client (2024.4.1) started with python extension (2024.4.0)
2024-04-05 12:05:08.584 [info] [Info - 12:05:08 PM] (23876) Pylance language server 2024.4.1 (pyright version 1.1.356, commit 6652c4a8) starting
2024-04-05 12:05:08.586 [info] [Info - 12:05:08 PM] (23876) Server root directory: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist
2024-04-05 12:05:08.587 [info] [Info - 12:05:08 PM] (23876) Starting service instance "src"
2024-04-05 12:05:08.658 [info] (23876) No configuration file found.
2024-04-05 12:05:08.679 [info] (23876) No pyproject.toml file found.
2024-04-05 12:05:08.714 [info] [Info - 12:05:08 PM] (23876) Setting pythonPath for service "src": "C:\Users\wanne\AppData\Local\Programs\Python\Python312\python.exe"
2024-04-05 12:05:08.715 [info] [Info - 12:05:08 PM] (23876) Setting environmentName for service "src": "3.12.2 (global)"
2024-04-05 12:05:08.863 [info] [Info - 12:05:08 PM] (23876) Assuming Python version 3.12.2.final.0
2024-04-05 12:05:08.863 [info] (23876) Assuming Python platform Windows
2024-04-05 12:05:09.123 [info] [Info - 12:05:09 PM] (23876) Search paths for file:///c%3A/Users/wanne/Desktop/src
2024-04-05 12:05:09.124 [info] [Info - 12:05:09 PM] (23876) c:\Users\wanne\.vscode\extensions\ms-python.vscode-pylance-2024.4.1\dist\typeshed-fallback\stdlib
2024-04-05 12:05:09.124 [info] [Info - 12:05:09 PM] (23876) c:\Users\wanne\Desktop\src
2024-04-05 12:05:09.126 [info] [Info - 12:05:09 PM] (23876) c:\Users\wanne\Desktop\src\typings
2024-04-05 12:05:09.127 [info] [Info - 12:05:09 PM] (23876) c:\Users\wanne\.vscode\extensions\ms-python.vscode-pylance-2024.4.1\dist\typeshed-fallback\stubs\...
2024-04-05 12:05:09.128 [info] [Info - 12:05:09 PM] (23876) c:\Users\wanne\.vscode\extensions\ms-python.vscode-pylance-2024.4.1\dist\bundled\stubs
2024-04-05 12:05:09.128 [info] [Info - 12:05:09 PM] (23876) c:\Users\wanne\AppData\Local\Programs\Python\Python312\DLLs
2024-04-05 12:05:09.128 [info] [Info - 12:05:09 PM] (23876) c:\Users\wanne\AppData\Local\Programs\Python\Python312\Lib
2024-04-05 12:05:09.128 [info] [Info - 12:05:09 PM] (23876) c:\Users\wanne\AppData\Local\Programs\Python\Python312
2024-04-05 12:05:09.131 [info] [Info - 12:05:09 PM] (23876) c:\Users\wanne\AppData\Local\Programs\Python\Python312\Lib\site-packages
2024-04-05 12:05:09.136 [info] [Info - 12:05:09 PM] (23876) Adding fs watcher for library directories:
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/DLLs
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/site-packages
2024-04-05 12:05:09.166 [info] [Info - 12:05:09 PM] (23876) Adding fs watcher for directories:
file:///c%3A/Users/wanne/Desktop/src
2024-04-05 12:05:09.168 [info] (23876) Searching for source files
2024-04-05 12:05:09.171 [info] [Info - 12:05:09 PM] (23876) Found 1 source file
2024-04-05 12:05:09.172 [info] (23876) pytest configurations: {"message":"request cancelled","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-04-05 12:05:09.172 [info] (23876) pytest configurations: {"message":"script","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-04-05 12:05:09.237 [info] (23876) [FG] parsing: file:///c%3A/Users/wanne/Desktop/src/main.py (89ms)
2024-04-05 12:05:09.353 [info] (23876) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 3ms] (123ms)
2024-04-05 12:05:09.410 [info] (23876) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/builtins.pyi (52ms)
2024-04-05 12:05:09.410 [info] (23876) [FG] binding: file:///c%3A/Users/wanne/Desktop/src/main.py (0ms)
2024-04-05 12:05:09.659 [info] [Info - 12:05:09 PM] (23876) Background analysis(1) root directory: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist
2024-04-05 12:05:09.664 [info] [Info - 12:05:09 PM] (23876) Background analysis(1) started
2024-04-05 12:05:09.793 [info] (23876) pytest configurations: {"message":"request cancelled","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-04-05 12:05:09.902 [info] (23876) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/src/main.py ...
2024-04-05 12:05:09.902 [info] (23876) [BG(1)] parsing: file:///c%3A/Users/wanne/Desktop/src/main.py (104ms)
2024-04-05 12:05:09.997 [info] (23876) [BG(1)] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 3ms] (94ms)
2024-04-05 12:05:10.048 [info] (23876) [BG(1)] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/builtins.pyi (47ms)
2024-04-05 12:05:10.053 [info] (23876) [BG(1)] binding: file:///c%3A/Users/wanne/Desktop/src/main.py (0ms)
2024-04-05 12:05:10.056 [info] [Info - 12:05:10 PM] (23876) Indexer background runner(2) root directory: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist (index)
2024-04-05 12:05:10.056 [info] [Info - 12:05:10 PM] (23876) Indexing(2) started
2024-04-05 12:05:10.097 [info] (23876) [BG(1)] checking: file:///c%3A/Users/wanne/Desktop/src/main.py ...
2024-04-05 12:05:10.098 [info] (23876) [BG(1)] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 1ms] (30ms)
2024-04-05 12:05:10.113 [info] (23876) [BG(1)] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/typing.pyi (15ms)
2024-04-05 12:05:10.144 [info] (23876) [IDX(2)] scan packages file:///c%3A/Users/wanne/Desktop/src ...
2024-04-05 12:05:10.144 [info] (23876) [IDX(2)] read stdlib indices (79ms)
2024-04-05 12:05:10.158 [info] (23876) [BG(1)] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/types.pyi [fs read 1ms] (24ms)
2024-04-05 12:05:10.166 [info] (23876) [BG(1)] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/types.pyi (9ms)
2024-04-05 12:05:10.186 [info] (23876) [BG(1)] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 1ms] (10ms)
2024-04-05 12:05:10.192 [info] (23876) [BG(1)] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (4ms)
2024-04-05 12:05:10.207 [info] (23876) [BG(1)] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/abc.pyi [fs read 1ms] (3ms)
2024-04-05 12:05:10.207 [info] (23876) [BG(1)] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/abc.pyi (2ms)
2024-04-05 12:05:10.211 [info] (23876) [BG(1)] checking: file:///c%3A/Users/wanne/Desktop/src/main.py (161ms)
2024-04-05 12:05:10.211 [info] (23876) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/src/main.py (414ms)
2024-04-05 12:05:10.217 [info] (23876) [BG(1)] SemanticTokens range 0:0 - 0:7 at file:///c%3A/Users/wanne/Desktop/src/main.py (2ms)
2024-04-05 12:05:10.222 [info] (23876) [BG(1)] SemanticTokens full at file:///c%3A/Users/wanne/Desktop/src/main.py (0ms)
2024-04-05 12:05:10.225 [info] (23876) [BG(1)] indexing: file:///c%3A/Users/wanne/Desktop/src/main.py [found 0] (1ms)
2024-04-05 12:05:10.226 [info] (23876) Indexing Done: file:///c%3A/Users/wanne/Desktop/src/main.py
2024-04-05 12:05:10.227 [info] (23876) pytest configurations: {"message":"script","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-04-05 12:05:10.704 [info] (23876) [BG(1)] SemanticTokens delta previousResultId:1712311510220 at file:///c%3A/Users/wanne/Desktop/src/main.py (0ms)
2024-04-05 12:05:10.906 [info] (23876) [IDX(2)] scan packages file:///c%3A/Users/wanne/Desktop/src (830ms)
2024-04-05 12:05:10.906 [info] [Info - 12:05:10 PM] (23876) scanned(2) 13 files over 1 exec env
2024-04-05 12:05:11.523 [info] (23876) IntelliCode model c:\Users\wanne\.vscode\extensions\visualstudioexptteam.vscodeintellicode-1.3.1\dist\bundledModels\python_intellisense-members-lstm-pylance
2024-04-05 12:05:11.526 [info] [Info - 12:05:11 PM] (23876) SourceFile: Received fs event 'add' for path 'c:\Users\wanne\Desktop\src\.mypy_cache\3.12\@plugins_snapshot.json.6e678d8a5471410d'
2024-04-05 12:05:11.527 [info] [Info - 12:05:11 PM] (23876) SourceFile: Received fs event 'change' for path 'c:\Users\wanne\Desktop\src\.mypy_cache\3.12\@plugins_snapshot.json'
2024-04-05 12:05:11.528 [info] [Info - 12:05:11 PM] (23876) SourceFile: Received fs event 'change' for path 'c:\Users\wanne\Desktop\src\.mypy_cache\3.12\@plugins_snapshot.json.6e678d8a5471410d'
2024-04-05 12:05:11.699 [info] (23876) [IDX(2)] index packages file:///c%3A/Users/wanne/Desktop/src ...
2024-04-05 12:05:11.699 [info] (23876) [IDX(2)] index execution environment file:///c%3A/Users/wanne/Desktop/src ...
2024-04-05 12:05:11.700 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/concurrent/__init__.py [skipped: no '__all__' defined] (1ms)
2024-04-05 12:05:11.700 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/idlelib/__init__.py [skipped: no '__all__' defined] (0ms)
2024-04-05 12:05:11.700 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/lib2to3/__init__.py [skipped: no '__all__' defined] (0ms)
2024-04-05 12:05:11.700 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/pydoc_data/__init__.py [skipped: no '__all__' defined] (0ms)
2024-04-05 12:05:11.700 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/test/__init__.py [skipped: no '__all__' defined] (1ms)
2024-04-05 12:05:11.701 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/turtledemo/__init__.py [skipped: no '__all__' defined] (0ms)
2024-04-05 12:05:11.701 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/urllib/__init__.py [skipped: no '__all__' defined] (0ms)
2024-04-05 12:05:11.701 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/wsgiref/__init__.py [skipped: no '__all__' defined] (0ms)
2024-04-05 12:05:11.701 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/xmlrpc/__init__.py [skipped: no '__all__' defined] (0ms)
2024-04-05 12:05:11.701 [info] (23876) [IDX(2)] indexing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/__phello__/__init__.py [skipped: no '__all__' defined] (0ms)
2024-04-05 12:05:11.701 [info] (23876) [IDX(2)] index execution environment file:///c%3A/Users/wanne/Desktop/src [found 732 in 3 files] (15ms)
2024-04-05 12:05:11.702 [info] (23876) [IDX(2)] index packages file:///c%3A/Users/wanne/Desktop/src [found 732 in 1 exec envs] (22ms)
2024-04-05 12:05:11.702 [info] [Info - 12:05:11 PM] (23876) indexed(2) 3 files over 1 exec env
2024-04-05 12:05:11.740 [info] [Info - 12:05:11 PM] (23876) Indexing finished(2).
2024-04-05 12:05:12.354 [info] (23876) Loading ONNX runtime...
2024-04-05 12:05:12.354 [info] (23876) Loaded ONNX runtime. Creating IntelliCode session...
2024-04-05 12:05:12.504 [info] 2024-04-05 12:05:12.503578 [I:onnxruntime:, inference_session.cc:328 operator()] Flush-to-zero and denormal-as-zero are off
2024-04-05 12:05:12.505 [info] 2024-04-05 12:05:12.504951 [I:onnxruntime:, inference_session.cc:336 ConstructorCommon] Creating and using per session threadpools since use_per_session_threads_ is true
2024-04-05 12:05:12.505090 [I:onnxruntime:, inference_session.cc:354 ConstructorCommon] Dynamic block base set to 0
2024-04-05 12:05:12.565 [info] 2024-04-05 12:05:12.565732 [I:onnxruntime:, inference_session.cc:1400 Initialize] Initializing session.
2024-04-05 12:05:12.565885 [I:onnxruntime:, inference_session.cc:1437 Initialize] Adding default CPU execution provider.
2024-04-05 12:05:12.612 [info] 2024-04-05 12:05:12.612345 [I:onnxruntime:, graph.cc:3556 CleanUnusedInitializersAndNodeArgs] Removing initializer 'pred_embedding_to_output_layer/einsum_1/mul/x:0'. It is no longer used by any node.
2024-04-05 12:05:12.625 [info] 2024-04-05 12:05:12.625697 [I:onnxruntime:, graph.cc:3619 CleanUnusedInitializersAndNodeArgs] Removing NodeArg 'rnn/transpose'. It is no longer used by any node.
2024-04-05 12:05:12.626 [info] 2024-04-05 12:05:12.625886 [I:onnxruntime:, graph.cc:3619 CleanUnusedInitializersAndNodeArgs] Removing NodeArg 'Gather_out0'. It is no longer used by any node.
2024-04-05 12:05:12.625984 [I:onnxruntime:, graph.cc:3619 CleanUnusedInitializersAndNodeArgs] Removing NodeArg 'Transpose_out0'. It is no longer used by any node.
2024-04-05 12:05:12.678 [info] 2024-04-05 12:05:12.678149 [V:onnxruntime:, session_state.cc:1142 VerifyEachNodeIsAssignedToAnEp] Node placements
2024-04-05 12:05:12.678 [info] 2024-04-05 12:05:12.678364 [V:onnxruntime:, session_state.cc:1145 VerifyEachNodeIsAssignedToAnEp] All nodes placed on [CPUExecutionProvider]. Number of nodes: 56
2024-04-05 12:05:12.690 [info] 2024-04-05 12:05:12.690220 [V:onnxruntime:, session_state.cc:126 CreateGraphInfo] SaveMLValueNameIndexMapping
2024-04-05 12:05:12.692 [info] 2024-04-05 12:05:12.692330 [V:onnxruntime:, session_state.cc:172 CreateGraphInfo] Done saving OrtValue mappings.
2024-04-05 12:05:12.693 [info] 2024-04-05 12:05:12.693131 [I:onnxruntime:, allocation_planner.cc:2401 CreateGraphPartitioner] Use DeviceBasedPartition as default
2024-04-05 12:05:12.697 [info] 2024-04-05 12:05:12.697512 [I:onnxruntime:, session_state_utils.cc:201 SaveInitializedTensors] Saving initialized tensors.
2024-04-05 12:05:12.720 [info] 2024-04-05 12:05:12.720427 [I:onnxruntime:, session_state_utils.cc:345 SaveInitializedTensors] Done saving initialized tensors
2024-04-05 12:05:12.731 [info] 2024-04-05 12:05:12.726353 [I:onnxruntime:, inference_session.cc:1774 Initialize] Session successfully initialized.
2024-04-05 12:05:12.731 [info] (23876) Created IntelliCode session.
2024-04-05 12:05:12.732 [info] (23876) Initialize deeplearning succeeded
2024-04-05 12:05:15.640 [info] (23876) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 1ms] (19ms)
2024-04-05 12:05:15.653 [info] (23876) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/typing.pyi (12ms)
2024-04-05 12:05:15.674 [info] (23876) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/types.pyi [fs read 0ms] (8ms)
2024-04-05 12:05:15.681 [info] (23876) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/types.pyi (7ms)
2024-04-05 12:05:15.722 [info] (23876) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 0ms] (10ms)
2024-04-05 12:05:15.726 [info] (23876) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (4ms)
2024-04-05 12:05:15.735 [info] (23876) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/abc.pyi [fs read 1ms] (2ms)
2024-04-05 12:05:15.735 [info] (23876) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/typeshed-fallback/stdlib/abc.pyi (1ms)
2024-04-05 12:05:15.741 [info] (23876) IntelliCode: current invocation did not produce any meaningful tokens.
2024-04-05 12:05:15.741 [info] (23876) Time taken to get recommendations: 1 ms, Memory increase: 52 KB.
@KacieKK, could you look into this?
Hey @nineteendo, Thanks for reporting this issue. In .pyi file abspath is imported as alias and we currently not supporting alias in auto -import yet. It's about "import as" no matter public or private libs. This will be an enhancement ask. I will close this one as duplicate since it's a subitem of https://github.com/microsoft/pylance-release/issues/5434. Please track that ticket for progress.
I think this is different issue. this is due to us shipping pregenerated indices for stdlib. but looks like python.analysis.regenerateStdLibIndices: true doesn't work for platform specific symbols.
let me take a look