pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

v2024.5.1: Resolving the import of non-"third party" modules

Open SDiWK opened this issue 1 year ago • 8 comments

Type: Bug

Pylance v2024.5.1 appears to have a bug related to resolving the import of classes/modules which are not "third-party". In v2024.4.1 this issue doesn't occur: the same modules whose import could not be resolved using the newer version v2024.5.1 of Pylance, do not present a problem using the older version v2024.4.1.

Extension version: 2025.4.1 VS Code version: Code 1.89.0 (b58957e67ee1e712cebf466b995adf4c5307b2bd, 2024-05-01T02:09:22.859Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-12800H (20 x 2803)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 63.67GB (52.96GB free)
Process Argv --crash-reporter-id 0c90dd25-ab31-4ec1-bec4-ccfef9fc48c3
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
vscaat:30438848
c4g48928:30535728
azure-dev_surveyonecf:30548226
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
showvideot:31016892
chatpanelc:31018788
dsvsc021:30996838
724cj586:31013169
fchga941:31038042
pythonprt:31039817
dwnewjupytercf:31039676

SDiWK avatar May 08 '24 12:05 SDiWK

might be dupe of https://github.com/microsoft/pylance-release/issues/5836

but that said, it would be nice to have more detail repro steps

heejaechang avatar May 08 '24 16:05 heejaechang

@SDiWK, can you please provide repro steps with code, required packages (inc. versions), etc?

debonte avatar May 09 '24 17:05 debonte

@SDiWK, can you please provide repro steps with code, required packages (inc. versions), etc?

@debonte, @heejaechang: shared repro code via repository SDiWK/5861

(very simple setting: using v2024.5.1 import of class A can't be resolved)

Hope this helps. Thanks and kind regards :-)

SDiWK avatar May 13 '24 09:05 SDiWK

@SDiWK github says I dont have access to the repository.

heejaechang avatar May 13 '24 16:05 heejaechang

@heejaechang Can't say why you ran into trouble accessing it. Sorry for the inconvenience. I just made the repository public. There doesn't seem to be a point in restricting access anyway, in this case.

SDiWK avatar May 14 '24 08:05 SDiWK

we are talking about this right? https://github.com/SDiWK/5861/tree/main

it has only 2 files in it

A.py
class A:
    
    def __init__():
        pass
    
B.py
from A import A

class B(A):
    
    def __init__():
        pass

there is only 1 import statement from A import A. so I assume you are referring that import statement?

for me, it works fine.

can you provide us some logs as described in the troubleshooting guide?

I need to see your settings and env to find out why it didn't work for you.

heejaechang avatar May 14 '24 15:05 heejaechang

I think, before submitting the logs I should further elaborate a bit:

In my use case I've had the impression that my class (here B) which incorporates a class A, say, doesn't have access to the methods/members of A, even though it should, at least I expected so, as A is imported. To be more precise about what "have access" means: What's puzzling me -- B does run, however, during coding, VS Code doesn't provide the members of A for "autocomplete".

I think I need to refine my reproduction setting, in order to pinpoint what I meant, and then recur with more detailed information as outlined by you. Many thanks for your time so far.

SDiWK avatar May 15 '24 09:05 SDiWK

if from A import A didn't work properly (such as pylance couldn't resolve either A), then A in import A will be unknown symbol. so pylance won't be able to provide anything off it such as autocomplete after A.

heejaechang avatar May 15 '24 12:05 heejaechang

no response. will close it

heejaechang avatar Mar 28 '25 23:03 heejaechang