;;; Template .dir-locals.el for micromamba-based Python projects. ;;; Copy into the project root as .dir-locals.el, replace ENV_NAME and ;;; ENVPATH, add packages (e.g. python-lsp-server) to the env, done. ;;; ;;; micromamba create -n ENV_NAME -c conda-forge python=3.12 \ ;;; python-lsp-server ;;; cp this-file /.dir-locals.el # then edit env name/path ((python-mode . ((python-shell-interpreter . "ENVPATH/bin/python") (python-shell-interpreter-args . "-i") ;; Uncomment only if the folder is NOT a git repo: ;; (eval . (add-hook 'project-find-functions ;; (lambda (_) (cons 'transient default-directory)) nil t)) (eval . (setq-local exec-path (cons "ENVPATH/bin" exec-path))) (eval . (setq-local eglot-server-programs '(((python-mode python-ts-mode) . ("ENVPATH/bin/pylsp"))))) (eval . (eglot-ensure)))))