• 0 Posts
  • 3 Comments
Joined 1 year ago
cake
Cake day: October 17th, 2023

help-circle

  • I have something like this

    ;; ----- language server
    
    (require 'eglot)
    (add-hook 'python-mode-hook #'eglot-ensure)
    (add-to-list 'eglot-server-programs
    	     `(python-mode
    	       . ,(eglot-alternatives '("pylsp"
    					"jedi-language-server"
    					("pyright-langserver" "--stdio")))))
    
    ;; ----- treesitter
    
    (use-package treesit-auto :ensure t)
    ;; treesit grammar should be installed here: "~/.emacs.d/tree-sitter/"
    
    ;; ----- select interpreter
    
    (setopt python-shell-interpreter ("~/miniconda3/bin/python"))
    (setopt python-shell-interpreter-args "-i")
    
    ;; ----- conda
    
    (use-package conda
      :ensure t
      :custom
      (conda-anaconda-home "~/miniconda3")
      (conda-env-home-directory "~/miniconda3")
      (conda-env-subdirectory "envs")
      :config
      (unless (getenv "CONDA_DEFAULT_ENV")
        (conda-env-activate "base"))))
    
    ;; ----- emacs-jupyter
    
    (use-package jupyter
      :commands
      (jupyter-run-server-repl
       jupyter-run-repl
       jupyter-server-list-kernels))
    (org-babel-jupyter-override-src-block "python") ;; so python becomes jupyter-python in org-babel
    
    ;; ----- other settings
    
    (setopt python-indent-guess-indent-offset-verbose nil)