pylance-release
pylance-release copied to clipboard
Ignoring *.ipynb files does not work
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.
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 - ah ok, that makes sense. Thanks for clarifying this and I'll be hoping for a fix in pylance.
@judej we should discuss whether we should consider ipynb (opened in vscode) as something affected by pyrightconfig or mspythonconfig.json
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.
This issue has been fixed in version 2022.8.51, which we've just released. You can find the changelog here: CHANGELOG.md