Automatically format Python files

This commit is contained in:
Ohad Livne 2025-06-04 22:44:48 +03:00
parent 01532fbac6
commit 265541d135
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D
2 changed files with 17 additions and 1 deletions

View file

@ -168,6 +168,18 @@
("C-c C-l" . nil))
:hook ((python-mode . load-python-env)))
; Requires the Python package "black"
(use-package blacken
:hook (python-mode . blacken-mode))
; Requires the Python package "isort"
(use-package py-isort
:hook (before-save . (lambda ()
(when (bound-and-true-p blacken-mode)
(py-isort-before-save))))
:config
(setq py-isort-options '("--profile" "black")))
;; Jupyter notebook integration
(use-package ein
:bind (("C-z j" . ein:run)

View file

@ -2,5 +2,9 @@
python3 -m venv .venv
. .venv/bin/activate
pip install 'python-lsp-server[rope]' python-lsp-ruff
pip install \
black \
isort \
'python-lsp-server[rope]' \
python-lsp-ruff
pip install -e .