Tangled to the Homebrew bundle Brewfile
:
brew "python@3.12"
N.B. We install version 3.12 to make TensorFlow work.
python3.12 -m venv ~/.venv/
N.B. We use version 3.12 to make TensorFlow work.
N.B. Avoid the proprietary Anaconda distribution.
(with-eval-after-load 'python (let ((interpreter "~/.venv/bin/ipython")) (setq python-interpreter interpreter python-shell-interpreter interpreter)))
source ~/.venv/bin/activate pip install --upgrade pip
source ~/.venv/bin/activate pip install "python-lsp-server[all]"
N.B. ‘[all]’ installs support for all 3rd-party tooling.
(with-eval-after-load 'eglot (add-to-list 'eglot-server-programs '((python-mode python-ts-mode) . ("~/.venv/bin/pylsp"))))
(with-eval-after-load 'python (add-hook 'python-mode-hook #'eglot-ensure) (add-hook 'python-mode-hook #'outline-minor-mode))
source ~/.venv/bin/activate pip install pyright pylsp-mypy
Ignore with:
# pyright: ignore
# mypy: ignore
source ~/.venv/bin/activate pip install pylsp-rope
source ~/.venv/bin/activate pip install python-lsp-ruff
https://pypi.org/project/black/
source ~/.venv/bin/activate pip install python-lsp-black # black
(with-eval-after-load 'package (add-to-list 'package-selected-packages 'blacken))
(with-eval-after-load 'blacken (setq blacken-executable "~/.venv/bin/black" blacken-line-length 'fill))
;; (add-hook 'python-mode-hook #'blacken-mode)
source ~/.venv/bin/activate python3 -m pip install pandas
N.B. To run Jupyter, execute
source ~/.venv/bin/activate && jupyter notebook
in a shell or in the Compilation mode.
source ~/.venv/bin/activate python3 -m pip install jupytext
(with-eval-after-load 'package (add-to-list 'package-selected-packages 'code-cells) (add-to-list 'package-selected-packages 'drepl))
Make ‘code-cells’ use our Python environment.
(with-eval-after-load 'code-cells (dolist (index (list 0 1)) (setf (nth 0 (nth index code-cells-convert-ipynb-style)) "~/.venv/bin/jupytext")))