3;; If you get ``*** EPC Error ***`` (even after a jedi:install-server) in your
4;; emacs session, mostly you have jedi-mode enabled but the python enviroment is
5;; missed. The python environment has to be next to the
6;; ``<repo>/.dir-locals.el`` in::
10;; In Emacs, some buffer locals are referencing the project environment:
12;; - prj-root --> <repo>/
13;; - python-environment-directory --> <repo>/local
14;; - python-environment-default-root-name --> py3
15;; - python-shell-virtualenv-root --> <repo>/local/py3
16;; When this variable is set with the path of the virtualenv to use,
17;; `process-environment' and `exec-path' get proper values in order to run
18;; shells inside the specified virtualenv, example::
19;; (setq python-shell-virtualenv-root "/path/to/env/")
21;; To setup such an environment build target 'pyenv' or 'pyenvinstall'::
25;; Alternatively create the virtualenv, source it and install jedi + epc
26;; (required by `emacs-jedi <https://tkf.github.io/emacs-jedi>`_)::
28;; $ python -m venv ./local/py3
30;; $ source ./local/py3/bin/activate
31;; (py3)$ # now install into the activated 'py3' environment ..
32;; (py3)$ pip install jedi epc
35;; Here is what also I found useful to add to my .emacs::
37;; (global-set-key [f6] 'flycheck-mode)
38;; (add-hook 'python-mode-hook 'my:python-mode-hook)
40;; (defun my:python-mode-hook ()
41;; (add-to-list 'company-backends 'company-jedi)
42;; (require 'jedi-core)
44;; (define-key python-mode-map (kbd "C-c C-d") 'jedi:show-doc)
45;; (define-key python-mode-map (kbd "M-.") 'jedi:goto-definition)
46;; (define-key python-mode-map (kbd "M-,") 'jedi:goto-definition-pop-marker)
54 . ((indent-tabs-mode . nil)
56 ;; project root folder is where the `.dir-locals.el' is located
58 prj-root (locate-dominating-file default-directory ".dir-locals.el")))
61 python-environment-directory (expand-file-name "./local" prj-root)))
63 ;; use 'py3' enviroment as default
65 python-environment-default-root-name "py3"))
68 python-shell-virtualenv-root
69 (concat python-environment-directory
71 python-environment-default-root-name)))
73 ;; python-shell-virtualenv-path is obsolete, use python-shell-virtualenv-root!
74 ;; (eval . (setq-local
75 ;; python-shell-virtualenv-path python-shell-virtualenv-root))
78 python-shell-interpreter
79 (expand-file-name "bin/python" python-shell-virtualenv-root)))
82 python-environment-virtualenv
83 (list (expand-file-name "bin/virtualenv" python-shell-virtualenv-root)
84 ;;"--system-site-packages"
89 (expand-file-name "bin/pylint" python-shell-virtualenv-root)))
91 ;; pylint will find the '.pylintrc' file next to the CWD
92 ;; https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options
94 flycheck-pylintrc ".pylintrc"))
96 ;; flycheck & other python stuff should use the local py3 environment
98 flycheck-python-pylint-executable python-shell-interpreter))
100 ;; use 'M-x jedi:show-setup-info' and 'M-x epc:controller' to inspect jedi server
102 ;; https://tkf.github.io/emacs-jedi/latest/#jedi:environment-root -- You
103 ;; can specify a full path instead of a name (relative path). In that case,
104 ;; python-environment-directory is ignored and Python virtual environment
105 ;; is created at the specified path.
106 (eval . (setq-local jedi:environment-root python-shell-virtualenv-root))
108 ;; https://tkf.github.io/emacs-jedi/latest/#jedi:server-command
111 (list python-shell-interpreter
115 ;; jedi:environment-virtualenv --> see above 'python-environment-virtualenv'
116 ;; is set buffer local! No need to setup jedi:environment-virtualenv:
118 ;; Virtualenv command to use. A list of string. If it is nil,
119 ;; python-environment-virtualenv is used instead. You must set non-nil
120 ;; value to jedi:environment-root in order to make this setting work.
122 ;; https://tkf.github.io/emacs-jedi/latest/#jedi:environment-virtualenv
124 ;; (eval . (setq-local
125 ;; jedi:environment-virtualenv
126 ;; (list (expand-file-name "bin/virtualenv" python-shell-virtualenv-root)
128 ;; ;;"/usr/bin/python3.4"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list