You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I add exclude_gitignore = true to the [tool.mypy] in the pyproject.toml of numtype, stubtest suddenly fails to find the numpy-stubs, while mypy itself still seems to works. This also occurs with an empty .gitignore.
Note that stubtest runs in an isolated uv environment (tool/stubtest.py), because without it, it doesn't work at all 🤷🏻.
Then running the stubtest command you provided seems to work (no failed to find stubs errors, just PEP 800 issues):
$ uv run --no-project stubtest --allowlist=.mypyignore --mypy-config-file=pyproject.toml --concise scipy
scipy._cyutility.Enum is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy._cyutility.array is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy._cyutility.memoryview is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy._lib._util.Generator is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.cluster._hierarchy.Heap is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.cluster._hierarchy.LinkageUnionFind is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.io.matlab._mio5_utils.VarHeader5 is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.io.matlab._mio5_utils.VarReader5 is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.io.matlab._streams.GenericStream is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.io.matlab._streams.ZlibInputStream is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.optimize._bglu_dense.BGLU is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.optimize._bglu_dense.LU is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial.cKDTree is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial._ckdtree.cKDTree is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial._ckdtree.cKDTreeNode is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial.ckdtree.cKDTree is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial.kdtree.cKDTree is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial.transform.RigidTransform is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial.transform.Rotation is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial.transform._rigid_transform.RigidTransform is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial.transform._rigid_transform.Rotation is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial.transform._rotation.Rotation is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.spatial.transform.rotation.Rotation is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats._biasedurn._PyFishersNCHypergeometric is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats._biasedurn._PyStochasticLib3 is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats._biasedurn._PyStochasticLib3.__init__ is inconsistent, runtime does not have *args parameter "args"
scipy.stats._biasedurn._PyStochasticLib3.__init__ is inconsistent, runtime does not have **kwargs parameter "kwargs"
scipy.stats._biasedurn._PyWalleniusNCHypergeometric is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats._levy_stable.levyst.Nolan is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats._unuran.unuran_wrapper.DiscreteAliasUrn is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats._unuran.unuran_wrapper.DiscreteGuideTable is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats._unuran.unuran_wrapper.Method is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats._unuran.unuran_wrapper.NumericalInverseHermite is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats._unuran.unuran_wrapper.TransformedDensityRejection is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats.sampling.DiscreteAliasUrn is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats.sampling.DiscreteGuideTable is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats.sampling.NumericalInverseHermite is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy.stats.sampling.TransformedDensityRejection is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
I wonder if there might be a .gitignore file in a parent directory that's inferring in an unexpected way?
Would you be able to try running stubtest with this patch applied?
diff --git a/mypy/modulefinder.py b/mypy/modulefinder.py
index d61c9ee3e..bea92795d 100644
--- a/mypy/modulefinder.py+++ b/mypy/modulefinder.py@@ -715,7 +715,7 @@ def matches_gitignore(subpath: str, fscache: FileSystemCache, verbose: bool) ->
if fscache.isdir(relative_path):
relative_path = relative_path + "/"
if gi_spec.match_file(relative_path):
- if verbose:+ if verbose or True:
print(
f"TRACE: Excluding {relative_path} (matches .gitignore) in {gi_path}",
file=sys.stderr,
Hmm yea, your method also doesn't produce any errors for me. When I install scipy-stubs as editable, I don't see the problem. I only see it when I run it like
uv run --no-editable stubtest --allowlist=.mypyignore --mypy-config-file=pyproject.toml scipy
(Usually, for development purposes, I also add a --reinstall-package=scipy-stubs in there, but that shouldn't matter much here.)
The errors disappear when I run
uv run stubtest --allowlist=.mypyignore --mypy-config-file=pyproject.toml scipy
I wonder if there might be a .gitignore file in a parent directory that's inferring in an unexpected way?
doesn't seem to be the case:
$ git status --ignored
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: pyproject.toml
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
.mypy_cache/
.venv/
no changes added to commit (use "git add" and/or "git commit -a")
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
.mypy_cache/
.venv/
Ah, is .venv/ 1) listed in .gitignore and 2) where the stub files are installed? I wonder if mypy's ignoring the stub files since they're in a venv directory that's excluded by .gitignore.
I can reproduce this by installing scipy-stubs into a venv at .venv/ (which is excluded by scipy-stub's .gitignore):
$ uv run --no-project stubtest --allowlist=.mypyignore --mypy-config-file=pyproject.toml --concise scipy
TRACE: Excluding .venv/lib/python3.13/site-packages/scipy-stubs/__config__.pyi (matches .gitignore) in /home/brian/Projects/open-contrib/mypy/temp/scipy-stubs
TRACE: Excluding .venv/lib/python3.13/site-packages/scipy-stubs/__init__.pyi (matches .gitignore) in /home/brian/Projects/open-contrib/mypy/temp/scipy-stubs
<snip>
TRACE: Excluding .venv/lib/python3.13/site-packages/scipy-stubs/stats/ (matches .gitignore) in /home/brian/Projects/open-contrib/mypy/temp/scipy-stubs
TRACE: Excluding .venv/lib/python3.13/site-packages/scipy-stubs/version.pyi (matches .gitignore) in /home/brian/Projects/open-contrib/mypy/temp/scipy-stubs
scipy._lib._util.Generator is a disjoint base at runtime, but isn't marked with @disjoint_base in the stub
scipy._lib.decorator failed to find stubs
scipy._lib.deprecation failed to find stubs
<snip>
scipy.stats._unuran.unuran_wrapper failed to find stubs
scipy.stats.sampling failed to find stubs
I wonder if #20775 might be relevant here? git status --ignored would be misleading in that case, because it (correctly) stops at the top level of the working tree while mypy currently doesn't.
Activity
jorenham commentedon Aug 27, 2025
I'm able to repro this on scipy-stubs with the following command:
Error output (with
--concise):This strange thing is that there are only 43 errors reported, even though there are more than 500 stubbed modules in
scipy-stubs/.Without
exclude_gitignore = trueinpyproject.toml, withexclude_gitignore = false, or without passing--mypy-config-file, this reports no errors.brianschubert commentedon Aug 27, 2025
Hmm, I'm having trouble reproducing this. Here's what I tried:
Then running the stubtest command you provided seems to work (no failed to find stubs errors, just PEP 800 issues):
I wonder if there might be a
.gitignorefile in a parent directory that's inferring in an unexpected way?Would you be able to try running stubtest with this patch applied?
jorenham commentedon Aug 27, 2025
Hmm yea, your method also doesn't produce any errors for me. When I install scipy-stubs as editable, I don't see the problem. I only see it when I run it like
(Usually, for development purposes, I also add a
--reinstall-package=scipy-stubsin there, but that shouldn't matter much here.)The errors disappear when I run
jorenham commentedon Aug 27, 2025
Hmm, that doesn't seem to make any difference for me
jorenham commentedon Aug 27, 2025
doesn't seem to be the case:
brianschubert commentedon Aug 27, 2025
Ah, is
.venv/1) listed in.gitignoreand 2) where the stub files are installed? I wonder if mypy's ignoring the stub files since they're in a venv directory that's excluded by.gitignore.brianschubert commentedon Aug 27, 2025
I can reproduce this by installing
scipy-stubsinto a venv at.venv/(which is excluded by scipy-stub's.gitignore):cjwatson commentedon Feb 9, 2026
I wonder if #20775 might be relevant here?
git status --ignoredwould be misleading in that case, because it (correctly) stops at the top level of the working tree while mypy currently doesn't.