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

📚 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

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.3.1.tar.gz (52.7 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.3.1-py3-none-win_amd64.whl (2.8 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3Windows x86

pytest_language_server-0.3.1-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.3.1-py3-none-musllinux_1_2_i686.whl (3.2 MB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

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

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

pytest_language_server-0.3.1-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.3.1-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.3.1-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.3.1-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.3.1-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.3.1-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.3.1-py3-none-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

pytest_language_server-0.3.1-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.3.1.tar.gz.

File metadata

  • Download URL: pytest_language_server-0.3.1.tar.gz
  • Upload date:
  • Size: 52.7 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.3.1.tar.gz
Algorithm Hash digest
SHA256 7a8246ff23762b512a156d0c28e6dd3c84b47c11829e3eda64c157fd04304d6f
MD5 6583396bc8f574e8352022ecfbdd2f7a
BLAKE2b-256 8a5fa062e14bc09f58a3ef84a55a80bb6322bad6f9f5aa2b98daebda21671d12

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1.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.3.1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5c8f526eb44e99151e61477d8a4f51267b95b905469a403b21b78f520431d3e3
MD5 d48db85def2f742e75fd4bcfd0b2cf23
BLAKE2b-256 25c5401c135bd325f202ff203a70bbc7dd451cb68c28592772544cc6c8a18d35

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-win32.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-win32.whl
Algorithm Hash digest
SHA256 c806ae37aae3deff0992c7f2558b9951d4ba0c58ca1f763f0992b85345fbc34e
MD5 278e6001f9d17f226b183cbb98e34b5b
BLAKE2b-256 c3ccc3a2335c28bd3d823fe0483761978daebcca90b32691db277f202d85de8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1bd3943c1621e6e7aa1b185c94cd8286b1360f5b942ac8dcfb0dd763287a2689
MD5 7dc8eca4bf754ed39c43c20e85b9d49a
BLAKE2b-256 76d9df94f32172a8feef292040e9ab3140efb88958b92742dc57857887278034

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 61fb6ec7bd83026cd44db019acdc42aee3000f7de3be40e4758ceccb573e1c08
MD5 1e61e26633b83931391bc717ba778962
BLAKE2b-256 023e1e61d616c9e0715bb6ecccea7cdbfd713a9c96759266deb588ead0496d7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 9de714afa0e612e45328798be9dd896b781ba0d7addc5b764b2aa4efbe34c5de
MD5 6f7688e03c601f95f6d6fc66ba3d6a43
BLAKE2b-256 ad1f6056171c99c6bf6d0e711581c6787813badd65f98a1768d09cca5db4f85b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 22bd8f6ae38d030b1267ab56b5da01823009997031f91bf2b8c0ebadd796eba5
MD5 880d1dd9a2bc01643b9b47d2a16bc4d9
BLAKE2b-256 dab7bf4befc0a1b970dc181d416a05f03924358b00d2e520a05da2c9430c25b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 db1ddda382c61efc0740b018c182b4bb02a4e1c7cb8fbd51e093cc890bb54728
MD5 24da28874f7f5273ce62f70c49af3728
BLAKE2b-256 0d9bed679e558706d1f7bc64a8beb2d0ca3c16c61d01ed9c313d50be3829d53d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 b3b551dc32310b23ffbe7cdc2b9a0a66a612c88c8f7e0b79ac4b8e39f053c98f
MD5 c15aa5cf8caf4f928923f150ccc6e9b8
BLAKE2b-256 7cb27be64199f2cefabf6ee6d7eabe7fc97e2068adf1e96a2d3deac83949fd76

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 3396de526d4b1d8d08f94ca76789e36e7bdd8ac84252b94cc827c082dd8b8fd9
MD5 888d79a30625fcef8cb44ef17316728e
BLAKE2b-256 c50a943738fc00f6113ef3515930690893b0d05c7c5884565d05fd756387b8ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 a8d175282326ba6732df2e3fc663f89239b7fc5d4349679014e12865d396d92b
MD5 f178face3fea9793058fa859f276ab92
BLAKE2b-256 9858d9ab66e6ec47858897c36fff0deac06d483ef8cb1de94dcf27d5050ef094

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 617a83c5d27b9e3913a779aa7d9fdb4a323d16b9e7f7edd4b7ebe93c3cce1ad7
MD5 7359d38ac0f7628f5c98592663c8f57c
BLAKE2b-256 d3ae76f814f6538329ca4cbdc46e1e4b7ff183f7acabee5f14fbc39eb1a8dce9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1ce1f1e4dd1bee4337460916cf12499fdc3cc701c58660a6e03e320765d5fe13
MD5 9e79c211c2384b7c9fe5f40528d96dc5
BLAKE2b-256 b2ba26bfc045efa904efbee4dac0f5bb9edf157334f97e00d9620e64a6c3adf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cb5f8a090d6d596afa2c527c2e3d3a12b95af48fb144f0709e169cb66ddb7704
MD5 a0c59b185c39b2e054227536fbb6f997
BLAKE2b-256 9b16678a1d7a163a2c5ba512427c900230a8228e1ea0fdd34fbbcd3919a22a4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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.3.1-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pytest_language_server-0.3.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2fcfd7f109c1ed30bfe4b92e5cab81e262fe2b6dafe839c00a98970307158c21
MD5 a7ad378a47cad1aa6f5fe50209995f3e
BLAKE2b-256 8c3b0a8d3b1127e77a8530395e0d284d364430231684b2fcec1015f910638f0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_language_server-0.3.1-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