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. Editors supporting LSP 3.17 pull diagnostics receive DJ001 warnings for both open documents and unopened files across the workspace.

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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

django_lsp-0.4.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.4.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: django_lsp-0.4.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.4.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e76bda13d388466d924e1fe77150ada62d5056363a5de2a665faefa413dce819
MD5 c1e05240def8479282d32f57cbd4589e
BLAKE2b-256 518bd44436225d8a51e34678ac65243ebd7e414793160d6af097fc850c88ef32

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for django_lsp-0.4.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7aca922a8fa3ce6715466afb5d7cfd70328082a37ed4d9b14edac96106d54b07
MD5 56b4fff7be85d7a798f67cea6ebe9c34
BLAKE2b-256 84f3f352b44bca037df9494d395b3b37f430b27a0679333346d8e2a54f3e46fb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for django_lsp-0.4.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 32ad7bff59c2949bd061ab71baa3e955487a3f388aab8f29456c62a617c18aa0
MD5 feeb9466b8cdf864fbce4f19daf6f66b
BLAKE2b-256 1f3f05913174a4eacfee242a089be6a9d12cf564d687b2219a4d4081a04151d6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for django_lsp-0.4.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02e3a1703ab95dfda4775240c6eb346fc33c50479535ad0d463495df6709dc3f
MD5 5f08ee902e5b6e7a7c8c2205c5a76bd2
BLAKE2b-256 8c2686ef78487060e11ec64f9f448743fb1b08aaa86a060c30836bc0604940ed

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for django_lsp-0.4.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 193859093f127bb0cee2f57a27b64c98f886546992e972281d58877972a9ec4e
MD5 c3b77564e8548774da0b64a00a07481b
BLAKE2b-256 45e4274c2d9cd73a12df38c3cbca5780d36365da0e388f4de6b3213d0fa3c6e1

See more details on using hashes here.

Provenance

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