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

Uploaded Python 3Windows x86-64

django_lsp-0.5.0-py3-none-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

django_lsp-0.5.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.5.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: django_lsp-0.5.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.2 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.5.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8ec738ee398a17384f87c4fe3a2a0cf16df2e1e7beb8737983748ba5dfa3e87c
MD5 5f2b61ea00e40f276476f998680bd13e
BLAKE2b-256 559bfa1cf4b847c68965b0d90db631b3e2f3a35fafff384216355210152f2c7b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for django_lsp-0.5.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 440e8e5b7512fa85f4f02c40b3669164d69bc3347d7e3bf71e5da50aa8a5e35d
MD5 e4c0096691fa5196867e659658f5dbbd
BLAKE2b-256 53fd2278bf3075b4616bc221980e626710dd2362bd73a83211f335dd6ff1b9a4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for django_lsp-0.5.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1c91dcad3c66deca30bfa0cd8fd4c2f8fe786d16bdb560cdf9223cecffedf122
MD5 e1c1197e164d8bab0eb1cfa00f6ab32f
BLAKE2b-256 0f50a3a064a0fb69fd169c8d66ee1a693e3e94c2805e99a3d550b8d4ce80ed97

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for django_lsp-0.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23b553025b8172cf46e1e9312630661168d6cbbca6033a313ff9d581a0cde8f3
MD5 65333be7b9ac01204956d09a662bd55f
BLAKE2b-256 eeba4859f58d8aea086108cb72c4a38226dc078e9a245aca2e9a93df99d44d94

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for django_lsp-0.5.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 772726e939095e4040443f3163239018f5b525693a73b98f6c382c6f02a63de8
MD5 05d834aa731e61deb74932fdb2de9eac
BLAKE2b-256 6b0bb3476b189d11b37fd1bfb3ba1514031034b981e1e18c949018c1915f2f1f

See more details on using hashes here.

Provenance

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