Skip to main content

A blazingly fast Language Server Protocol implementation for pytest

Project description

pytest-language-server 🔥

CI Security Audit PyPI version Downloads Crates.io License: MIT Python Version

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.

Features

🎯 Go to Definition

Jump directly to fixture definitions from anywhere they're used:

  • Local fixtures in the same file
  • Fixtures in conftest.py files
  • Third-party fixtures from pytest plugins (pytest-mock, pytest-asyncio, etc.)
  • Respects pytest's fixture shadowing/priority rules

🔍 Find References

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
  • Correctly handles fixture overriding and hierarchies
  • LSP spec compliant: Always includes the current position in results

📚 Hover Documentation

View fixture information on hover:

  • Fixture signature
  • Source file location
  • Docstring (with proper formatting and dedenting)
  • Markdown support in docstrings

⚡️ Performance

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

Installation

Choose your preferred installation method:

📦 PyPI (Recommended)

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-server

🍺 Homebrew (macOS/Linux)

Install via Homebrew for system-wide availability:

brew install bellini666/tap/pytest-language-server

To add the tap first:

brew tap bellini666/tap https://github.com/bellini666/pytest-language-server
brew install pytest-language-server

🦀 Cargo (Rust)

Install from crates.io if you have Rust installed:

cargo install pytest-language-server

📥 Pre-built Binaries

Download 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

🔨 From Source

Build from source for development or customization:

git clone https://github.com/bellini666/pytest-language-server
cd pytest-language-server
cargo build --release

The binary will be at target/release/pytest-language-server.

Setup

Neovim (with nvim-lspconfig)

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,
}

Zed

Install the extension from the extensions marketplace:

  1. Open Zed
  2. Open the command palette (Cmd+Shift+P / Ctrl+Shift+P)
  3. Search for "zed: extensions"
  4. Search for "pytest Language Server"
  5. Click "Install"

The extension will automatically detect pytest-language-server if it's in your PATH.

VS Code

Install the extension from the marketplace (coming soon) or configure manually:

{
  "pytest-language-server.enable": true,
  "pytest-language-server.path": "pytest-language-server"
}

Other Editors

Any editor with LSP support can use pytest-language-server. Configure it to run the pytest-language-server command.

Configuration

Logging

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-server

Logs are written to stderr, so they won't interfere with LSP communication.

Virtual Environment Detection

The server automatically detects your Python virtual environment:

  1. Checks for .venv/, venv/, or env/ in your project root
  2. Falls back to $VIRTUAL_ENV environment variable
  3. Scans third-party pytest plugins for fixtures

Supported Fixture Patterns

Decorator Style

@pytest.fixture
def my_fixture():
    """Fixture docstring."""
    return 42

Assignment Style (pytest-mock)

mocker = pytest.fixture()(_mocker)

Async Fixtures

@pytest.fixture
async def async_fixture():
    return await some_async_operation()

Fixture Dependencies

@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"

Fixture Priority Rules

pytest-language-server correctly implements pytest's fixture shadowing rules:

  1. Same file: Fixtures defined in the same file have highest priority
  2. Closest conftest.py: Searches parent directories for conftest.py files
  3. Virtual environment: Third-party plugin fixtures

Fixture Overriding

The LSP correctly handles complex fixture overriding scenarios:

# conftest.py (parent)
@pytest.fixture
def cli_runner():
    return "parent runner"

# tests/conftest.py (child)
@pytest.fixture
def cli_runner(cli_runner):  # Overrides parent
    return cli_runner  # Uses parent

# tests/test_example.py
def test_example(cli_runner):  # Uses child
    pass

When using find-references:

  • Clicking on the function name def cli_runner(...) shows references to the child fixture
  • Clicking on the parameter cli_runner(cli_runner) shows references to the parent fixture
  • Character-position aware to distinguish between the two

Supported Third-Party 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

Architecture

  • Language: Rust 🦀
  • LSP Framework: tower-lsp
  • Parser: rustpython-parser
  • Concurrency: tokio async runtime
  • Data Structures: DashMap for lock-free concurrent access

Development

Prerequisites

  • Rust 1.83+ (2021 edition)
  • Python 3.10+ (for testing)

Building

cargo build --release

Running Tests

cargo test

Logging During Development

RUST_LOG=debug cargo run

Security

Security 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.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

  1. Install pre-commit hooks:

    pre-commit install
    
  2. Run security checks locally:

    cargo audit
    cargo clippy
    cargo test
    

License

MIT License - see LICENSE file for details.

Acknowledgments

