8000 Add uv caveat re: compat. & fix typo · python-lsp/python-lsp-server@0c5d0f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c5d0f2

Browse files
committed
Add uv caveat re: compat. & fix typo
1 parent dbdabe1 commit 0c5d0f2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/python-env.md

+3-2
8000
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ This is better than the approach above, but won't help with plugins that need to
6262

6363
This is the first option that should work fine for all plugins.
6464

65-
A potential drawbacks is that it is sometimes recommended to only install packages in your project's virtualenv that are specified by your project's `pyproject.toml` (or equivalent configs). Many Python dev tools come with functionality to ensure this (e.g. `poetry install --sync`, `uv sync` unless run with `--inexact`, ...). To use these together with this option, you have to add `python-lsp-server` and any plugins you want to use to your `pyproject.toml`'s dev dependencies section. This is OK but may be annoying for users who don't want to use LSP features or have their own setup.
65+
A potential drawback is that it is sometimes recommended to only install packages in your project's virtualenv that are specified by your project's `pyproject.toml` (or equivalent configs). Many Python dev tools come with functionality to ensure this (e.g. `poetry install --sync`, `uv sync` unless run with `--inexact`, ...). To use these together with this option, you have to add `python-lsp-server` and any plugins you want to use to your `pyproject.toml`'s dev dependencies section. This is OK but may be annoying for users who don't want to use LSP features or have their own setup.
6666

6767
### Option 4 (best? but complicated): In a venv layered "on top" of the project environment
6868

6969
It is possible to "overlay" a virtualenv on top of another [using `.pth` hacks](https://stackoverflow.com/a/72972198) or by just manually setting `PYTHONPATH` and `PATH` to contain both venvs.
7070

7171
So you could have all your project's normal and dev dependencies installed in one venv, but then have an "overlay" venv in which you install `python-lsp-server` and the plugins you want to use, ideally at versions compatible with your project's main dependencies.
7272

73-
One tool that can do all of this automatically is [uv](https://github.com/astral-sh/uv): Running
73+
One tool that can do _most_ of this automatically is [uv](https://github.com/astral-sh/uv)'s [`uv run --with`](https://docs.astral.sh/uv/reference/cli/#uv-run--with) functionality (the only thing it won't do is make sure the dependency versions in the overlay venv are compatible with the main ones).
74+
Running
7475

7576
```bash
7677
uv run --with python-lsp-server,pylsp-mypy pylsp

0 commit comments

Comments
 (0)
0