python-lsp-ruff is a plugin for python-lsp-server that integrates Ruff's linting, code actions, and formatting capabilities. It leverages Ruff, an extremely fast Python linter and formatter written in Rust, providing a fast and comprehensive code analysis experience. The library is actively maintained, with frequent updates (current version 2.3.1) for bug fixes and compatibility with newer Ruff versions.
pip install python-lsp-server ruff python-lsp-ruffNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
After installing `python-lsp-server`, `ruff`, and `python-lsp-ruff` in the same virtual environment, configure your LSP client (editor/IDE) to enable the Ruff plugin for `python-lsp-server`. This typically involves a JSON-like configuration for the language server. The example above shows how to enable Ruff for linting and formatting, explicitly re-enabling import sorting ('I') due to a breaking change in v2.0.0, and disabling other common Python linters to prevent conflicts. Remember to adjust paths and specific settings (e.g., `target-version`, `select`, `ignore`) according to your `ruff` configuration or `pyproject.toml`.
To enable import sorting, add `format = ['I']` to your `ruff` configuration within your LSP client settings.
Ensure that your installed `ruff` version meets the minimum requirement specified by `python-lsp-ruff` (e.g., `ruff>=0.2.0` for `python-lsp-ruff>=2.1.0`). If using an older `ruff` (<0.1.0), you might need to pin `python-lsp-ruff==1.5.3`.
Understand your LSP setup: if you use `python-lsp-server` for multiple language features, `python-lsp-ruff` is the correct choice to integrate Ruff. If you primarily want Ruff's features as a standalone LSP, consider `ruff-lsp` directly.
Prioritize configuring Ruff directly in your `pyproject.toml` or `ruff.toml` for project-specific settings to ensure consistent behavior across tools and contributors.
If you need to use these other tools alongside Ruff, you must explicitly re-enable them in your LSP client's configuration, ensuring no rule conflicts exist.