Problem
AFT's bundled Pyright LSP (~/.cache/aft/lsp-packages/pyright/, v1.1.410) does not resolve packages installed in a project virtualenv, producing false-positive Import "X" could not be resolved errors — even when pyrightconfig.json is correctly configured with venvPath, venv, and extraPaths.
Environment
- OS: macOS 15 (darwin)
- Python: 3.14.5 (via Homebrew)
- Project venv:
.venv/ (created with python3 -m venv .venv)
- AFT LSP cache:
~/.cache/aft/lsp-packages/pyright/node_modules/pyright/ (v1.1.410)
- Package:
aioslsk v1.6.3 installed in .venv/lib/python3.14/site-packages/
Reproduction
-
Create a Python project with a venv containing a package not in the system Python:
python3 -m venv .venv
.venv/bin/pip install aioslsk
-
Create pyrightconfig.json at the project root:
{
"venvPath": "/absolute/path/to/project",
"venv": ".venv",
"pythonVersion": "3.14",
"include": ["src"],
"extraPaths": ["/absolute/path/to/project/.venv/lib/python3.14/site-packages"],
"reportMissingImports": "error"
}
-
Import the venv-only package in a .py file:
from aioslsk.client import SoulSeekClient
-
Run aft_inspect on the file — AFT reports:
error Import "aioslsk.client" could not be resolved [Pyright]
Evidence that these are false positives
Both standalone Pyright and basedpyright resolve the imports correctly with the same config:
$ npx pyright --project pyrightconfig.json src/soulseek.py
0 errors, 0 warnings, 0 informations
$ basedpyright --project pyrightconfig.json src/soulseek.py
# (no import errors — only strictness warnings from basedpyright)
The package exists at the configured path:
$ ls .venv/lib/python3.14/site-packages/aioslsk/client.py
.venv/lib/python3.14/site-packages/aioslsk/client.py
What I tried
1. pyrightconfig.json with extraPaths (relative paths)
{ "extraPaths": [".venv/lib/python3.14/site-packages"] }
Result: AFT still reports import errors. npx pyright works.
2. pyrightconfig.json with absolute paths
{ "extraPaths": ["/Users/djtchill/Documents/Projects/CDJeez/.venv/lib/python3.14/site-packages"] }
Result: AFT still reports import errors. npx pyright works.
3. [tool.pyright] in pyproject.toml
[tool.pyright]
venvPath = "."
venv = ".venv"
extraPaths = [".venv/lib/python3.14/site-packages"]
Result: AFT still reports import errors.
4. .opencode/lsp.json — disable bundled pyright, enable basedpyright
{
"lsp": {
"basedpyright": { "priority": 100 },
"ruff": { "priority": 90 },
"pyright": { "disabled": true }
}
}
Result: AFT diagnostics still say [Pyright] (not [basedpyright]), suggesting the bundled pyright is still being used despite the disabled: true config. The .opencode/lsp.json config may not be read by AFT's diagnostic engine, or AFT may need a restart to pick up LSP config changes.
5. .opencode/lsp.json — initialization options with extraPaths and pythonPath
{
"lsp": {
"basedpyright": {
"priority": 100,
"env": { "PYTHONPATH": "/path/.venv/lib/python3.14/site-packages" },
"initialization": {
"settings": {
"python": { "pythonPath": "/path/.venv/bin/python3" },
"basedpyright": { "analysis": { "extraPaths": ["/path/.venv/lib/python3.14/site-packages"] } }
}
}
},
"pyright": { "disabled": true }
}
}
Result: AFT still uses bundled pyright, still reports import errors.
Current workaround
Targeted # type: ignore[import-not-found] on each affected import line:
from aioslsk.client import SoulSeekClient # type: ignore[import-not-found]
This suppresses only the specific false-positive import errors on those lines — any other missing import in the file is still reported. This is surgical but fragile: if AFT later starts reading the config, these comments become unnecessary noise.
Expected behavior
AFT's bundled Pyright should read pyrightconfig.json (or [tool.pyright] in pyproject.toml) from the project root and resolve venv-installed packages via venvPath/venv/extraPaths. Alternatively, if AFT supports switching to a user-installed LSP (basedpyright), the .opencode/lsp.json disabled: true should prevent the bundled pyright from running.
Questions
- Does AFT's diagnostic engine pass the workspace root to the bundled Pyright LSP? If not, Pyright won't find
pyrightconfig.json.
- Does
.opencode/lsp.json pyright: { disabled: true } actually prevent AFT from using the bundled pyright? If not, is there another way to switch to basedpyright?
- Is a session/AFT restart required for
.opencode/lsp.json changes to take effect?
Problem
AFT's bundled Pyright LSP (
~/.cache/aft/lsp-packages/pyright/, v1.1.410) does not resolve packages installed in a project virtualenv, producing false-positiveImport "X" could not be resolvederrors — even whenpyrightconfig.jsonis correctly configured withvenvPath,venv, andextraPaths.Environment
.venv/(created withpython3 -m venv .venv)~/.cache/aft/lsp-packages/pyright/node_modules/pyright/(v1.1.410)aioslskv1.6.3 installed in.venv/lib/python3.14/site-packages/Reproduction
Create a Python project with a venv containing a package not in the system Python:
Create
pyrightconfig.jsonat the project root:{ "venvPath": "/absolute/path/to/project", "venv": ".venv", "pythonVersion": "3.14", "include": ["src"], "extraPaths": ["/absolute/path/to/project/.venv/lib/python3.14/site-packages"], "reportMissingImports": "error" }Import the venv-only package in a
.pyfile:Run
aft_inspecton the file — AFT reports:Evidence that these are false positives
Both standalone Pyright and basedpyright resolve the imports correctly with the same config:
$ npx pyright --project pyrightconfig.json src/soulseek.py 0 errors, 0 warnings, 0 informations $ basedpyright --project pyrightconfig.json src/soulseek.py # (no import errors — only strictness warnings from basedpyright)The package exists at the configured path:
What I tried
1.
pyrightconfig.jsonwithextraPaths(relative paths){ "extraPaths": [".venv/lib/python3.14/site-packages"] }Result: AFT still reports import errors.
npx pyrightworks.2.
pyrightconfig.jsonwith absolute paths{ "extraPaths": ["/Users/djtchill/Documents/Projects/CDJeez/.venv/lib/python3.14/site-packages"] }Result: AFT still reports import errors.
npx pyrightworks.3.
[tool.pyright]inpyproject.tomlResult: AFT still reports import errors.
4.
.opencode/lsp.json— disable bundled pyright, enable basedpyright{ "lsp": { "basedpyright": { "priority": 100 }, "ruff": { "priority": 90 }, "pyright": { "disabled": true } } }Result: AFT diagnostics still say
[Pyright](not[basedpyright]), suggesting the bundled pyright is still being used despite thedisabled: trueconfig. The.opencode/lsp.jsonconfig may not be read by AFT's diagnostic engine, or AFT may need a restart to pick up LSP config changes.5.
.opencode/lsp.json— initialization options withextraPathsandpythonPath{ "lsp": { "basedpyright": { "priority": 100, "env": { "PYTHONPATH": "/path/.venv/lib/python3.14/site-packages" }, "initialization": { "settings": { "python": { "pythonPath": "/path/.venv/bin/python3" }, "basedpyright": { "analysis": { "extraPaths": ["/path/.venv/lib/python3.14/site-packages"] } } } } }, "pyright": { "disabled": true } } }Result: AFT still uses bundled pyright, still reports import errors.
Current workaround
Targeted
# type: ignore[import-not-found]on each affected import line:This suppresses only the specific false-positive import errors on those lines — any other missing import in the file is still reported. This is surgical but fragile: if AFT later starts reading the config, these comments become unnecessary noise.
Expected behavior
AFT's bundled Pyright should read
pyrightconfig.json(or[tool.pyright]inpyproject.toml) from the project root and resolve venv-installed packages viavenvPath/venv/extraPaths. Alternatively, if AFT supports switching to a user-installed LSP (basedpyright), the.opencode/lsp.jsondisabled: trueshould prevent the bundled pyright from running.Questions
pyrightconfig.json..opencode/lsp.jsonpyright: { disabled: true }actually prevent AFT from using the bundled pyright? If not, is there another way to switch to basedpyright?.opencode/lsp.jsonchanges to take effect?