basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

exclude does not work for jupyter notebooks

Open jscheel opened this issue 11 months ago • 6 comments

Description

Specifically excluding a notebook with exclude will still result in the notebook being analyzed.

Sample config:

"exclude": [
    "tmp*/**",
    "data/**",
    "**/node_modules",
    "**/__pycache__",
    "**/.*",
    "test.ipynb"
  ]

jscheel avatar Mar 12 '25 22:03 jscheel

Interestingly, even if I specify an include and target a subdirectory, it still gets the notebook from the root directory.

jscheel avatar Mar 12 '25 22:03 jscheel

use ignore instead. i want to merge these two options into one because the current behavior is quite confusing. see #31

DetachHead avatar Mar 16 '25 12:03 DetachHead

closing in favor of #31

DetachHead avatar Apr 19 '25 09:04 DetachHead

@DetachHead even using the exclude and ignore, I still see it analyzing ipynb files. Even if I specify the exact filename without wildcards, I still see it analyzing in the log traces.

jscheel avatar May 09 '25 21:05 jscheel

I wonder if it has something to do with processing each cell individually?

jscheel avatar May 10 '25 14:05 jscheel

i can't reproduce. could you provide some more info please:

  • does it happen in the language server, CLI or both?
  • if it happens in the language server, what editor are you using?
  • does ignore work for you with regular .py files?
  • what version of basedpyright are you using?

DetachHead avatar May 11 '25 13:05 DetachHead

Hi, I have the same issue with the language server with:

[tool.pyright]
ignore = ["*.ipynb"]
"basedpyright.analysis.ignore": [
    "*.ipynb",
    "*.py"
]
Image

Using:

Identifier: detachhead.basedpyright
Version: 1.29.5

With ignore = ["*.ipynb", "*.py"] I still get basedpyright reports in the IDE on regular .py files.


Ok, so Cursor still uses VScode: 1.99.3. Last compatible basedpyright for this VSCode version is 1.29.5. I guess that doesn't help.

RobinFrcd avatar Sep 24 '25 12:09 RobinFrcd

that's probably a different issue. can you provide the full error message?

DetachHead avatar Sep 26 '25 11:09 DetachHead

Sure:

File length of "file:///....ipynb" is 61290525 which exceeds the maximum supported file size of 52428800

Source: BasedPyright

RobinFrcd avatar Oct 03 '25 13:10 RobinFrcd

that's definitely unrelated, the max file size supported by pyright is 50mb https://github.com/DetachHead/basedpyright/blob/cfc20e6b25e46affa67b35eae5eaab21b4e2b533/packages/pyright-internal/src/analyzer/sourceFile.ts#L61-L63

if you believe this limit should be increased you can open a separate issue to discuss it, but i highly recommend splitting that notebook up into separate files instead.

DetachHead avatar Oct 04 '25 06:10 DetachHead

closing this for now as i still don't have enough info to reproduce the original issue so i'm assuming it's the same issue as #31. if anybody can help me reproduce this by providing the info i requested above i'll be happy to reopen

DetachHead avatar Oct 04 '25 06:10 DetachHead

@RobinFrcd if your issue is "I tried to ignore a file, but it still reported as too big", can you please report this as a separate issue, as it sounds like an unrelated issue to this issue

KotlinIsland avatar Oct 04 '25 08:10 KotlinIsland

Regardless of the size of the file, if I want to ignore all .ipynb BasedPyright should just skip them, no ?

RobinFrcd avatar Oct 04 '25 09:10 RobinFrcd

oh sorry i misunderstood what you were asking. so the issue in #31 is that the exclude setting is ignored by the language server, while ignore works. but all ignore does is filter out any diagnostics reported for that file. this means that any ignored files still need to be parsed for other language server features to work, which is why you're still seeing that error.

DetachHead avatar Oct 04 '25 09:10 DetachHead