Skip to main content

django-lsp

django-lsp is a Rust language server and command-line checker focused on Django ORM queries. It uses Ruff's Python parser and an incremental Salsa database to follow Django model relations without importing or executing the project.

from .models import Blog

Blog.objects.filter(author__team__name__icontains="Django")

Installation

Install the language server from PyPI with uv:

uv tool install django-lsp

pipx install django-lsp and python -m pip install django-lsp are also supported. Confirm the installed executable is available with:

django-lsp --version

Point an editor's LSP client at the django-lsp command, with no arguments. The server uses standard input and output for LSP communication.

Run the same repeated-query analysis from a terminal with:

django-lsp check
django-lsp check path/to/views.py

Visual Studio Code

Install Django ORM Language Server from the built-in Extensions view in Visual Studio Code or Cursor. It is published on the Visual Studio Marketplace and Open VSX. The extension runs django-lsp alongside Pylance, Pyright, Ruff, or another general Python language server and bundles the native server for supported platforms.

Platform-specific VSIX files are also available from the latest GitHub release. See the extension README for configuration and development installation.

Zed

The repository includes a Zed extension that registers django-lsp alongside a general Python language server. It uses a server already installed on PATH, or downloads the matching executable from the latest GitHub release. See the extension README for development installation while its extension-gallery submission is in progress.

Documentation

  • Getting started covers installing, building, and connecting an editor.
  • Completion examples shows executable examples generated from the real LSP.
  • Configuration documents pyproject.toml options.
  • Testing explains the Rust, protocol, documentation, and Django compatibility test layers.

The website uses CrossDocs, the same documentation framework as Cross-Inertia. Preview the complete FastAPI and React application locally at http://localhost:8000 with:

cd website
uv sync --locked
bun install --frozen-lockfile
bun run serve

Current scope

  • workspace model indexing
  • completion inside filter(...), exclude(...), get(...), select_related(...), and prefetch_related(...)
  • DJ001 warnings for missing select_related() or prefetch_related() across QuerySet loops, comprehensions, collected QuerySets, related managers, and helper calls, available through both the LSP and django-lsp check
  • bounded cross-module call summaries, custom QuerySet chains, collection wrappers, typed model parameters, and typed QuerySet-returning functions
  • Django admin display-method awareness, including eager loading declared by get_queryset()
  • Django 6.1 FETCH_PEERS and RAISE fetch-mode awareness for single-valued relations
  • forward, reverse, and recursive relation traversal
  • AUTH_USER_MODEL support
  • models re-exported from package __init__.py modules
  • function-local and dotted import resolution
  • unsaved editor buffer updates

Development

Building from source requires Rust 1.95 or newer.

cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo run --bin render-docs -- --check
cargo test --all-targets

Validate the documentation website separately with:

cd website
uv sync --locked
bun install --frozen-lockfile
bun run check
bun run build

The project intentionally does not provide Django runtime introspection, general Python language features, or exhaustive support for dynamic model-loading patterns.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

django_lsp-0.2.0-py3-none-win_amd64.whl (3.1 MB view details)

Uploaded Python 3Windows x86-64

django_lsp-0.2.0-py3-none-manylinux_2_28_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

django_lsp-0.2.0-py3-none-manylinux_2_28_aarch64.whl (3.0 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

django_lsp-0.2.0-py3-none-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

django_lsp-0.2.0-py3-none-macosx_10_12_x86_64.whl (3.1 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file django_lsp-0.2.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: django_lsp-0.2.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_lsp-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 6c335c8cdee4eec28ee0b51bd7b7e3b964f94c81a03ab1d6f070c8118acc1fd2
MD5 b28fdf205ebf714432deaaf512a16aca
BLAKE2b-256 a0dcfae2773dd14e971d8828574613cd7663a8a8405076840cca0807e04add91

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.2.0-py3-none-win_amd64.whl:

Publisher: release.yml on patrick91/django-lsp

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

File details

Details for the file django_lsp-0.2.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for django_lsp-0.2.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e6fb5faff45a9ab1c25f5f1bd8df9b0d7981bd3ae0b52197f0216ea52e74c35
MD5 b205ed09ea208d985c1c2fddb23b3e59
BLAKE2b-256 c2a74faf9d066810c02a1435f697bd53ed032cfad87d66d812940e6f4dc3fb2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.2.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release.yml on patrick91/django-lsp

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

File details

Details for the file django_lsp-0.2.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for django_lsp-0.2.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3f83e8f1e5e82ff2b1b07d18a47dec161ddc097d2dbaf3518590dbb2b1dc2395
MD5 ec2171a7b3fca4e53818bb223e90e1f2
BLAKE2b-256 9dd7201ae2ad7dcada4cac2e440cef0325293ac83052ee34fcd3446417244486

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.2.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release.yml on patrick91/django-lsp

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

File details

Details for the file django_lsp-0.2.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for django_lsp-0.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57c0052974bf2318b851329b9fb81497af72dc2090fc0d86f159289f7cbab7a8
MD5 85168bd1e0ff82bbbf40205514b49e89
BLAKE2b-256 263a26fb5104ef9ad66227e896a585be47e2a146c616de6acf5814d8a195fcdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.2.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on patrick91/django-lsp

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

File details

Details for the file django_lsp-0.2.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for django_lsp-0.2.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4c1f6c9a368bba103cdb09c1c96d40576dddfc09da9c5c20528301854be98513
MD5 982e19f0b64b67430f1eb4c8e899a218
BLAKE2b-256 62a0109f88ab194ee3f23e295700f950f63c3e83288f9b1993fdd5f7cccb519a

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.2.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on patrick91/django-lsp

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 Sentry Error logging StatusPage Status page