Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pylance does not recognize use of imported function in a Jupyter notebook cell that contains a %% command #4629

Closed
gro1m opened this issue Jul 19, 2023 · 1 comment
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@gro1m
Copy link

gro1m commented Jul 19, 2023

Environment data

  • Language Server version: v2023.7.20
  • OS and version: Linux Ubuntu 20.04.1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.16 (conda: 23.3.1)

Code Snippet

It is difficult to provide minimal, self-contained code here, as it relates to Jupyter Notebook cells.

1st Jupyter notebook code cell:

from utils import A

2nd Jupyter notebook code cell:

%%time
B = A()

In this case, in 1st Jupyter notebook code cell function A will be greyed out and upon hovering over the greyed out A, I get the mesage:
"A" is not accessed Pylance

Also in subsequent Jupyter notebook code cells, B is not recognized as a defined variable.

I have the feeling, it has to do with the fact that it is a magic cell.

Repro Steps

See above

  1. XXX

Expected behavior

Imported function should also be recognized in magic cells as being accessed and subsequent use of the assigned variable should be detected.

Actual behavior

Imported function is not recognized as being accessed in a magic cell and subsequent use of the assigned variable is not detected.

Logs

XXX
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Jul 19, 2023
@rchiodo
Copy link
Contributor

rchiodo commented Jul 19, 2023

Thanks for the issue. It is indeed because it's a magic cell. We don't currently support magics very well as we just ignore the entire cell.

There is already a discussion here to support magics:
#3851

Feel free to upvote the discussion.

@rchiodo rchiodo closed this as completed Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants