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

Ignoring *.ipynb files does not work #2135

Closed
taldcroft opened this issue Dec 3, 2021 · 5 comments
Closed

Ignoring *.ipynb files does not work #2135

taldcroft opened this issue Dec 3, 2021 · 5 comments
Assignees
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version notebooks

Comments

@taldcroft
Copy link

Describe the bug
Here is my pyrightconfig.json file:

{
  "ignore": [
    "**/commands_archive.py",
    "**/*.ipynb"
  ]
}

I confirmed that the commands_archive.py is ignored (as expected) by introducing an error in that file and noting that the error is not reported. However, the Jupyter notebooks in my project are not ignored and generate a large number of errors:

To Reproduce
Using VS code, create a Jupyter notebook and include that pyrightconfig.json in the project.

Expected behavior
No Pylance / pyright errors should be reported for any file named *.ipynb.

VS Code extension or command-line
Running as a VS Code extension Pyright version v1.1.192.

@erictraut
Copy link
Contributor

This happens because pyright doesn't see the file as a "*.ipynb". The file is being preprocessed (to combine all of the cells) in the notebook by the VS Code Python extension, and the resulting combined file is then passed to pyright for analysis.

The pylance team is actively working on changing the way this works. I'm going to transfer this bug to the pylance-release repo so it gets the attention it deserves.

@erictraut erictraut transferred this issue from microsoft/pyright Dec 3, 2021
@github-actions github-actions bot added the triage label Dec 3, 2021
@taldcroft
Copy link
Author

@erictraut - ah ok, that makes sense. Thanks for clarifying this and I'll be hoping for a fix in pylance.

@judej judej added the notebooks label Dec 6, 2021
@github-actions github-actions bot removed the triage label Dec 6, 2021
@heejaechang
Copy link
Contributor

@judej we should discuss whether we should consider ipynb (opened in vscode) as something affected by pyrightconfig or mspythonconfig.json

@debonte debonte self-assigned this Jun 9, 2022
@debonte
Copy link
Contributor

debonte commented Aug 23, 2022

Still doesn't work with LSP notebooks because each cell is treated as its own file and those "fake" cell paths have additional data after the .ipynb extension.

While waiting for a fix you could work around this issue by ignoring "**/*.ipynb*" instead.

@debonte debonte added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Aug 26, 2022
@bschnurr
Copy link
Member

bschnurr commented Sep 1, 2022

This issue has been fixed in version 2022.8.51, which we've just released. You can find the changelog here: CHANGELOG.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version notebooks
Projects
None yet
Development

No branches or pull requests

6 participants