python-lsp-compare
Copilot instructions6 starsChanged 8 months agoMITView on GitHub
python-lsp-compare is a benchmark and regression harness for Python LSP servers. It downloads servers, runs LSP scenarios over stdio JSON-RPC, captures timing/payload metrics, and produces comparison reports. Pure Python, zero external dependencies. All source lives under src/python_lsp_compare/. Key modules and data flow: - **server_download.py** — Downloads servers from GitHub releases (ServerSpec) or installs into isolated venvs from PyPI (PypiServerSpec). Caches binaries under .python-lsp-compare/servers/. Version checks cached 24h in versions.json. Functions return tuple[Path, str] (executable path + version label). - **server_configs.py**…
- Installs packages
The file
We split this copilot-instructions.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
All source lives under src/python_lsp_compare/.
- Very specific: line 59
No dev dependencies are required — tests use only stdlib unittest and pytest.
- Very specific: line 63
Zero external dependencies: All HTTP downloads use urllib.request.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Project Guidelines
Overview
python-lsp-compare is a benchmark and regression harness for Python LSP servers.
It downloads servers, runs LSP scenarios over stdio JSON-RPC, captures timing/payload
metrics, and produces comparison reports. Pure Python, zero external dependencies.
Architecture
All source lives under src/python_lsp_compare/. Key modules and data flow:
server_download.py → server_configs.py → runner.py → report_markdown.py
(download/cache) (ConfiguredServer) (LSP I/O) report_csv.py
server_versions.py- server_download.py — Downloads servers from GitHub releases (
ServerSpec) or installs into isolated venvs from PyPI (PypiServerSpec). Caches binaries under.python-lsp-compare/servers/. Version checks cached 24h inversions.json. Functions returntuple[Path, str](executable path + version label). - server_configs.py —
ConfiguredServerdataclass wraps a server binary with its launch command, args, and optionalversion_label. - server_versions.py — Detects version info for reports. Uses
version_labelwhen present (downloaded servers), falls back to git for local dev builds. - runner.py — Starts LSP server processes, sends JSON-RPC over stdio, measures
latency. Sends
workspace/didChangeConfigurationafterinitialized(required by Pyright). - lsp_client.py / transport.py — Low-level LSP framing and JSON-RPC protocol.
- cli.py — Entry point. Subcommands:
run,run-servers,bench-servers,run-benchmark,render-report,list-scenarios,list-benchmarks,list-servers,download-servers. - report_markdown.py / report_csv.py — Render comparison tables from JSON results.
- environments.py — Creates per-benchmark-suite
.venvwith suite requirements. - benchmark_suites.py — Discovers suites under
benchmarks/with config.json. - scenarios/ — Individual LSP test scenarios (hover, completion, etc.).
Servers
Four servers are benchmarked by default (defined in server_download.py):
| Server | Type | Notes |
| Pyright | ServerSpec (GitHub release, Node.js) | Needs node on PATH |
| Ty | ServerSpec (GitHub release, native) | |
| Pyrefly | ServerSpec (GitHub release, native) | Uses --indexing-mode lazy-blocking --build-system-blocking |
| pylsp-mypy | PypiServerSpec (PyPI venv) | Installs python-lsp-server + pylsp-mypy; hover/completion come from Jedi, only diagnostics from mypy |
Build & Test
python -m venv .venv
pip install -e . # install in editable mode
python -m pytest tests/ -x -q # run all tests (26 tests, ~15s)
python -m python_lsp_compare bench-servers # full benchmark run (downloads servers if needed)No dev dependencies are required — tests use only stdlib unittest and pytest.
Key Conventions
- Zero external dependencies. All HTTP downloads use
urllib.request. Do not add packages todependenciesin pyproject.toml. - Python 3.11+. Uses
matchstatements,str | Noneunions,dataclasses. - Return tuples consistently.
download_server()andinstall_pypi_server()return(path, version_label). All code paths (including cache-hit early returns) must return the same shape. - Server failures are informational.
handle_run_serversandhandle_bench_serversalways return exit code 0. Individual server failures are logged but don't fail the overall run. - Benchmark results go to
results/. The_update_latest_results()function also copies tolatest-results/for the committed snapshot. - No
.python-lsp-compare/in git. Server binaries and version caches live there but are gitignored.
File Layout
benchmarks/— Benchmark suites (each hasconfig.json,requirements.txt,src/)configs/— Example server config files for--configflagresults/— Output directory (gitignored exceptlatest-results/)tools/— Utility scripts (e.g. Pyright stdio launcher)tests/— Pytest tests; fixtures intests/fixtures/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

