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
  • conservative editor quick fixes that add the missing eager-loading calls to a traced local QuerySet, including a combined fix for multiple relations
  • 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.

Release files for django-lsp 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for django-lsp 0.6.2
File
django_lsp-0.6.2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
django_lsp-0.6.2-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details
django_lsp-0.6.2-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details
django_lsp-0.6.2-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
django_lsp-0.6.2-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 15.6 MB

Release files / django_lsp-0.6.2-py3-none-win_amd64.whl

Download URL django_lsp-0.6.2-py3-none-win_amd64.whl
Size 3.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
a7752b982339607f712f4fbf07a76615423b102cd38750ab6e138d77929306b4
BLAKE2b-256 checksum
How to use checksums
fefcd9672ed2f176a0d462fc00175cad0b958bf0ead3d91489e877fc841240e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / django_lsp-0.6.2-py3-none-manylinux_2_28_x86_64.whl

Download URL django_lsp-0.6.2-py3-none-manylinux_2_28_x86_64.whl
Size 3.2 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
d544f81825013735829fd29ab0864eae43fc9b56c3a529c675fcd54afee0957c
BLAKE2b-256 checksum
How to use checksums
2a7914ba8ca35102e964a5ca0e9c42d4056a778596215caca9b1739dd4ae82e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / django_lsp-0.6.2-py3-none-manylinux_2_28_aarch64.whl

Download URL django_lsp-0.6.2-py3-none-manylinux_2_28_aarch64.whl
Size 3.0 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
72acaeeac87173b3c6373cc7d1c10dece1072db325309cefe744b40c08c9e94d
BLAKE2b-256 checksum
How to use checksums
36cbf9fdb0fe5552bd7d08e2c2e9cb568c06b9809328e324ba7b33c068a1c855
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / django_lsp-0.6.2-py3-none-macosx_11_0_arm64.whl

Download URL django_lsp-0.6.2-py3-none-macosx_11_0_arm64.whl
Size 3.1 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
eef53fe60d16fa426d7760664089501c4ffa294f123877ad9c5266463667566d
BLAKE2b-256 checksum
How to use checksums
c88f344ba59abf898f802c6d01c1a4ebe9f192434cc0fccba801fd5b79dec616
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / django_lsp-0.6.2-py3-none-macosx_10_12_x86_64.whl

Download URL django_lsp-0.6.2-py3-none-macosx_10_12_x86_64.whl
Size 3.2 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0881a36c17155a4374ecb25f6391b28b7bf1b2d488da156b2601e381819b3c8a
BLAKE2b-256 checksum
How to use checksums
785ea8bfd287cef17a3257b4aae4381b9a0e73b1ffc4aafbc585a140dfd39955
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.2 This release

5 release files

0.6.1

5 release files

0.6.0

5 release files

0.5.0

5 release files

0.4.0

5 release files

0.3.0

5 release files

0.2.0

5 release files

0.1.5

5 release files

0.1.4

5 release files

0.1.3

5 release files

0.1.2

5 release files

0.1.1

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page