Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this plugin install ruff? #100

Open
kaddkaka opened this issue Oct 18, 2024 · 3 comments
Open

Does this plugin install ruff? #100

kaddkaka opened this issue Oct 18, 2024 · 3 comments

Comments

@kaddkaka
Copy link

kaddkaka commented Oct 18, 2024

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)?

@kaddkaka
Copy link
Author

kaddkaka commented Oct 18, 2024

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?

@kaddkaka kaddkaka changed the title Does this plugin install ruff Does this plugin install ruff? Oct 18, 2024
@jhossbach
Copy link
Member

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'")?

@kaddkaka
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants