Skip to content

Use Python to invoke ruff instead of binary#848

Open
anakinxc wants to merge 1 commit intoakaihola:masterfrom
anakinxc:master
Open

Use Python to invoke ruff instead of binary#848
anakinxc wants to merge 1 commit intoakaihola:masterfrom
anakinxc:master

Conversation

@anakinxc
Copy link
Copy Markdown
Contributor

When user installs ruff via pip install --user, ruff binary is usually not on system path.

Directly invoke ruff will cause error No such file or directory: 'ruff', ask Python to invoke the python one is an safer approach.

@tpppppub
Copy link
Copy Markdown

Hit the same issue

@akaihola
Copy link
Copy Markdown
Owner

Thanks @anakinxc and @tpppppub!

Won't this then break --formatter=ruff for those who like to install Ruff using an operating system package manager or manually?

If that's the case, what options do we have? The following come to mind:

  • first see if the ruff Python package is installed, and only use python -m ruff if that's the case, otherwise just ruff
  • first see if the ruff binary is found in PATH, and use just ruff if that's the case, otherwise try python -m ruff
  • just use ruff, and if it fails, try python -m ruff
  • use python -m ruff, and if it fails, try just ruff
  • ...other?

@anakinxc
Copy link
Copy Markdown
Contributor Author

anakinxc commented Nov 4, 2025

  • just use ruff, and if it fails, try python -m ruff

Personally, I think this one is a better solution

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

Successfully merging this pull request may close these issues.

3 participants