Repository navigation
fix: autodetect src layouts without overriding explicit search paths - #222
Merged
chrapkowski-sg merged 4 commits intoNov 2, 2026
Merged
Conversation
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>
chrapkowski-sg
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #221.
Enable automatic
srcsearch-path detection for projects without explicit search-path configuration. An unconfigured layout such as this must connect imports to their definitions:Without the fallback, definitions can use
src.demo.corewhile imports fail to resolvedemo.core. With it, definitions and the two imported/runtime references sharedemo.core/handler()..Configuration behavior
Apply autodetection after configuration initialization, only when both default extra paths and execution environments are absent. Preserve explicit
extraPaths, including[], and execution-environment search order. Even a root-only execution environment conservatively suppresses this fallback. Asrcdirectory containing__init__.pyremains a package rather than an automatic search root.The original report compared newer upstream Pyright 1.1.411 with scip-python. This change uses the vendored API and deliberately does not copy newer CLI behavior unconditionally: prepending
srccan otherwise shadow explicitly configured environment paths.Verification
src/__init__.py.src.prefix.