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
django-lsp check --format github

The checker exits with status 0 when no diagnostics are found, 1 when it reports warnings, and 2 for invalid arguments or analysis failures. Use --format json for structured output or --format github for native GitHub Actions annotations. Suppress an intentional warning on its source line with # django-lsp: ignore[DJ001].

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.3.0-py3-none-win_amd64.whl (3.1 MB view details)

Uploaded Python 3Windows x86-64

django_lsp-0.3.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.3.0-py3-none-manylinux_2_28_aarch64.whl (3.0 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

django_lsp-0.3.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.3.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: django_lsp-0.3.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.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 cbefe43f26e0ca3843686ed83c1fbde321aa0feb4cd52a683cdd6a69e7875971
MD5 ab912f6d7c3dd701b61ea3e29f57a7f5
BLAKE2b-256 0170c399fad7763ed8d9164c8be2f8751fa0ff1d8beab7f4ca6204b8f2a31dd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.3.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.3.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for django_lsp-0.3.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 93c16d7ae7f825af459487eff9c357fe220e1cd651c752152526dfef93b7afaf
MD5 c2b336449128f46e1ab1bb8d6addb440
BLAKE2b-256 f5d6cdfd4b2bd6210c31ca2e9256fd73769e4cc1d6d6228ce3b666aff4a55c8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.3.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.3.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for django_lsp-0.3.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e88b252128d47a2e0a2e2b7babbd14290045b5e62f730b276804e7bc59c76215
MD5 a8adb4d96a74226c198517a2170fd726
BLAKE2b-256 39ca933a7beced250854c582617c6c47d93ee95488f22a722cd1dcdc0a3abf95

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.3.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.3.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for django_lsp-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f97a39d68abdffc358e02730ac04861c2363af2bc3ac9eca6c090bb8169d7260
MD5 3c4997e122dc2611b7727b2ca599eaeb
BLAKE2b-256 d6362bcca1684cc5dfb9e3ca562ae24c899478fa2085aa3f4be3a940b3a3e55e

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.3.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.3.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for django_lsp-0.3.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0c7983198ac8f8f0b2fba71758f3d4ab53dbb8a8f5d19d9244a66c5066aad99a
MD5 9d3ded00af8790ba558e796a967fe9b9
BLAKE2b-256 24badf8a3322c4a0375eff446dbe82aa2285ced09f0b78a99e6fe11cfd05a071

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lsp-0.3.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