From 00a57f889c7b82f93c9ab8daa08b9223a5d3dc40 Mon Sep 17 00:00:00 2001 From: Dionisio E Alonso Date: Wed, 31 Jan 2024 00:15:30 -0300 Subject: [PATCH 1/3] feat(mypy): Change configuration format Changed mypy configuration INI format. Python's configparser checks boolean values in a case-insensitive manner, so it doesn't matter if values start in Title-case or lower-case. This way, the configuration is easily translated to TOML format for writing a pyproject.toml file; with the exception of string values which will have to be enclosed in quotes anyways. --- mypy/config | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mypy/config b/mypy/config index a7133c6..da83f18 100644 --- a/mypy/config +++ b/mypy/config @@ -1,19 +1,19 @@ [mypy] -show_column_numbers = True -ignore_missing_imports = True +show_column_numbers = true +ignore_missing_imports = true follow_imports = silent -show_error_codes = True +show_error_codes = true -warn_unused_configs = True -allow_any_generics = False -allow_subclassing_any = False -allow_untyped_calls = False -allow_untyped_defs = False -allow_incomplete_defs = False -check_untyped_defs = True -allow_untyped_decorators = False -no_implicit_optional = True -warn_redundant_casts = True -warn_unused_ignores = True -warn_return_any = True -implicit_reexport = False +warn_unused_configs = true +allow_any_generics = false +allow_subclassing_any = false +allow_untyped_calls = false +allow_untyped_defs = false +allow_incomplete_defs = false +check_untyped_defs = true +allow_untyped_decorators = false +no_implicit_optional = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_return_any = true +implicit_reexport = false From 6d2951b2b18110a3deb718d34a1d7432611e6484 Mon Sep 17 00:00:00 2001 From: Dionisio E Alonso Date: Sat, 3 Feb 2024 23:31:59 -0300 Subject: [PATCH 2/3] feat(LSP): Amend documentation This is a minimal correction on the comments documenting the use of the file. --- flake8 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake8 b/flake8 index de9c84f..24bd7e8 100644 --- a/flake8 +++ b/flake8 @@ -1,4 +1,6 @@ -# Not in official documentation, but it can be placed in $XDG_CONFIG_HOME +# This does not work from $XDG_CONFIG_HOME, but python-lsp-server looks for it +# in that location anyways. This is explicitly achieved here: +# https://github.com/python-lsp/python-lsp-server/blob/fc2851a/pylsp/config/flake8_conf.py#L52 [flake8] max-line-length = 79 #extend-ignore = E501, W293, W391, E402, W503 # Those are also checked by pylint From 54938dd02ca3ac6db334bd1b532293851cda9d20 Mon Sep 17 00:00:00 2001 From: Dionisio E Alonso Date: Sun, 4 Feb 2024 18:33:28 -0300 Subject: [PATCH 3/3] feat(LSP): Add PyLSP configurations for eglot Replicate the same base configuration used for python-lsp-server in Neovim but for Emacs's Eglot LSP client. --- emacs/init.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 1e8b977..e21eb14 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -14,6 +14,14 @@ (add-hook 'prog-mode-hook #'display-line-numbers-mode) (add-hook 'prog-mode-hook 'eglot-ensure) ; Requires LSP servers in PATH +(setq-default eglot-workspace-configuration + '(:pylsp (:configurationSources ["flake8"] + :plugins (:ruff (:enabled t) + :flake8 (:enabled t) + :pylint (:enabled t) + :pylsp_mypy (:enabled t) + :pycodestyle (:enabled nil) + :pyflakes (:enabled nil))))) (when window-system (set-frame-size (selected-frame) 85 60)) ; After dealing with some nice defaults setup packages