Built with:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_language_server-0.4.0.tar.gz (66.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pytest_language_server-0.4.0-py3-none-win_amd64.whl (2.8 MB view details)

Uploaded Python 3Windows x86-64

pytest_language_server-0.4.0-py3-none-win32.whl (2.5 MB view details)

Uploaded Python 3Windows x86

pytest_language_server-0.4.0-py3-none-musllinux_1_2_x86_64.whl (3.2 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

pytest_language_server-0.4.0-py3-none-musllinux_1_2_i686.whl (3.2 MB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

pytest_language_server-0.4.0-py3-none-musllinux_1_2_armv7l.whl (3.1 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

pytest_language_server-0.4.0-py3-none-musllinux_1_2_aarch64.whl (3.1 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

pytest_language_server-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

pytest_language_server-0.4.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (3.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

pytest_language_server-0.4.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (3.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

pytest_language_server-0.4.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (3.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

pytest_language_server-0.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

pytest_language_server-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

pytest_language_server-0.4.0-py3-none-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

pytest_language_server-0.4.0-py3-none-macosx_10_12_x86_64.whl (3.0 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file pytest_language_server-0.4.0.tar.gz.

File metadata

  • Download URL: pytest_language_server-0.4.0.tar.gz
  • Upload date:
  • Size: 66.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_language_server-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4dfd639ef2f54c265fbd893289d52332616f48ee8c1dbbfa44f1f17ff9b25f9e
MD5 de97dddd97b8c3c3bf0a7e2c5b0120b1
BLAKE2b-256 4c03aa33a0d4ffb3898eb1aebdf1f6cf9f7c2727b5f6613b0ddb6fafa7525dba

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0.tar.gz:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 51d19e7ee2dad52fa0706aaea7588d0d38246fdf75fd8a0a244a2182d6944196
MD5 b233b54b6a694bbe67e427552d80564b
BLAKE2b-256 710e2cc75b2d42ab6cead222bd348fd7b1a180db8dee49d1bb489490f05d3c75

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-win_amd64.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-win32.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 d61f6c23421f26a8d7f687e4d26e65916b3cf5d79f6706259cef8e0851439c55
MD5 24116e951f33c32c4654de4ea56a3170
BLAKE2b-256 f6eedfa84372f694345e9b39678840f582bd673144270fa4967e0cb5bacb2a15

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-win32.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8b153b6ef943a3ab2c9886c908f9b67f09f1766c92709ae1c2897f2217605fcb
MD5 b0659c08042011909e845e2bc96ccec8
BLAKE2b-256 e16596e04060271dce1d8f546015dbfb299339d8c2fabd5e82d6df8b1248c9aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-musllinux_1_2_x86_64.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 4941ca2afe9068c6e22308d495b9c8215678aecec9622889f1f93609251690a4
MD5 31adf2aaa281919137556f688ad113af
BLAKE2b-256 82d5dbc89867c9246dec4fd6db8b166a160708ec0fad5db502ec837b4e9c52f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-musllinux_1_2_i686.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 979647857408c1f3d39d683eda3852a8b7c0a79aa35bd4e079155ceaa3b54111
MD5 8d19c713432e14f182e8a392fc232058
BLAKE2b-256 296f48d1c1c27e26f146f6a8e68c7b982165fd092d4379f4ab2f2c56b65ff77a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-musllinux_1_2_armv7l.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 dc5f62c2f7cd5fc807c36ebf43e1a25744a2634aa638b9824fd21023c75877ec
MD5 5eb099d44ab40719a56c886bf7a1e3e4
BLAKE2b-256 ee9733a2d57f46e1ff461a11eae10f4ba1f318a49c949f5b2069fcdd5b87cda2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-musllinux_1_2_aarch64.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd650a95882314984951c38b82089c72e10ab8207b96edbddd9591053f4b8f34
MD5 c66b28b9b0a536cf8607a8cf8aa5f7f7
BLAKE2b-256 ab3295ebe134c8d9b08939a2962be88b291b8533ee3b531c9b90456251d11766

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 f5ba169ce1781cdb3d962489e7610e091f70a4c9639ab394e94d9a053752b837
MD5 2219ea51ee1697775483bbf656223cc5
BLAKE2b-256 cfece97870c1a41764e20d77dd519d5888b73e1fb426e09ff77d855b417080ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 8dc333fa53006a8bf8d47bde55b55ff74dbcb933e12b452eb5eb2aa4abc0703a
MD5 602ccf20e3b0a1e1ce201ae023ef2799
BLAKE2b-256 21ae227cc3caa4ed2271d64c2739e932b20db39a2967004ee809200d28eb6028

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ce13f84360b5696bd7dce7a6b764e015c4a5bcc8964636c1a0c9b778d9163196
MD5 20a99e5079e577cb571337da66cfbfe6
BLAKE2b-256 43ef3bc115ddb5d3fa5cac18563c0a8a7bcd8fd4707e75437476f438c1fb1636

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 57aee39f1010b7f6f8a986a7e7bd4a81dbf39c64c89edd91cc00947daaa129c9
MD5 f665387c2c3dbd6a47db40f328d6c35c
BLAKE2b-256 d2d40b9163f0039067d74999e792c7964b90c6b6909458f1697b2ad30e298025

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ebb32ea21c5c64868f4e807de243367eec0d5dc58254077348732190bdebf93d
MD5 03f76aedbdd794d81d07401a25b3a32a
BLAKE2b-256 37933e3f9183f8bfea0ed8010f850f2e468487bdc9851e204f5a3514d7e34e07

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67c02b51c3d009b32a58bcf229a437e133119c8c083fd1da912d089d13300c80
MD5 92bf0ebbcde3939542aa8f770a121ea1
BLAKE2b-256 92e5f8a51defcbddc4613c51e05265e3ad643e419803b6b61f1fe79785f1c0f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_language_server-0.4.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.4.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b1fa45b7fd4d9f884a3569fafaa81df9eec55f6a38fa79c029a0bd913634c3b0
MD5 7bddf1c6c77514cb16b045b0d960b4e4
BLAKE2b-256 25dabb7862e543b826ccbc414135de3f5b90ae341803c6291d59194c31b98268

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.4.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on bellini666/pytest-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page