pyright's own CLI sets `autoSearchPaths = true` unconditionally
("Always enable autoSearchPaths when using the command line",
pyright-internal/src/common/configOptions.ts consumer in pyright.ts).
scip-python replaces that entry point and never sets the field, so
`commandLineOptions.autoSearchPaths || false` is always false and
ensureDefaultExtraPaths() never adds ./src.
The effect is silent: for a src-layout project with no [tool.pyright]
section, definitions are emitted under `src.pkg.mod` while imports
resolve to `pkg.mod`, so every reference from outside src/ is dropped
from the index. The run exits 0 and the index is simply smaller.
An explicit extraPaths still takes precedence, so projects that already
configure pyright are unaffected.
Fixes sourcegraph#221
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fixes #221.
scip-python builds its own CommandLineOptions and never sets autoSearchPaths, so
ensureDefaultExtraPaths() never adds ./src. pyright's CLI sets it unconditionally:
Since pyright-scip replaces that entry point, the setting is lost, and src-layout projects
index with definitions under src.pkg.mod while imports resolve to pkg.mod. The two namespaces
never join, so cross-package references are dropped. The run exits 0 and the index is just smaller.
Verification
Minimal project, no [tool.pyright] section:
Before — the reference to handler is absent entirely:
src/demo/core.py def: scip-python python demo 0.1.0 `src.demo.core`/handler(). tests/test_core.py ref: scip-python python demo 0.1.0 `demo.core`/__init__:After (equivalently, with extraPaths = ["src"] set manually on 0.6.6):
src/demo/core.py def: scip-python python demo 0.1.0 `demo.core`/handler(). tests/test_core.py ref: scip-python python demo 0.1.0 `demo.core`/handler(). ref: scip-python python demo 0.1.0 `demo.core`/handler().For comparison, pyright itself resolves this tree with no configuration at all — same directory,
no [tool.pyright]:
$ npx pyright@latest --outputjson { "summary": { "filesAnalyzed": 3, "errorCount": 0, ... } }So pyright and scip-python currently disagree about the same project.
Safety
ensureDefaultExtraPaths applies autoSearchPaths and explicit extraPaths independently, and
the auto-detected path is only added when ./src exists and is not itself a package
(src/__init__.py absent). Projects that already configure extraPaths in pyrightconfig.json
or [tool.pyright] are unaffected; projects with a src package directory are unaffected.
Note on tests
I did not add a snapshot fixture. A snapshots/input/src_layout/ case (a src/-rooted package
plus an importer outside src/) would cover this well, but the expected output has to come from
npm run update-snapshots against a build, and I would rather not hand-write generated output I
can't verify. Happy to add it if you'd like — just say the word and I'll build and generate it
properly.
Environment