Use black for python formatting, mypy ignore missing imports on check

This commit is contained in:
Evie Litherland-Smith 2024-07-01 18:09:39 +01:00
parent ce80658ac8
commit 92bbd6abef

13
init.el
View file

@ -811,8 +811,7 @@
tempel-abbrev-mode) tempel-abbrev-mode)
:bind (("M-+" . tempel-complete) :bind (("M-+" . tempel-complete)
("M-*" . tempel-insert)) ("M-*" . tempel-insert))
:hook ((conf-mode prog-mode text-mode) . (lambda () :hook ((conf-mode prog-mode text-mode) . (lambda () (add-hook 'completion-at-point-functions 'tempel-complete nil t)))
(add-hook 'completion-at-point-functions 'tempel-complete nil t)))
:custom :custom
(tempel-trigger-prefix "<")) (tempel-trigger-prefix "<"))
@ -916,14 +915,14 @@
apheleia-mode-alist) apheleia-mode-alist)
:bind (("C-c c f" . apheleia-format-buffer)) :bind (("C-c c f" . apheleia-format-buffer))
:hook (prog-mode) :hook (prog-mode)
:custom (apheleia-remote-algorithm 'local) :custom (apheleia-remote-algorithm 'cancel)
:config :config
(add-to-list 'apheleia-formatters '(alejandra . ("alejandra"))) (add-to-list 'apheleia-formatters '(alejandra . ("alejandra")))
(add-to-list 'apheleia-formatters '(isort . ("isort" "--profile" "black" "-"))) (add-to-list 'apheleia-formatters '(isort . ("isort" "--profile" "black" "-")))
(add-to-list 'apheleia-mode-alist '(nix-mode . alejandra)) (add-to-list 'apheleia-mode-alist '(nix-mode . alejandra))
(add-to-list 'apheleia-mode-alist '(python-base-mode . ruff)) (add-to-list 'apheleia-mode-alist '(python-base-mode . (black isort)))
(add-to-list 'apheleia-mode-alist '(python-mode . ruff)) (add-to-list 'apheleia-mode-alist '(python-mode . (black isort)))
(add-to-list 'apheleia-mode-alist '(python-ts-mode . ruff))) (add-to-list 'apheleia-mode-alist '(python-ts-mode . (black isort))))
(use-package flymake (use-package flymake
:bind (("C-c C-." . flymake-goto-next-error) :bind (("C-c C-." . flymake-goto-next-error)
@ -1046,7 +1045,7 @@ Calls `project-remember-projects-under' for ~/Projects/"
:custom :custom
(python-shell-interpreter "python3") (python-shell-interpreter "python3")
(python-indent-def-block-scale 1) (python-indent-def-block-scale 1)
(python-check-command "mypy --check-untyped-defs --warn-unreachable --show-error-codes") (python-check-command "mypy --check-untyped-defs --warn-unreachable --show-error-codes --ignore-missing-imports")
(python-flymake-command (python-flymake-command
(cond ((executable-find "ruff") '("ruff" "check" "--output-format=pylint" "--stdin-filename=stdin" "-")) (cond ((executable-find "ruff") '("ruff" "check" "--output-format=pylint" "--stdin-filename=stdin" "-"))
((executable-find "flake8") '("flake8" "--max-line-length" "88" "-")) ((executable-find "flake8") '("flake8" "--max-line-length" "88" "-"))