From 523a36b8f10f77c308b40baa80163969ef654044 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Mon, 24 Nov 2025 18:14:46 +0300 Subject: [PATCH] emacs: cleanup python dev --- .emacs.d/modules/sqrt-misc-programming.el | 27 +++------------ Emacs.org | 41 ++++++----------------- 2 files changed, 15 insertions(+), 53 deletions(-) diff --git a/.emacs.d/modules/sqrt-misc-programming.el b/.emacs.d/modules/sqrt-misc-programming.el index 78e95c7..5b9cf85 100644 --- a/.emacs.d/modules/sqrt-misc-programming.el +++ b/.emacs.d/modules/sqrt-misc-programming.el @@ -1,24 +1,14 @@ ;;; -*- lexical-binding: t -*- (use-package ein :commands (ein:run) + :disabled :straight t) -(setq my/pipenv-python-alist '()) - (defun my/get-pipenv-python () (let ((default-directory (projectile-project-root))) - (if (file-exists-p "Pipfile") - (let ((asc (assoc default-directory my/pipenv-python-alist))) - (if asc - (cdr asc) - (let ((python-executable - (string-trim (shell-command-to-string "PIPENV_IGNORE_VIRTUALENVS=1 pipenv run which python 2>/dev/null")))) - (if (string-match-p ".*not found.*" python-executable) - (message "Pipfile found, but not pipenv executable!") - (message (format "Found pipenv python: %s" python-executable)) - (add-to-list 'my/pipenv-python-alist (cons default-directory python-executable)) - python-executable)))) - "python"))) + (cond ((file-exists-p ".venv/bin/python") + (expand-file-name ".venv/bin/python")) + (t (executable-find "python"))))) (use-package lsp-pyright :straight t @@ -31,14 +21,6 @@ (add-hook 'python-mode-hook #'smartparens-mode) (add-hook 'python-mode-hook #'treesit-fold-mode) -(use-package pipenv - :straight t - :hook (python-mode . pipenv-mode) - :init - (setq - pipenv-projectile-after-switch-function - #'pipenv-projectile-after-switch-extended)) - (use-package yapfify :straight (:repo "JorisE/yapfify" :host github) :disabled @@ -128,6 +110,7 @@ (use-package code-cells :straight t + :disabled :commands (code-cells-mode code-cells-convert-ipynb)) (setq my/tensorboard-buffer "TensorBoard-out") diff --git a/Emacs.org b/Emacs.org index 63f358d..684d6fb 100644 --- a/Emacs.org +++ b/Emacs.org @@ -4493,33 +4493,25 @@ An honorary Lisp. :MODULE_NAME: misc-programming :header-args:emacs-lisp: :tangle /home/pavel/.emacs.d/modules/sqrt-misc-programming.el :comments links :END: -*** ein +*** OFF (OFF) ein +CLOSED: [2025-11-24 Mon 18:13] [[https://github.com/millejoh/emacs-ipython-notebook][ein]] is a package that allows for running Jupyter notebooks in Emacs. #+begin_src emacs-lisp (use-package ein :commands (ein:run) + :disabled :straight t) #+end_src *** pyright -For some reason it doesn't use pipenv python executable, so here is a small workaround. -#+begin_src emacs-lisp -(setq my/pipenv-python-alist '()) +A fix to use it with =uv=. +#+begin_src emacs-lisp (defun my/get-pipenv-python () (let ((default-directory (projectile-project-root))) - (if (file-exists-p "Pipfile") - (let ((asc (assoc default-directory my/pipenv-python-alist))) - (if asc - (cdr asc) - (let ((python-executable - (string-trim (shell-command-to-string "PIPENV_IGNORE_VIRTUALENVS=1 pipenv run which python 2>/dev/null")))) - (if (string-match-p ".*not found.*" python-executable) - (message "Pipfile found, but not pipenv executable!") - (message (format "Found pipenv python: %s" python-executable)) - (add-to-list 'my/pipenv-python-alist (cons default-directory python-executable)) - python-executable)))) - "python"))) + (cond ((file-exists-p ".venv/bin/python") + (expand-file-name ".venv/bin/python")) + (t (executable-find "python"))))) (use-package lsp-pyright :straight t @@ -4532,20 +4524,6 @@ For some reason it doesn't use pipenv python executable, so here is a small work (add-hook 'python-mode-hook #'smartparens-mode) (add-hook 'python-mode-hook #'treesit-fold-mode) #+end_src -*** pipenv -[[https://github.com/pypa/pipenv][Pipenv]] is a package manager for Python. - -Automatically creates & manages virtualenvs and stores data in =Pipfile= and =Pipfile.lock= (like npm's =package.json= and =package-lock.json=). - -#+begin_src emacs-lisp -(use-package pipenv - :straight t - :hook (python-mode . pipenv-mode) - :init - (setq - pipenv-projectile-after-switch-function - #'pipenv-projectile-after-switch-extended)) -#+end_src *** OFF (OFF) yapf [[https://github.com/google/yapf][yapf]] is a formatter for Python files. @@ -4710,7 +4688,7 @@ To fix that, I've modified the following function in the =python-pytest= package (setq process (get-buffer-process buffer)) (set-process-sentinel process #'python-pytest--process-sentinel)))) #+end_src -*** code-cells +*** OFF (OFF) code-cells Support for text with magic comments. | Arch dependency | Disabled | @@ -4720,6 +4698,7 @@ Support for text with magic comments. #+begin_src emacs-lisp (use-package code-cells :straight t + :disabled :commands (code-cells-mode code-cells-convert-ipynb)) #+end_src *** tensorboard