From d1dffbf670fe545c3c646ad61495d40d320f3599 Mon Sep 17 00:00:00 2001 From: Magnus Larsen Date: Wed, 7 Feb 2024 10:53:09 +0100 Subject: [PATCH 1/3] Allow ruff 3.x; disable default enabled formatters --- README.md | 8 ++++---- pylsp_ruff/plugin.py | 2 ++ pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 80e5270..c43ed9e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Python](https://github.com/python-lsp/python-lsp-ruff/actions/workflows/python.yml/badge.svg)](https://github.com/python-lsp/python-lsp-ruff/actions/workflows/python.yml) `python-lsp-ruff` is a plugin for `python-lsp-server` that adds linting, code action and formatting capabilities that are provided by [ruff](https://github.com/charliermarsh/ruff), -an extremely fast Python linter written in Rust. +an extremely fast Python linter and formatter written in Rust. ## Install @@ -26,8 +26,8 @@ pip install "ruff<0.1.0" "python-lsp-ruff==1.5.3" ## Usage -This plugin will disable `pycodestyle`, `pyflakes`, `mccabe` and `pyls_isort` by default, unless they are explicitly enabled in the client configuration. -When enabled, all linting diagnostics will be provided by `ruff`. +This plugin will disable `pycodestyle`, `pyflakes`, `mccabe`, `pyls_isort`, `autopep8`, and `yapf` by default, unless they are explicitly enabled in the client configuration. +When `python-lsp-ruff` is enabled, all linting diagnostics and formatting capabilities will be provided by `ruff`. Any codes given in the `format` option will only be marked as `fixable` for ruff during the formatting operation, the user has to make sure that these codes are also in the list of codes that ruff checks! @@ -38,7 +38,7 @@ Configuration options can be passed to the python-language-server. If a `pyproje file is present in the project, `python-lsp-ruff` will ignore specific options (see below). The plugin follows [python-lsp-server's configuration](https://github.com/python-lsp/python-lsp-server/#configuration). -This example configuration using for `neovim` shows the possible optionsL +This example configuration using for `neovim` shows the possible options: ```lua pylsp = { diff --git a/pylsp_ruff/plugin.py b/pylsp_ruff/plugin.py index 6b73fae..d1738a3 100644 --- a/pylsp_ruff/plugin.py +++ b/pylsp_ruff/plugin.py @@ -98,6 +98,8 @@ def pylsp_settings(): "mccabe": {"enabled": False}, "pycodestyle": {"enabled": False}, "pyls_isort": {"enabled": False}, + "yapf": {"enabled": False}, + "autopep8": {"enabled": False}, } } return converter.unstructure(settings) diff --git a/pyproject.toml b/pyproject.toml index 687b8ad..5f03713 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ readme = "README.md" requires-python = ">=3.8" license = {text = "MIT"} dependencies = [ - "ruff>=0.1.5, <0.2.0", + "ruff>=0.1.5, <0.3.0", "python-lsp-server", "cattrs!=23.2.1", "lsprotocol>=2022.0.0a1", From 4df5a88896c8d09c05c13269a4326cb01cfb188c Mon Sep 17 00:00:00 2001 From: Magnus Larsen Date: Wed, 7 Feb 2024 16:15:53 +0000 Subject: [PATCH 2/3] bump minimum version to 0.2.0 Co-authored-by: Carlos Cordoba --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5f03713..835c60e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ readme = "README.md" requires-python = ">=3.8" license = {text = "MIT"} dependencies = [ - "ruff>=0.1.5, <0.3.0", + "ruff>=0.2.0, <0.3.0", "python-lsp-server", "cattrs!=23.2.1", "lsprotocol>=2022.0.0a1", From c5d47e8fa2e6b9a0996ee9802c4bf5485841fda2 Mon Sep 17 00:00:00 2001 From: Magnus Larsen Date: Fri, 9 Feb 2024 10:24:52 +0100 Subject: [PATCH 3/3] remove isort from disable list --- README.md | 2 +- pylsp_ruff/plugin.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index c43ed9e..2318aad 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ pip install "ruff<0.1.0" "python-lsp-ruff==1.5.3" ## Usage -This plugin will disable `pycodestyle`, `pyflakes`, `mccabe`, `pyls_isort`, `autopep8`, and `yapf` by default, unless they are explicitly enabled in the client configuration. +This plugin will disable `pycodestyle`, `pyflakes`, `mccabe`, `autopep8`, and `yapf` by default, unless they are explicitly enabled in the client configuration. When `python-lsp-ruff` is enabled, all linting diagnostics and formatting capabilities will be provided by `ruff`. Any codes given in the `format` option will only be marked as `fixable` for ruff during the formatting operation, the user has to make sure that these codes are also in the list of codes that ruff checks! diff --git a/pylsp_ruff/plugin.py b/pylsp_ruff/plugin.py index d1738a3..6628e91 100644 --- a/pylsp_ruff/plugin.py +++ b/pylsp_ruff/plugin.py @@ -97,7 +97,6 @@ def pylsp_settings(): "pyflakes": {"enabled": False}, "mccabe": {"enabled": False}, "pycodestyle": {"enabled": False}, - "pyls_isort": {"enabled": False}, "yapf": {"enabled": False}, "autopep8": {"enabled": False}, }