python-lsp/python-lsp-ruff

Does this plugin install ruff?

kaddkaka opened this issue · 3 comments

Does this plugin install ruff and is there any way to avoid that?

I already have ruff installed and available from my nix-shell environment. The version of ruff is tied to the project which might update slowly, currently the ruff version used 0.5.0.

I installed python-lsp-server with pipx and then installed the mypy and ruff plugins like this:

pipx install python-lsp-server
cd ~/.local/share/pipx/venvs/python-lsp-server
source base/activate
python3 -m pip install pylsp-mypy
python3 -m pip install python-lsp-ruff

however the issue is that this causes ruff 0.7.0 to be installed and picked up. (it seems like)

Is there some way to just get the connection to ruff enable (without installing ruff), and then use the ruff binary that will be loaded by my nix-shell environment (0.5.0)?

is it because of the dependency in the pyproject.toml file and is that really necessary?

I tried to just renamed the ruff binary in my python-lsp-server virtualenv, but instead now I get 0 diagnostics from ruff.

So is it possible that pylsp can find "external" ruff (via PATH) instead?

hmm, if I understand this problem correctly the issue is that, in the virtual environment, the ruff binary is not found by pip? Could you install python-lsp-ruff without dependencies (via --no-deps) and manually install the required packages ("python-lsp-server", "lsprotocol>=2023.0.1", "tomli>=1.1.0; python_version < '3.11'")?

hmm, if I understand this problem correctly the issue is that, in the virtual environment, the ruff binary is not found by pip? Could you install python-lsp-ruff without dependencies (via --no-deps) and manually install the required packages ("python-lsp-server", "lsprotocol>=2023.0.1", "tomli>=1.1.0; python_version < '3.11'")?

Yes, with this sequence of commands it works as my original intention. 🎉 Not sure what the best default is, I just have to learn the --no-deps option :)

pipx install python-lsp-server
cd ~/.local/share/pipx/venvs/python-lsp-server
source base/activate
python3 -m pip install pylsp-mypy
python3 -m pip install python-lsp-ruff --no-deps