Shamelessly vibed into existence π€β¨
This entire LSP implementation was built from scratch in a single AI-assisted coding session. No template. No boilerplate. Just pure vibes and Rust. That's right - a complete, working Language Server Protocol implementation for pytest, vibed into reality through the power of modern AI tooling. Even this message about vibing was vibed into existence.
A blazingly fast Language Server Protocol (LSP) implementation for pytest, built with Rust.
Jump directly to fixture definitions from anywhere they're used:
- Local fixtures in the same file
- Fixtures in
conftest.pyfiles - Third-party fixtures from pytest plugins (pytest-mock, pytest-asyncio, etc.)
- Respects pytest's fixture shadowing/priority rules
Find all usages of a fixture across your entire test suite:
- Works from fixture definitions or usage sites
- Character-position aware (distinguishes between fixture name and parameters)
- Shows references in all test files
View fixture information on hover:
- Fixture signature
- Source file location
- Docstring (with proper formatting and dedenting)
- Markdown support in docstrings
Built with Rust for maximum performance:
- Fast workspace scanning with concurrent file processing
- Efficient AST parsing using rustpython-parser
- Lock-free data structures with DashMap
- Minimal memory footprint
Choose your preferred installation method:
The easiest way to install for Python projects:
# Using uv (recommended)
uv tool install pytest-language-server
# Or with pip
pip install pytest-language-server
# Or with pipx (isolated environment)
pipx install pytest-language-serverInstall via Homebrew for system-wide availability:
brew install bellini666/tap/pytest-language-serverTo add the tap first:
brew tap bellini666/tap https://github.com/bellini666/pytest-language-server
brew install pytest-language-serverInstall from crates.io if you have Rust installed:
cargo install pytest-language-serverDownload pre-built binaries from the GitHub Releases page.
Available for:
- Linux: x86_64, aarch64, armv7 (glibc and musl)
- macOS: Intel and Apple Silicon
- Windows: x64 and x86
Build from source for development or customization:
git clone https://github.com/bellini666/pytest-language-server
cd pytest-language-server
cargo build --releaseThe binary will be at target/release/pytest-language-server.
require'lspconfig'.pytest_lsp.setup{
cmd = { "pytest-language-server" },
filetypes = { "python" },
root_dir = function(fname)
return require'lspconfig'.util.root_pattern('pyproject.toml', 'setup.py', 'setup.cfg', 'pytest.ini')(fname)
end,
}Install the extension from the marketplace (coming soon) or configure manually:
{
"pytest-language-server.enable": true,
"pytest-language-server.path": "pytest-language-server"
}Any editor with LSP support can use pytest-language-server. Configure it to run the pytest-language-server command.
Control log verbosity with the RUST_LOG environment variable:
# Minimal logging (default)
RUST_LOG=warn pytest-language-server
# Info level
RUST_LOG=info pytest-language-server
# Debug level (verbose)
RUST_LOG=debug pytest-language-server
# Trace level (very verbose)
RUST_LOG=trace pytest-language-serverLogs are written to stderr, so they won't interfere with LSP communication.
The server automatically detects your Python virtual environment:
- Checks for
.venv/,venv/, orenv/in your project root - Falls back to
$VIRTUAL_ENVenvironment variable - Scans third-party pytest plugins for fixtures
@pytest.fixture
def my_fixture():
"""Fixture docstring."""
return 42mocker = pytest.fixture()(_mocker)@pytest.fixture
async def async_fixture():
return await some_async_operation()@pytest.fixture
def fixture_a():
return "a"
@pytest.fixture
def fixture_b(fixture_a): # Go to definition works on fixture_a
return fixture_a + "b"pytest-language-server correctly implements pytest's fixture shadowing rules:
- Same file: Fixtures defined in the same file have highest priority
- Closest conftest.py: Searches parent directories for conftest.py files
- Virtual environment: Third-party plugin fixtures
Automatically discovers fixtures from popular pytest plugins:
- pytest-mock:
mocker,class_mocker - pytest-asyncio:
event_loop - pytest-django: Database fixtures
- pytest-cov: Coverage fixtures
- And any other pytest plugin in your environment
- Language: Rust π¦
- LSP Framework: tower-lsp
- Parser: rustpython-parser
- Concurrency: tokio async runtime
- Data Structures: DashMap for lock-free concurrent access
- Rust 1.83+ (2021 edition)
- Python 3.10+ (for testing)
cargo build --releasecargo testRUST_LOG=debug cargo runSecurity is a priority. This project includes:
- Automated dependency vulnerability scanning (cargo-audit)
- License compliance checking (cargo-deny)
- Daily security audits in CI/CD
- Dependency review on pull requests
- Pre-commit security hooks
See SECURITY.md for our security policy and how to report vulnerabilities.
Contributions are welcome! Please feel free to submit a Pull Request.
-
Install pre-commit hooks:
pre-commit install
-
Run security checks locally:
cargo audit cargo clippy cargo test
MIT License - see LICENSE file for details.
Built with:
- tower-lsp - LSP framework
- rustpython-parser - Python AST parsing
- tokio - Async runtime
Special thanks to the pytest team for creating such an amazing testing framework.
Made with β€οΈ and Rust. Shamelessly vibed into existence. Blazingly fast. π₯
When you need a pytest LSP and the vibes are just right. β¨