You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-55Lines changed: 20 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,9 @@ A language server for the Django web framework.
14
14
However, the foundation has been laid:
15
15
16
16
-[x] Working server architecture
17
-
-[x]Server implementing the Language Server Protocol written in Rust
18
-
-[x]Python agent running as a persistent process within the Django project's virtualenv
19
-
-[x]Server-agent communication via Protocol Buffers
17
+
-[x] Language Server Protocol implementation in Rust
18
+
-[x]Direct Django project interaction through PyO3
19
+
-[x]Single binary distribution with Python packaging
20
20
-[x] Custom template parser to support LSP features
21
21
-[x] Basic HTML parsing, including style and script tags
22
22
-[x] Django variables and filters
@@ -37,61 +37,25 @@ See the [Versioning](#versioning) section for details on how this project's vers
37
37
38
38
## Installation
39
39
40
-
The Django Language Server consists of two main components:
41
-
42
-
-**An LSP server**: Rust binary `djls`, distributed through the Python package `djls-server`
43
-
-**A Python agent**: `djls-agent` package that runs in your Django project
44
-
45
-
Both will need to be available in your Django project in order to function.
46
-
47
-
The quickest way to get started is to install both the server and agent in your project's environment:
40
+
Install the Django Language Server in your project's environment:
48
41
49
42
```bash
50
-
uv add --dev 'djls[server]'
43
+
uv add --dev django-language-server
51
44
uv sync
52
45
53
46
# or
54
47
55
-
pip install djls[server]
48
+
pip install django-language-server
56
49
```
57
50
58
-
> [!NOTE]
59
-
> The server should be installed globally on your development machine. The quick-start method above will install the server in each project's environment and is only intended for trying things out. See the [Server](#server) section below for details.
60
-
61
-
### Server
62
-
63
-
You can install the pre-built binary package from PyPI, or build from source using cargo.
51
+
The package provides pre-built wheels with the Rust-based LSP server compiled for common platforms. Installing it adds the `djls` command-line tool to your environment.
64
52
65
-
The server binary is published to PyPI as `djls-server` for easy installation via uv or pipx:
66
-
67
-
```bash
68
-
uv tool install djls-server
69
-
70
-
# or
71
-
72
-
pipx install djls-server
73
-
```
74
-
75
-
If you have a Rust toolchain available and prefer to build from source, you can install via cargo:
The agent needs to be installed in your Django project's environment to provide project introspection.
84
-
85
-
The agent is published to PyPI as `djls-agent` and should be added to your project's development dependencies:
86
-
87
-
```bash
88
-
uv add --dev djls-agent
89
-
uv sync
90
-
91
-
# or
92
-
93
-
pip install djls-agent
94
-
```
53
+
> [!NOTE]
54
+
> The server must currently be installed in each project's environment as it needs to run using the project's Python interpreter to access the correct Django installation and other dependencies.
55
+
>
56
+
> Global installation is not yet supported as it would run against a global Python environment rather than your project's virtualenv. The server uses [PyO3](https://pyo3.rs) to interact with Django, and we aim to support global installation in the future, allowing the server to detect and use project virtualenvs, but this is a tricky problem involving PyO3 and Python interpreter management.
57
+
>
58
+
> If you have experience with [PyO3](https://pyo3.rs) or [maturin](https://maturin.rs) and ideas on how to achieve this, please check the [Contributing](#contributing) section below.
95
59
96
60
## Editor Setup
97
61
@@ -109,8 +73,6 @@ This project adheres to DjangoVer. For a quick overview of what DjangoVer is, he
109
73
110
74
In short, `v5.1.x` means the latest version of Django the Django Language Server would support is 5.1 — so, e.g., versions `v5.1.0`, `v5.1.1`, `v5.1.2`, etc. should all work with Django 5.1.
111
75
112
-
At this moment, all components of the Django Language Server (the `djls` binary, the `djls-agent` agent package on PyPI, and the `djls-binary` binary distribution package on PyPI) will share the same version number. When a new version is released, all packages are updated together regardless of which component triggered the release.
113
-
114
76
### Breaking Changes
115
77
116
78
While DjangoVer doesn't encode API stability in the version number, this project strives to follow Django's standard practice of "deprecate for two releases, then remove" policy for breaking changes. Given this is a language server, breaking changes should primarily affect:
@@ -148,14 +110,17 @@ All feature requests should ideally start out as a discussion topic, to gather f
148
110
149
111
### Development
150
112
151
-
The project consists of both Rust and Python components:
113
+
The project is written in Rust using PyO3 for Python integration:
152
114
153
-
- Rust: LSP server, template parsing, and core functionality (`crates/`)
154
-
- Python: Django project and environment introspection agent (`packages/`)
115
+
- LSP server implementation (`crates/djls/`)
116
+
- Template parsing and core functionality (`crates/djls-template-ast/`)
117
+
- Python integration via PyO3 for Django project introspection
155
118
156
119
Code contributions are welcome from developers of all backgrounds. Rust expertise is especially valuable for the LSP server and core components.
157
120
158
-
Python and Django developers should not be deterred by the Rust codebase - Django expertise is just as valuable. The Rust components were built by [a simple country CRUD web developer](https://youtu.be/7ij_1SQqbVo?si=hwwPyBjmaOGnvPPI&t=53) learning Rust along the way.
121
+
One significant challenge we're trying to solve is supporting global installation of the language server while still allowing it to detect and use project virtualenvs for Django introspection. Currently, the server must be installed in each project's virtualenv to access the project's Django installation. If you have experience with PyO3 and ideas about how to achieve this, we'd love your help!
122
+
123
+
Python and Django developers should not be deterred by the Rust codebase - Django expertise is just as valuable. Understanding Django's internals and common development patterns helps inform what features would be most valuable. The Rust components were built by [a simple country CRUD web developer](https://youtu.be/7ij_1SQqbVo?si=hwwPyBjmaOGnvPPI&t=53) learning Rust along the way.
0 commit comments