diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 8bd2a71..d0dadd7 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -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) diff --git a/.local/bin/make-venv b/.local/bin/make-venv index 3de0439..942a9b5 100755 --- a/.local/bin/make-venv +++ b/.local/bin/make-venv @@ -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 .