@@ -9,9 +9,9 @@ Always use `uv` for Python operations:
99``` bash
1010# Run tests
1111uv run pytest # All tests
12- uv run pytest tests/test_pool.py # Generic pool tests
13- uv run pytest tests/test_pyright/ # Pyright-specific tests
14- uv run pytest tests/test_pool.py::TestLSPProcessPool::test_name -v # Single pool test
12+ uv run pytest tests/test_pool.py # Pool tests
13+ uv run pytest tests/test_session.py # Session tests
14+ uv run pytest tests/test_pool.py::TestLSPProcessPool::test_name -v # Single test
1515
1616# Generate latest LSP types (full pipeline)
1717make generate-latest-types # Downloads schemas + generates all types
@@ -25,7 +25,7 @@ make generate-types # Generate final type definitions
2525
2626## Architecture Overview
2727
28- This is a zero -dependency Python library providing typed LSP (Language Server Protocol) interfaces with optional process management.
28+ This is a minimal -dependency Python library providing typed LSP (Language Server Protocol) interfaces with optional process management.
2929
3030### Core Components
3131
@@ -47,6 +47,12 @@ This is a zero-dependency Python library providing typed LSP (Language Server Pr
4747- Consolidated implementation with common LSP functionality shared across all backends
4848- Standard interface for ` shutdown() ` , ` update_code() ` , ` get_diagnostics() ` , etc.
4949
50+ ** Request/Notification Functions (` lsp_types/requests.py ` )**
51+ - ` RequestFunctions ` : Typed async methods for all LSP requests (initialize, hover, completion, etc.)
52+ - ` NotificationFunctions ` : Typed methods for LSP notifications (initialized, didOpen, didChange, etc.)
53+ - Auto-generated from LSP schema to provide full protocol coverage
54+ - Used internally by ` LSPProcess.send ` and ` LSPProcess.notify ` interfaces
55+
5056** Generic Process Pooling (` lsp_types/pool.py ` )**
5157- ` LSPProcessPool ` : Language-server agnostic process pooling for performance optimization
5258- ` PooledLSPProcess ` : Wrapper for ` LSPProcess ` with recycling state management
@@ -56,15 +62,13 @@ This is a zero-dependency Python library providing typed LSP (Language Server Pr
5662** Backend Integrations**
5763
5864** Pyright Integration (` lsp_types/pyright/ ` )**
59- - ` PyrightBackend ` : Backend implementation for Pyright LSP server
65+ - ` backend.py ` : ` PyrightBackend ` implementation for Pyright LSP server
6066- ` config_schema.py ` : Auto-generated Pyright configuration types
61- - ` session.py ` : Factory functions and backward-compatible wrappers
6267- ** Key Design** : Uses consolidated ` Session ` class with ` PyrightBackend ` for specialization
6368
6469** Pyrefly Integration (` lsp_types/pyrefly/ ` )**
65- - ` PyreflyBackend ` : Backend implementation for Pyrefly LSP server (Facebook's Rust-based type checker)
70+ - ` backend.py ` : ` PyreflyBackend ` implementation for Pyrefly LSP server (Facebook's Rust-based type checker)
6671- ` config_schema.py ` : Pyrefly configuration types (TypedDict with known fields)
67- - ` session.py ` : Factory functions and backward-compatible wrappers
6872- ** Key Design** : Uses consolidated ` Session ` class with ` PyreflyBackend ` for specialization
6973- ** Config Flexibility** : Supports arbitrary configuration fields via TOML serialization (using ` tomli-w ` )
7074
@@ -73,7 +77,7 @@ This is a zero-dependency Python library providing typed LSP (Language Server Pr
7377** Schema Sources:**
7478- ` assets/lsprotocol/lsp.schema.json ` : Official LSP protocol schema
7579- ` assets/lsps/pyright.schema.json ` : Pyright-specific configuration schema
76- - ` assets/lsps/pyrefly.schema.json ` : Pyrefly-specific configuration schema
80+ - ` assets/lsps/pyrefly-guide.md ` : Pyrefly configuration documentation (manually defined types)
7781
7882** Generation Process:**
79831 . ` download_schemas.py ` : Fetches latest schemas from upstream
@@ -82,20 +86,21 @@ This is a zero-dependency Python library providing typed LSP (Language Server Pr
8286
8387### Testing Strategy
8488
85- ** Process Pool Tests**
86- - ` tests/test_pool.py ` : Direct ` LSPProcessPool ` testing with generic interface
87- - ` tests/test_pyright/test_session_pool.py ` : Pool integration testing through Pyright sessions
88- - ` tests/test_pyrefly/test_session_pool.py ` : Pool integration testing through Pyrefly sessions
89+ ** Tests are parametrized to run against multiple backends (Pyright and Pyrefly).**
90+
91+ ** Process Pool Tests (` tests/test_pool.py ` )**
92+ - Direct ` LSPProcessPool ` testing with generic interface
93+ - Parametrized fixtures for testing both Pyright and Pyrefly backends
8994- Comprehensive pool behavior testing (creation, recycling, limits, cleanup)
9095- Performance benchmarks comparing pooled vs non-pooled sessions
9196- Concurrent usage scenarios and idle process management
9297
93- ** Session Tests**
94- - ` tests/test_session.py ` : Core consolidated Session class functionality
95- - ` tests/test_pyright/test_pyright_session.py ` : Pyright-specific LSP functionality testing
96- - ` tests/test_pyrefly/test_pyrefly_session.py ` : Pyrefly-specific LSP functionality testing
98+ ** Session Tests (` tests/test_session.py ` )**
99+ - Core consolidated Session class functionality
100+ - Parametrized fixtures for testing both Pyright and Pyrefly backends
97101- Integration testing with actual language servers (diagnostics, hover, completion)
98- - Backend-specific configuration and behavior validation
102+ - Dynamic environment testing with temporary directories
103+ - Backend-agnostic tests that validate common LSP operations
99104
100105### Dependencies
101106
@@ -109,6 +114,12 @@ This is a zero-dependency Python library providing typed LSP (Language Server Pr
109114
110115** Note:** Previously a zero-dependency library. Added ` tomli-w ` to support arbitrary configuration fields in Pyrefly backend.
111116
117+ ### Examples
118+
119+ The ` examples/ ` directory contains demo scripts showing library usage:
120+ - ` pyrefly_diagnostics_completion.py ` : Demonstrates diagnostics and code completion with Pyrefly
121+ - ` pyrefly_circular_imports.py ` : Example of detecting circular import issues
122+
112123### Important Notes
113124
114125- Always prefix test commands with ` uv run `
0 commit comments