emacs-jedi_0.2.8+git20220410.81c5a42/0000755000175000017500000000000014224564226016025 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/tox.ini0000644000175000017500000000027614224564226017345 0ustar dogslegdogsleg[tox] envlist = py{27,35,36,37,38,39}, py{27,36}-jedi11 [testenv] deps = pytest jedi>=0.11.0 commands = py.test {posargs} test_jediepcserver.py [pytest] usefixtures = clean_jedi_cache emacs-jedi_0.2.8+git20220410.81c5a42/test_jediepcserver.py0000644000175000017500000000733614224564226022301 0ustar dogslegdogslegimport os import subprocess import sys import textwrap from contextlib import contextmanager import jediepcserver as jep @contextmanager def osenv(*args, **kwds): def putenvs(dct): for (k, v) in dct.items(): if v is None: os.environ.pop(k, None) else: os.environ[k] = v newenv = dict(*args, **kwds) oldenv = dict(zip(newenv, map(os.getenv, newenv))) try: putenvs(newenv) yield finally: putenvs(oldenv) def test_epc_server_runs_fine_in_non_virtualenv(): # See: https://github.com/tkf/emacs-jedi/issues/3 with osenv(VIRTUAL_ENV=None): jep.jedi_epc_server() def test_epc_server_runs_fine_in_virtualenv(): major_version, minor_version = sys.version_info[:2] envname = 'py{}{}'.format(major_version, minor_version) subprocess.check_call(['tox', '-e', envname, '--notest']) relative_venv_path = ".tox/" + envname full_venv_path = os.path.join(os.getcwd(), relative_venv_path) handler = jep.JediEPCHandler(virtual_envs=[full_venv_path]) sys_path = handler.get_sys_path() venv_path = '{0}/lib/python{1}.{2}/site-packages'.format( full_venv_path, major_version, minor_version, ) assert venv_path in sys_path def check_defined_names(source, keys, deftree): stripdict = lambda d: dict((k, d[k]) for k in keys) striptree = lambda ds: [stripdict(ds[0])] + list(map(striptree, ds[1:])) handler = jep.JediEPCHandler() fulldicts = handler.defined_names(textwrap.dedent(source), 'example.py') dicts = list(map(striptree, fulldicts)) assert dicts == deftree def test_defined_names_imports(): item = lambda name, local_name: {'name': name, 'local_name': local_name} keys = ['name', 'local_name'] dicts = [ [item('f', 'f')], [item('g', 'g')], [item('C', 'C'), [item('h', 'C.h')]], ] check_defined_names(""" from module import f g = f(f) class C: h = g """, keys, dicts) def test_defined_names_nested_classes(): item = lambda name, local_name: {'name': name, 'local_name': local_name} keys = ['name', 'local_name'] dicts = [ [item('L1', 'L1'), [item('L2', 'L1.L2'), [item('L3', 'L1.L2.L3'), [item('f', 'L1.L2.L3.f')]], [item('f', 'L1.L2.f')]], [item('f', 'L1.f')]], [item('f', 'f')]] check_defined_names(""" class L1: class L2: class L3: def f(): pass def f(): pass def f(): pass def f(): pass """, keys, dicts) def _get_jedi_script_params(src, filename='example.py'): source = textwrap.dedent(src) lines = source.splitlines() return source, len(lines), len(lines[-1]), filename def test_get_in_function_call(): params = _get_jedi_script_params(""" def foo(bar, baz, *qux, **quux): pass foo( """) handler = jep.JediEPCHandler() result = handler.get_in_function_call(*params) assert result == { 'params': ['bar', 'baz', '*qux', '**quux'], 'index': 0, 'call_name': 'foo', } def test_completion_docstring_raises(monkeypatch): """Test "complete" handler does not fail if "comp.docstring" raises Ref. #339 """ def raise_exception(*args, **kwargs): raise Exception('hello, world') monkeypatch.setattr( 'jedi.api.classes.Completion.docstring', raise_exception ) params = _get_jedi_script_params(""" import os os.chd """) handler = jep.JediEPCHandler() result = handler.complete(*params) assert result == [ { 'word': 'chdir', 'doc': '', 'description': 'def chdir', 'symbol': 'f', }, ] emacs-jedi_0.2.8+git20220410.81c5a42/jedi-core.el0000644000175000017500000014410014224564226020210 0ustar dogslegdogsleg;;; jedi-core.el --- Common code of jedi.el and company-jedi.el -*- lexical-binding: t; -*- ;; Author: Takafumi Arakaki ;; Package-Requires: ((emacs "24") (epc "0.1.0") (python-environment "0.0.2") (cl-lib "0.5")) ;; Version: 0.3.0 ;; This file is NOT part of GNU Emacs. ;; jedi.el is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; jedi.el is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with jedi.el. ;; If not, see . ;;; Commentary: ;; ;;; Code: (require 'cl-lib) (require 'ring) (require 'epc) (require 'python-environment) (declare-function popup-tip "popup") (declare-function pos-tip-show "pos-tip") (defgroup jedi nil "Auto-completion for Python." :group 'completion :prefix "jedi:") (defconst jedi:version "0.3.0") (defvar jedi:source-dir (if load-file-name (file-name-directory load-file-name) default-directory)) (defvar jedi:epc nil) (make-variable-buffer-local 'jedi:epc) (defvar jedi:server-script (convert-standard-filename (expand-file-name "jediepcserver.py" jedi:source-dir)) "Full path to Jedi server script file ``jediepcserver.py``.") (defvar jedi:setup-function nil) (defvar jedi:mode-function nil) ;;; Configuration variables (defcustom jedi:environment-root nil "Name of Python environment to use. If it is nil, `python-environment-default-root-name' is used. You can specify a full path instead of a name (relative path). In that case, `python-environment-directory' is ignored and Python virtual environment is created at the specified path." :group 'jedi :type '(choice (directory (const nil)))) (defcustom jedi:environment-virtualenv nil "``virtualenv`` command to use. A list of string. If it is nil, `python-environment-virtualenv' is used instead. You must set non-`nil' value to `jedi:environment-root' in order to make this setting work." :group 'jedi :type '(repeat string)) (defun jedi:-env-server-command () (let* ((getbin (lambda (x) (python-environment-bin x jedi:environment-root))) (script (or (funcall getbin "jediepcserver") (funcall getbin "jediepcserver.py")))) (when script (list script)))) (defcustom jedi:server-command (or (jedi:-env-server-command) (list "python" jedi:server-script)) "Command used to run Jedi server. .. NOTE:: If you used `jedi:install-server' (recommended) to install Python server jediepcserver.py, you don't need to mess around with jediepcserver.py. Jedi.el handles everything automatically. If you install Python server jediepcserver.py using `jedi:install-server' command, `jedi:server-command' should be automatically set to:: '(\"~/.emacs.d/.python-environments/default/bin/jediepcserver.py\") Otherwise, it is set to:: '(\"python\" \"JEDI:SOURCE-DIR/jediepcserver.py\") .. NOTE:: If you installed jediepcserver.py manually, then you have to set `jedi:server-command' appropriately. If you can run ``jediepcserver.py --help`` in your shell, then you can simply set:: (setq jedi:server-command '(\"jediepcserver.py\")) Otherwise, you need to find where you installed jediepcserver.py then set the path directly:: (setq jedi:server-command '(\"PATH/TO/jediepcserver.py\")) If you want to use a specific version of Python, setup `jedi:environment-virtualenv' variable appropriately and reinstall jediepcserver.py. If you want to pass some arguments to the Jedi server command, use `jedi:server-args' instead of appending them `jedi:server-command'." :group 'jedi :type '(repeat string)) (defcustom jedi:server-args nil "Command line arguments to be appended to `jedi:server-command'. If you want to add some special `sys.path' when starting Jedi server, do something like this:: (setq jedi:server-args '(\"--sys-path\" \"MY/SPECIAL/PATH\" \"--sys-path\" \"MY/OTHER/SPECIAL/PATH\")) If you want to include some virtualenv, do something like the following. Note that actual environment variable ``VIRTUAL_ENV`` is treated automatically so you don't need to pass it. Also, you need to start Jedi EPC server with the same python version that you use for the virtualenv.:: (setq jedi:server-args '(\"--virtual-env\" \"SOME/VIRTUAL_ENV_1\" \"--virtual-env\" \"SOME/VIRTUAL_ENV_2\")) To see what other arguments Jedi server can take, execute the following command:: python jediepcserver.py --help **Advanced usage** Sometimes you want to configure how Jedi server is started per buffer. To do that, you should make this variable buffer local in `python-mode-hook' and set it to some buffer specific variable, like this:: (defun my-jedi-server-setup () (let ((cmds (GET-SOME-PROJECT-SPECIFIC-COMMAND)) (args (GET-SOME-PROJECT-SPECIFIC-ARGS))) (when cmds (set (make-local-variable 'jedi:server-command) cmds)) (when args (set (make-local-variable 'jedi:server-args) args)))) (add-hook 'python-mode-hook 'my-jedi-server-setup) Note that Jedi server run by the same command is pooled. So, there is only one Jedi server for the same set of command. If you want to check how many EPC servers are running, use the EPC GUI: M-x `epc:controller'. You will see a table of EPC connections for Jedi.el and other EPC applications. If you want to start a new ad-hoc server for the current buffer, use the command `jedi:start-dedicated-server'." :group 'jedi :type '(repeat string)) (defcustom jedi:complete-on-dot nil "Non-`nil' means automatically start completion after inserting a dot. To make this option work, you need to use `jedi:setup' instead of `jedi:ac-setup' to start Jedi." :group 'jedi :type 'boolean) (defcustom jedi:tooltip-method '(pos-tip popup) "Configuration for `jedi:tooltip-show'. This is a list which may contain symbol(s) `pos-tip' and/or `popup'. It determines tooltip method to use. Setting this value to nil means to use minibuffer instead of tooltip." :group 'jedi :type '(repeat (choice (const pos-tip) (const popup)))) (defcustom jedi:get-in-function-call-timeout 3000 "Cancel request to server for call signature after this period specified in in millisecond." :group 'jedi :type 'integer) (defcustom jedi:get-in-function-call-delay 1000 "How long Jedi should wait before showing call signature tooltip in millisecond." :group 'jedi :type 'integer) (defcustom jedi:goto-definition-config '((nil nil nil) (t nil nil) (nil definition nil) (t definition nil) (nil nil t ) (t nil t ) (nil definition t ) (t definition t )) "Configure how prefix argument modifies `jedi:goto-definition' behavior. Each element of the list is arguments (list) passed to `jedi:goto-definition'. Note that this variable has no effect on `jedi:goto-definition' when it is used as a lisp function The following setting is default (last parts are omitted). Nth element is used as the argument when N universal prefix arguments (``C-u``) are given.:: (setq jedi:goto-definition-config '((nil nil nil) ; C-. (t nil nil) ; C-u C-. (nil definition nil) ; C-u C-u C-. (t definition nil) ; C-u C-u C-u C-. ...)) For example, if you want to follow \"substitution path\" by default, use the setting like this:: (setq jedi:goto-definition-config '((nil definition nil) (t definition nil) (nil nil nil) (t nil nil) (nil definition t ) (t definition t ) (nil nil t ) (t nil t ))) You can rearrange the order to have most useful sets of arguments at the top." :group 'jedi :type '(repeat (choice (const nil) (const t) (const definition)))) (defcustom jedi:doc-mode 'rst-mode "Major mode to use when showing document." :group 'jedi :type 'function) (defcustom jedi:doc-hook '(view-mode) "The hook that's run after showing a document." :type 'hook :group 'jedi) (defcustom jedi:goto-definition-hook nil "The hook that's run after jumping to a definition location." :type 'hook :group 'jedi) (defcustom jedi:doc-display-buffer 'display-buffer "A function to be called with a buffer to show document." :group 'jedi :type 'function) (defcustom jedi:install-imenu nil "If `t', use Jedi to create `imenu' index." :group 'jedi :type 'boolean) (defcustom jedi:imenu-create-index-function 'jedi:create-nested-imenu-index "`imenu-create-index-function' for Jedi.el. It must be a function that takes no argument and return an object described in `imenu--index-alist'. This can be set to `jedi:create-flat-imenu-index'. Default is `jedi:create-nested-imenu-index'." :group 'jedi :type 'function) (make-obsolete-variable 'jedi:setup-keys nil "0.1.3") (defcustom jedi:setup-keys nil "Setup recommended keybinds. .. warning:: Use of this value is obsolete now. As of 0.1.3, jedi.el has default keybinds, which are different than these. See also `jedi-mode'. .. admonition:: Default keybinds ```` : = `jedi:key-complete' Complete code at point. (`jedi:complete') ``C-.`` : = `jedi:key-goto-definition' Goto the definition of the object at point. (`jedi:goto-definition') ``C-c d`` : = `jedi:key-show-doc' Show the documentation of the object at point. (`jedi:show-doc') ``C-c r`` : = `jedi:key-related-names' Find related names of the object at point. (`helm-jedi-related-names' / `anything-jedi-related-names') When `jedi:setup-keys' is non-`nil', recommended keybinds are set in `jedi-mode-map' when **loading** jedi.el. Therefore, you must set this value before jedi.el is loaded. As recommended usage of jedi.el is to call `jedi:setup' via `python-mode-hook' where `jedi:setup' is autloaded, setting `jedi:setup-keys' to `t' in you emacs setup (e.g., ``.emacs.d/init.el``) works fine.:: (setq jedi:setup-keys t) (add-hook 'python-mode-hook 'jedi:setup) If you want to require jedi.el explicitly when loading Emacs, make sure to set `jedi:setup-keys' before loading jedi.el:: (setq jedi:setup-keys t) (require 'jedi) Byte compiler warns about unbound variable if you set `jedi:setup-keys' before loading jedi.el. The proper way to suppress this warning is the following:: (eval-when-compile (require 'jedi nil t)) (setq jedi:setup-keys t) You can change these keybinds by changing `jedi:key-complete', `jedi:key-goto-definition', `jedi:key-show-doc', and `jedi:key-related-names'. For example, default keybind for ropemacs's `rope-show-doc' is same as `jedi:show-doc'. You can avoid collision by something like this:: (setq jedi:key-show-doc (kbd \"C-c D\"))" :group 'jedi :type 'boolean) (defun jedi:-custom-set-key-string (sym defs) "Convert key sequence DEFS from string and store into in SYM." (custom-set-default sym (kbd defs))) (defun jedi:-custom-get-key-string (sym) "Convert key sequence stored in SYM to string representation." (key-description (default-value sym))) (defcustom jedi:key-complete "" "Keybind for command `jedi:complete'." :group 'jedi :type 'string :set #'jedi:-custom-set-key-string :get #'jedi:-custom-get-key-string) (defcustom jedi:key-goto-definition "C-." "Keybind for command `jedi:goto-definition'." :group 'jedi :type 'string :set #'jedi:-custom-set-key-string :get #'jedi:-custom-get-key-string) (defcustom jedi:key-show-doc "C-c d" "Keybind for command `jedi:show-doc'." :group 'jedi :type 'string :set #'jedi:-custom-set-key-string :get #'jedi:-custom-get-key-string) (defcustom jedi:key-related-names "C-c r" "Keybind for command `helm-jedi-related-names' or `anything-jedi-related-names'." :group 'jedi :type 'string :set #'jedi:-custom-set-key-string :get #'jedi:-custom-get-key-string) (defcustom jedi:key-goto-definition-pop-marker "C-," "Keybind for command `jedi:goto-definition-pop-marker'." :group 'jedi :type 'string :set #'jedi:-custom-set-key-string :get #'jedi:-custom-get-key-string) (defcustom jedi:use-shortcuts nil "If non-`nil', enable the following shortcuts: | ``M-.`` `jedi:goto-definition' | ``M-,`` `jedi:goto-definition-pop-marker' " :group 'jedi :type 'boolean) (defcustom jedi:import-python-el-settings t "Automatically import settings from python.el variables." :group 'jedi :type 'boolean) (defcustom jedi:goto-definition-marker-ring-length 16 "Length of marker ring to store `jedi:goto-definition' call positions" :group 'jedi :type 'integer) ;;; Internal variables (defvar jedi:get-in-function-call--d nil "Bound to deferred object while requesting get-in-function-call") (defvar jedi:defined-names--singleton-d nil "Bound to deferred object while requesting defined_names") ;;; Jedi mode (defvar jedi-mode-map (make-sparse-keymap)) (defun jedi:handle-post-command () (jedi:get-in-function-call-when-idle)) (define-minor-mode jedi-mode "Jedi mode. When `jedi-mode' is on, call signature is automatically shown as toolitp when inside of function call. \\{jedi-mode-map}" :keymap jedi-mode-map :group 'jedi (let ((map jedi-mode-map)) (when jedi:use-shortcuts (define-key map (kbd "M-.") 'jedi:goto-definition) (define-key map (kbd "M-,") 'jedi:goto-definition-pop-marker))) (if jedi-mode (progn (when jedi:install-imenu (jedi:defined-names-deferred) (setq imenu-create-index-function jedi:imenu-create-index-function)) (add-hook 'post-command-hook 'jedi:handle-post-command nil t) (add-hook 'kill-buffer-hook 'jedi:server-pool--gc-when-idle nil t)) (remove-hook 'post-command-hook 'jedi:handle-post-command t) (remove-hook 'kill-buffer-hook 'jedi:server-pool--gc-when-idle t) (jedi:server-pool--gc-when-idle)) (when jedi:mode-function (funcall jedi:mode-function))) ;; Define keybinds. ;; See: https://github.com/tkf/emacs-jedi/issues/47 (let ((map jedi-mode-map)) (when (and (boundp 'auto-complete-mode) auto-complete-mode) (define-key map (kbd "") 'jedi:complete)) (define-key map (kbd "C-c ?") 'jedi:show-doc) (define-key map (kbd "C-c .") 'jedi:goto-definition) (define-key map (kbd "C-c ,") 'jedi:goto-definition-pop-marker) (let ((command (cond ((featurep 'helm) 'helm-jedi-related-names) ((featurep 'anything) 'anything-jedi-related-names) ((locate-library "helm") 'helm-jedi-related-names) ((locate-library "anything") 'anything-jedi-related-names)))) (when command (define-key map (kbd "C-c /") command)))) (when jedi:setup-keys (let ((map jedi-mode-map)) (define-key map jedi:key-complete 'jedi:complete) (define-key map jedi:key-goto-definition 'jedi:goto-definition) (define-key map jedi:key-show-doc 'jedi:show-doc) (define-key map jedi:key-goto-definition-pop-marker 'jedi:goto-definition-pop-marker) (let ((command (cond ((featurep 'helm) 'helm-jedi-related-names) ((featurep 'anything) 'anything-jedi-related-names)))) (when command (define-key map jedi:key-related-names command))))) ;;; EPC utils (defun jedi:epc--live-p (mngr) "Return non-nil when MNGR is an EPC manager object with a live connection." (let ((proc (ignore-errors (epc:connection-process (epc:manager-connection mngr))))) (and (processp proc) ;; Same as `process-live-p' in Emacs >= 24: (memq (process-status proc) '(run open listen connect stop))))) (defmacro jedi:-with-run-on-error (body &rest run-on-error) (declare (indent 1)) `(let ((something-happened t)) (unwind-protect (prog1 ,body (setq something-happened nil)) (when something-happened ,@run-on-error)))) (defun jedi:epc--make-server-output-msg (line-count) "Extract up to LINE-COUNT last lines from last failed EPC buffer." (let ((epc-buffer (get-buffer (epc:server-buffer-name epc:uid))) is-part lines) (if (not (buffer-live-p epc-buffer)) "" (with-current-buffer epc-buffer (save-excursion (goto-char (point-max)) (forward-line -10) (setq is-part (not (eq (point) (point-min)))) (setq lines (buffer-substring-no-properties (point) (point-max))))) (format "*** EPC Server Output (last %s lines) ***\n%s%s\n" line-count (if is-part "<...snipped, see all with `epc:pop-to-last-server-process-buffer'...>\n" "") lines)))) (defun jedi:epc--start-epc (server-prog server-args) "Same as `epc:start-epc', but set query-on-exit flag for associated processes to nil." (let ((mngr (condition-case epc-error (epc:start-epc server-prog server-args) (error (let* ((cmdline-args (append (list server-prog) server-args)) (cmd (executable-find server-prog)) (cmd-str (or cmd (format "nil (%S not found in exec-path)" server-prog))) (virtual-env (getenv "VIRTUAL_ENV")) (warning-msg (format " ================================ Failed to start Jedi EPC server. ================================ *** EPC Error *** %s %s *** EPC Server Config *** Server arguments: %S Actual command: %s VIRTUAL_ENV envvar: %S *** jedi-mode is disabled in %S *** Fix the problem and re-enable it. *** You may need to run \"M-x jedi:install-server\". *** This could solve the problem especially if you haven't run the command yet since Jedi.el installation or update and if the server complains about Python module imports." (cadr epc-error) (jedi:epc--make-server-output-msg 10) cmdline-args cmd-str virtual-env (current-buffer)))) (display-warning 'jedi warning-msg :error) (jedi-mode 0)))))) (set-process-query-on-exit-flag (epc:connection-process (epc:manager-connection mngr)) nil) (set-process-query-on-exit-flag (epc:manager-server-process mngr) nil) mngr)) ;;; Server pool (defvar jedi:server-pool--table (make-hash-table :test 'equal) "A hash table that holds a pool of EPC server instances.") (defun jedi:server-pool--resolve-command (command) "Resolve COMMAND using current environment. Tries to find (car command) in \"exec-path\"." (let ((command-path (executable-find (car command)))) (if command-path (cons command-path (cdr command)) command))) (defun jedi:server-pool--start (command) "Get an EPC server for COMMAND from server pool or start a new one." (let* ((resolved-command (jedi:server-pool--resolve-command command)) (cached (gethash resolved-command jedi:server-pool--table))) (if (and cached (jedi:epc--live-p cached)) cached (let* ((default-directory "/") (mngr (jedi:epc--start-epc (car resolved-command) (cdr command)))) (puthash resolved-command mngr jedi:server-pool--table) (jedi:server-pool--gc-when-idle) mngr)))) (defun jedi:-get-servers-in-use () "Return a list of non-nil `jedi:epc' in all buffers." (cl-loop with mngr-list for buffer in (buffer-list) for mngr = (with-current-buffer buffer jedi:epc) when (and mngr (not (memq mngr mngr-list))) collect mngr into mngr-list finally return mngr-list)) (defvar jedi:server-pool--gc-timer nil) (defun jedi:server-pool--gc () "Stop unused servers." (let ((servers-in-use (jedi:-get-servers-in-use))) (maphash (lambda (key mngr) (unless (memq mngr servers-in-use) (remhash key jedi:server-pool--table) (epc:stop-epc mngr))) jedi:server-pool--table)) ;; Clear timer so that GC is started next time ;; `jedi:server-pool--gc-when-idle' is called. (setq jedi:server-pool--gc-timer nil)) (defun jedi:server-pool--gc-when-idle () "Run `jedi:server-pool--gc' when idle." (unless jedi:server-pool--gc-timer (setq jedi:server-pool--gc-timer (run-with-idle-timer 10 nil 'jedi:server-pool--gc)))) ;;; Server management (defun jedi:start-server () (if (jedi:epc--live-p jedi:epc) (message "Jedi server is already started!") (setq jedi:epc (jedi:server-pool--start (append jedi:server-command jedi:server-args)))) jedi:epc) (defun jedi:stop-server () "Stop Jedi server. Use this command when you want to restart Jedi server (e.g., when you changed `jedi:server-command' or `jedi:server-args'). Jedi srever will be restarted automatically later when it is needed." (interactive) (if jedi:epc (epc:stop-epc jedi:epc) (message "Jedi server is already killed.")) (setq jedi:epc nil) ;; It could be non-nil due to some error. Rescue it in that case. (setq jedi:get-in-function-call--d nil) (setq jedi:defined-names--singleton-d nil)) (defun jedi:stop-all-servers () "Stop all live Jedi servers. This is useful to apply new settings or VIRTUAL_ENV variable value to all buffers." (interactive) ;; Kill all servers attached to buffers (cl-dolist (buf (buffer-list)) (when (buffer-live-p buf) (with-current-buffer buf (when (jedi:epc--live-p jedi:epc) (jedi:stop-server))))) ;; Kill all unused servers too. (jedi:server-pool--gc)) (defun jedi:get-epc () "Get an EPC instance of a running server or start a new one." (if (jedi:epc--live-p jedi:epc) jedi:epc (jedi:start-server))) ;;;###autoload (defun jedi:start-dedicated-server (command) "Start Jedi server dedicated to this buffer. This is useful, for example, when you want to use different `sys.path' for some buffer. When invoked as an interactive command, it asks you how to start the Jedi server. You can edit the command in minibuffer to specify the way Jedi server run. If you want to setup how Jedi server is started programmatically per-buffer/per-project basis, make `jedi:server-command' and `jedi:server-args' buffer local and set it in `python-mode-hook'. See also: `jedi:server-args'." (interactive (list (split-string-and-unquote (read-string "Run Jedi server: " (mapconcat #'identity (append jedi:server-command jedi:server-args) " "))))) ;; Reset `jedi:epc' so that a new server is created when COMMAND is ;; new. If it is already in the server pool, the server instance ;; already in the pool is picked up by `jedi:start-server'. (setq jedi:epc nil) ;; Set `jedi:server-command', so that this command is used ;; when restarting EPC server of this buffer. (set (make-local-variable 'jedi:server-command) command) (set (make-local-variable 'jedi:server-args) nil) (jedi:start-server)) (defun jedi:-buffer-file-name () "Return `buffer-file-name' without text properties. See: https://github.com/tkf/emacs-jedi/issues/54" (substring-no-properties (or (buffer-file-name) ""))) (defun jedi:call-deferred (method-name) "Call ``Script(...).METHOD-NAME()`` and return a deferred object." (let ((source (buffer-substring-no-properties (point-min) (point-max))) (source-path (jedi:-buffer-file-name)) ;; line=0 is an error for jedi, but is possible for empty buffers. (line (max 1 (count-lines (point-min) (min (1+ (point)) (point-max))))) (column (- (point) (line-beginning-position)))) (epc:call-deferred (jedi:get-epc) method-name (list source line column source-path)))) ;;; Completion (defvar jedi:complete-reply nil "Last reply to `jedi:complete-request'.") (defvar jedi:complete-request-point 0 ;; It is passed to `=', so do not initialize this value by `nil'. "The point where `jedi:complete-request' is called.") (defun jedi:complete-request () "Request ``Script(...).complete`` and return a deferred object. `jedi:complete-reply' is set to the reply sent from the server." (setq jedi:complete-request-point (point)) (deferred:nextc (jedi:call-deferred 'complete) (lambda (reply) (setq jedi:complete-reply reply)))) ;;; Call signature (get_in_function_call) (defface jedi:highlight-function-argument '((t (:inherit bold))) "Face used for the argument at point in a function's argument list" :group 'jedi) (cl-defun jedi:get-in-function-call--construct-call-signature (&key params index call_name) (if (not index) (concat call_name "()") (let ((current-arg (nth index params))) (when (and current-arg (null jedi:tooltip-method)) (setf (nth index params) (propertize current-arg 'face 'jedi:highlight-function-argument))) (concat call_name "(" (mapconcat #'identity params ", ") ")")))) (defun jedi:get-in-function-call--tooltip-show (args) (when (and args (or (and (boundp 'ac-completing) (not ac-completing)) (and (boundp 'company-pseudo-tooltip-overlay) (not company-pseudo-tooltip-overlay)))) (jedi:tooltip-show (apply #'jedi:get-in-function-call--construct-call-signature args)))) (defun jedi:get-in-function-call () "Manually show call signature tooltip." (interactive) (deferred:nextc (jedi:call-deferred 'get_in_function_call) #'jedi:get-in-function-call--tooltip-show)) (defun jedi:get-in-function-call-when-idle () "Show tooltip when Emacs is ilde." (unless jedi:get-in-function-call--d (setq jedi:get-in-function-call--d (deferred:try (deferred:$ (deferred:wait-idle jedi:get-in-function-call-delay) (deferred:nextc it (lambda () (when jedi-mode ; cursor may be moved (deferred:timeout jedi:get-in-function-call-timeout nil (jedi:call-deferred 'get_in_function_call))))) (deferred:nextc it #'jedi:get-in-function-call--tooltip-show)) :finally (lambda () (setq jedi:get-in-function-call--d nil)))))) (defun jedi:tooltip-show (string) (cond ((and (memq 'pos-tip jedi:tooltip-method) window-system (featurep 'pos-tip)) (pos-tip-show (jedi:string-fill-paragraph string) 'popup-tip-face nil nil 0)) ((and (memq 'popup jedi:tooltip-method) (featurep 'popup)) (popup-tip string)) (t (when (stringp string) (let ((message-log-max nil)) (message string)))))) (defun jedi:string-fill-paragraph (string &optional justify) (with-temp-buffer (erase-buffer) (insert string) (goto-char (point-min)) (fill-paragraph justify) (buffer-string))) ;;; Goto (defvar jedi:goto-definition--index nil) (defvar jedi:goto-definition--cache nil) (defvar jedi:goto-definition--marker-ring (make-ring jedi:goto-definition-marker-ring-length) "Marker ring that stores `jedi:goto-definition' call positions") (defun jedi:goto-definition (&optional other-window deftype use-cache index) "Goto the definition of the object at point. See `jedi:goto-definition-config' for how this function works when universal prefix arguments \(``C-u``) are given. If *numeric* prefix argument(s) \(e.g., ``M-0``) are given, goto point of the INDEX-th result. Note that you cannot mix universal and numeric prefixes. It is Emacs's limitation. If you mix both kinds of prefix, you get numeric prefix. When used as a lisp function, popup a buffer when OTHER-WINDOW is non-nil. DEFTYPE must be either `assignment' (default) or `definition'. When USE-CACHE is non-nil, use the locations of the last invocation of this command. If INDEX is specified, goto INDEX-th result." (interactive (if (integerp current-prefix-arg) (list nil nil nil current-prefix-arg) (nth (let ((i (car current-prefix-arg))) (if i (floor (log i 4)) 0)) jedi:goto-definition-config))) (cond ((and (or use-cache index) jedi:goto-definition--cache) (setq jedi:goto-definition--index (or index 0)) (jedi:goto-definition--nth other-window)) ((and (eq last-command 'jedi:goto-definition) (> (length jedi:goto-definition--cache) 1)) (jedi:goto-definition-next other-window)) (t (setq jedi:goto-definition--index (or index 0)) (deferred:nextc (jedi:call-deferred (cl-case deftype ((assignment nil) 'goto) (definition 'get_definition) (t (error "Unsupported deftype: %s" deftype)))) (lambda (reply) (jedi:goto-definition--callback reply other-window)))))) (defun jedi:goto-definition-push-marker () "Push point onto goto-definition marker ring." (ring-insert jedi:goto-definition--marker-ring (point-marker))) (defun jedi:goto-definition-pop-marker () "Goto the last point where `jedi:goto-definition' was called." (interactive) (if (ring-empty-p jedi:goto-definition--marker-ring) (error "Jedi marker ring is empty, can't pop") (let ((marker (ring-remove jedi:goto-definition--marker-ring 0))) (switch-to-buffer (or (marker-buffer marker) (error "Buffer has been deleted"))) (goto-char (marker-position marker)) ;; Cleanup the marker so as to avoid them piling up. (set-marker marker nil nil)))) (defun jedi:goto-definition-next (&optional other-window) "Goto the next cached definition. See: `jedi:goto-definition'." (interactive "P") (let ((len (length jedi:goto-definition--cache)) (n (1+ jedi:goto-definition--index))) (setq jedi:goto-definition--index (if (>= n len) 0 n)) (jedi:goto-definition--nth other-window))) (defun jedi:goto-definition--callback (reply other-window) (if (not reply) (message "Definition not found.") (setq jedi:goto-definition--cache reply) (jedi:goto-definition--nth other-window t))) (defun jedi:goto--line-column (line column) "Like `goto-char' but specify the position by LINE and COLUMN." (goto-char (point-min)) (forward-line (1- line)) (forward-char column)) (defvar jedi:find-file-function #'jedi:find-file "Function that reads a source file for jedi navigation. It must take these arguments: (file-to-read other-window-flag line_number column_number).") (defun jedi:find-file (file line column other-window) "Default function used by jedi to find a source FILE, LINE= and COLUMN, possibly in OTHER-WINDOW." (funcall (if other-window #'find-file-other-window #'find-file) file) (jedi:goto--line-column line column)) (defun jedi:goto-definition--nth (other-window &optional try-next) (let* ((len (length jedi:goto-definition--cache)) (n jedi:goto-definition--index) (next (lambda () (when (< n (1- len)) (cl-incf jedi:goto-definition--index) (jedi:goto-definition--nth other-window) t)))) (cl-destructuring-bind (&key line_nr column module_path module_name &allow-other-keys) (nth n jedi:goto-definition--cache) (cond ((equal module_name "__builtin__") (unless (and try-next (funcall next)) (message "Cannot see the definition of __builtin__."))) ((not (and module_path (file-exists-p module_path))) (unless (and try-next (funcall next)) (message "File '%s' does not exist." module_path))) (t (jedi:goto-definition-push-marker) (jedi:find-file module_path line_nr column other-window) (run-hooks 'jedi:goto-definition-hook) (jedi:goto-definition--notify-alternatives len n)))))) (defun jedi:goto-definition--notify-alternatives (len n) (unless (= len 1) (message "%d-th point in %d candidates.%s" (1+ n) len ;; Note: It must be `last-command', not `last-command' because ;; this function is called in deferred at the first time. (if (eq last-command 'jedi:goto-definition) (format " Type %s to go to the next point." (key-description (car (where-is-internal 'jedi:goto-definition)))) "")))) ;;; Full name (defun jedi:get-full-name-deferred () (deferred:$ (jedi:call-deferred 'get_definition) (deferred:nextc it (lambda (reply) (cl-loop for def in reply do (cl-destructuring-bind (&key full_name &allow-other-keys) def (when full_name (return full_name)))))))) (cl-defun jedi:get-full-name-sync (&key (timeout 500)) (epc:sync (jedi:get-epc) (deferred:timeout timeout nil (jedi:get-full-name-deferred)))) ;;; Related names (defun jedi:related-names--source (name candidates) `((name . ,name) (candidates . ,candidates) (recenter) (type . file-line))) (defun jedi:related-names--to-file-line (reply) (mapcar (lambda (x) (cl-destructuring-bind (&key line_nr module_name module_path description &allow-other-keys) x (format "%s:%s: %s - %s" module_path line_nr module_name description))) reply)) (defun jedi:related-names--helm (helm) (deferred:nextc (let ((to-file-line #'jedi:related-names--to-file-line)) (deferred:parallel (deferred:nextc (jedi:call-deferred 'related_names) to-file-line) (deferred:nextc (jedi:call-deferred 'goto) to-file-line))) (lambda (candidates-list) (funcall helm :sources (list (jedi:related-names--source "Jedi Related Names" (car candidates-list)) (jedi:related-names--source "Jedi Goto" (cadr candidates-list))) :buffer (format "*%s jedi:related-names*" helm))))) ;;;###autoload (defun helm-jedi-related-names () "Find related names of the object at point using `helm' interface." (interactive) (jedi:related-names--helm 'helm)) ;;;###autoload (defun anything-jedi-related-names () "Find related names of the object at point using `anything' interface." (interactive) (jedi:related-names--helm 'anything)) ;;; Show document (get-definition) (defvar jedi:doc-buffer-name "*jedi:doc*") (defun jedi:show-doc () "Show the documentation of the object at point." (interactive) (deferred:nextc (jedi:call-deferred 'get_definition) (lambda (reply) (with-current-buffer (get-buffer-create jedi:doc-buffer-name) (cl-loop with has-doc = nil with first = t with inhibit-read-only = t initially (erase-buffer) for def in reply do (cl-destructuring-bind (&key doc full_name &allow-other-keys) def (unless (or (null doc) (equal doc "")) (if first (setq first nil) (insert "\n\n---\n\n")) (insert "Docstring for " full_name "\n\n" doc) (setq has-doc t))) finally do (if (not has-doc) (message "Document not found.") (progn (goto-char (point-min)) (when (fboundp jedi:doc-mode) (funcall jedi:doc-mode)) (run-hooks 'jedi:doc-hook) (funcall jedi:doc-display-buffer (current-buffer))))))))) ;;; Defined names (imenu) (defvar jedi:defined-names--cache nil) (make-variable-buffer-local 'jedi:defined-names--cache) (defun jedi:defined-names-deferred () (deferred:nextc (epc:call-deferred (jedi:get-epc) 'defined_names (list (buffer-substring-no-properties (point-min) (point-max)) (jedi:-buffer-file-name))) (lambda (reply) (setq jedi:defined-names--cache reply)))) (defun jedi:defined-names--singleton-deferred () "Like `jedi:defined-names-deferred', but make sure that only one request at the time is emitted." (unless jedi:defined-names--singleton-d (setq jedi:defined-names--singleton-d (deferred:watch (jedi:defined-names-deferred) (lambda (_) (setq jedi:defined-names--singleton-d nil)))))) (defun jedi:defined-names--sync () (unless jedi:defined-names--cache (epc:sync (jedi:get-epc) (jedi:defined-names--singleton-deferred))) jedi:defined-names--cache) (defun jedi:imenu-make-marker (def) (cl-destructuring-bind (&key line_nr column &allow-other-keys) def (save-excursion (jedi:goto--line-column line_nr column) (point-marker)))) (defun jedi:create-nested-imenu-index--item (def) (cons (plist-get def :name) (jedi:imenu-make-marker def))) (defun jedi:create-nested-imenu-index () "`imenu-create-index-function' for Jedi.el. See also `jedi:imenu-create-index-function'." (when (called-interactively-p 'interactive) (jedi:defined-names--sync)) (jedi:create-nested-imenu-index-1)) (defun jedi:create-nested-imenu-index-1 (&optional items) (cl-loop for (def . subdefs) in (or items jedi:defined-names--cache) if subdefs collect (append (list (plist-get def :local_name) (jedi:create-nested-imenu-index--item def)) (jedi:create-nested-imenu-index-1 subdefs)) else collect (jedi:create-nested-imenu-index--item def))) (defun jedi:create-flat-imenu-index () "`imenu-create-index-function' for Jedi.el to create flatten index. See also `jedi:imenu-create-index-function'." (when (called-interactively-p 'interactive) (jedi:defined-names--sync)) (jedi:create-flat-imenu-index-1)) (defun jedi:create-flat-imenu-index-1 (&optional items) (cl-loop for (def . subdefs) in (or items jedi:defined-names--cache) collect (cons (plist-get def :local_name) (jedi:imenu-make-marker def)) when subdefs append (jedi:create-flat-imenu-index-1 subdefs))) ;;; Meta info (defun jedi:show-setup-info () "Show installation and configuration info in a buffer. Paste the result of this function when asking question or reporting bug. This command also tries to detect errors when communicating with Jedi EPC server. If you have some problem you may find some information about communication error." (interactive) (let (epc get-epc-error version-reply) (condition-case err (setq epc (jedi:get-epc)) (error (setq get-epc-error err))) (when epc (setq version-reply (condition-case err (epc:sync epc (deferred:$ (deferred:timeout 500 '(:timeout nil) (epc:call-deferred epc 'get_jedi_version nil)) (deferred:error it (lambda (err) `(:error ,err))))) (error `(:sync-error ,err))))) (let ((standard-output (get-buffer-create "*jedi:show-setup-info*"))) (with-current-buffer standard-output (emacs-lisp-mode) (erase-buffer) (insert ";; Emacs Lisp version:\n") (pp `(:emacs-version ,emacs-version :jedi-version ,jedi:version :python-environment-version ,python-environment-version)) (insert ";; Python version:\n") (pp version-reply) (when get-epc-error (insert "\n;; EPC error:\n") (pp `(:get-epc-error ,get-epc-error))) (insert ";; Command line:\n") (pp `(:virtualenv ,(executable-find (car python-environment-virtualenv)) :virtualenv-version ,(ignore-errors (jedi:-virtualenv-version)))) (insert ";; Customization:\n") (pp (jedi:-list-customization)) (display-buffer standard-output))))) (defun jedi:-list-defcustoms () (cl-loop for sym being the symbols for name = (symbol-name sym) when (and (or (string-prefix-p "jedi:" name) (string-prefix-p "python-environment-" name)) (custom-variable-p sym)) collect sym)) (defun jedi:-list-customization () (cl-loop for sym in (sort (jedi:-list-defcustoms) (lambda (x y) (string< (symbol-name x) (symbol-name y)))) collect (cons sym (symbol-value sym)))) (defun jedi:-virtualenv-version () "Return output of virtualenv --version" (with-temp-buffer (erase-buffer) (call-process (executable-find (car python-environment-virtualenv)) nil t nil "--version") (buffer-string))) (defun jedi:get-jedi-version-request () "Request version of Python modules and return a deferred object." (epc:call-deferred (jedi:get-epc) 'get_jedi_version nil)) (defun jedi:show-version-info () "Show version info of Python modules used by the server. Paste the result of this function in bug report." (interactive) (deferred:nextc (jedi:get-jedi-version-request) (lambda (reply) (let ((standard-output (get-buffer-create "*jedi:version*"))) (with-current-buffer standard-output (emacs-lisp-mode) (erase-buffer) (pp `(:emacs-version ,emacs-version :jedi-version ,jedi:version)) (pp reply) (display-buffer standard-output)))))) (define-obsolete-function-alias 'jedi:show-jedi-version 'jedi:show-version-info "0.1.3") (defun jedi:print-jedi-version () (pp (epc:sync (jedi:get-epc) (jedi:get-jedi-version-request)))) ;;; Setup (defun jedi:import-python-el-settings-setup () "Make jedi aware of python.el virtualenv and path settings. This is automatically added to the `jedi-mode-hook' when `jedi:import-python-el-settings' is non-nil." (let ((args)) (when (bound-and-true-p python-shell-extra-pythonpaths) (mapc (lambda (path) (setq args (append (list "--sys-path" path) args))) python-shell-extra-pythonpaths)) (when (bound-and-true-p python-shell-virtualenv-path) (setq args (append (list "--virtual-env" python-shell-virtualenv-path) args))) (when args (set (make-local-variable 'jedi:server-args) (append args jedi:server-args))))) ;;;###autoload (defun jedi:setup () "Fully setup jedi.el for current buffer. It setups `ac-sources' or `company-backends' and turns `jedi-mode' on. This function is intended to be called from `python-mode-hook', like this:: (add-hook 'python-mode-hook 'jedi:setup) You can also call this function as a command, to quickly test what jedi can do." (interactive) (when jedi:setup-function (funcall jedi:setup-function)) (when jedi:import-python-el-settings ;; Hack to access buffer/dir-local vars: http://bit.ly/Y5IfMV. ;; Given that `jedi:setup' is added to the `python-mode-hook' ;; this will modify `hack-local-variables-hook' on python ;; buffers only and will allow us to access buffer/directory ;; local variables in `jedi:import-python-el-settings-setup'. (add-hook 'hack-local-variables-hook #'jedi:import-python-el-settings-setup nil t)) (jedi-mode 1)) ;;; Virtualenv setup (defvar jedi:install-server--command `("pip" "install" "--upgrade" ,(convert-standard-filename jedi:source-dir))) ;;;###autoload (defun jedi:install-server () "This command installs Jedi server script jediepcserver.py in a Python environment dedicated to Emacs. By default, the environment is at ``~/.emacs.d/.python-environments/default/``. This environment is automatically created by ``virtualenv`` if it does not exist. Run this command (i.e., type ``M-x jedi:install-server RET``) whenever Jedi.el shows a message to do so. It is a good idea to run this every time after you update Jedi.el to sync version of Python modules used by Jedi.el and Jedi.el itself. You can modify the location of the environment by changing `jedi:environment-root' and/or `python-environment-directory'. More specifically, Jedi.el will install Python modules under the directory ``PYTHON-ENVIRONMENT-DIRECTORY/JEDI:ENVIRONMENT-ROOT``. Note that you need command line program ``virtualenv``. If you have the command in an unusual location, use `python-environment-virtualenv' to specify the location. .. NOTE:: jediepcserver.py is installed in a virtual environment but it does not mean Jedi.el cannot recognize the modules in virtual environment you are using for your Python development. Jedi EPC server recognize the virtualenv it is in (i.e., the environment variable ``VIRTUAL_ENV`` in your Emacs) and then add modules in that environment to its ``sys.path``. You can also add ``--virtual-env PATH/TO/ENV`` to `jedi:server-args' to include modules of virtual environment even you launch Emacs outside of the virtual environment. .. NOTE:: It is highly recommended to use this command to install Python modules for Jedi.el. You still can install Python modules used by Jedi.el manually. However, you are then responsible for keeping Jedi.el and Python modules compatible. See also: - https://github.com/tkf/emacs-jedi/pull/72 - https://github.com/tkf/emacs-jedi/issues/140#issuecomment-37358527" (interactive) (deferred:$ (python-environment-run jedi:install-server--command jedi:environment-root jedi:environment-virtualenv) (deferred:watch it (lambda (_) (setq-default jedi:server-command (jedi:-env-server-command)))))) ;;;###autoload (defun jedi:reinstall-server () "Reinstall Jedi server script jediepcserver.py." (interactive) (let ((root (python-environment-root-path jedi:environment-root))) (when (yes-or-no-p (format "Reinstall jedi server environment(%s) ?" (abbreviate-file-name root))) (delete-directory root t) (jedi:install-server)))) ;;;###autoload (defun jedi:install-server-block () "Blocking version `jedi:install-server'." (prog1 (python-environment-run-block jedi:install-server--command jedi:environment-root jedi:environment-virtualenv) (setq-default jedi:server-command (jedi:-env-server-command)))) (defcustom jedi:install-python-jedi-dev-command '("pip" "install" "--upgrade" "git+https://github.com/davidhalter/jedi.git@master#egg=jedi") "Pip command to be used for `jedi:install-python-jedi-dev'." :group 'jedi :type '(repeat string) ) (defun jedi:install-python-jedi-dev () "Install developmental version of Python-Jedi from GitHub." (interactive) (deferred:$ (python-environment-run jedi:install-python-jedi-dev-command jedi:environment-root jedi:environment-virtualenv) (deferred:watch it (lambda (_) (message "\ Now restart EPC servers. Then you are ready to go with Jedi-dev!"))))) ;;; Debugging (defun jedi:pop-to-epc-buffer () "Open the buffer associated with EPC server process. Use this command to see the output (e.g., traceback) of the server process." (interactive) (pop-to-buffer (process-buffer (epc:manager-server-process jedi:epc)))) (defun jedi:toggle-log-traceback () "Toggle on/off traceback logging for EPC server for the current buffer. When there is an error during traceback logging is enabled, traceback is printed in the EPC buffer. You can use `jedi:pop-to-epc-buffer' to open that buffer. You can also pass ``--log-traceback`` option to jediepcserver.py to start server with traceback logging turned on. This is useful when there is a problem in communication (thus this command does not work). You can use `jedi:start-dedicated-server' to restart EPC server for the current buffer with specific arguments." (interactive) (deferred:$ (epc:call-deferred (jedi:get-epc) 'toggle_log_traceback nil) (deferred:nextc it (lambda (flag) (message "Traceback logging is %s" (if flag "enabled" "disabled")))))) (defvar jedi:server-command--backup nil) (defvar jedi:server-args--backup nil) (defun jedi:toggle-debug-server () "Setup `jedi:server-command' and `jedi:server-args' to debug server using pdb or ipdb. When this command is called, it essentially execute the following code:: (jedi:stop-server) (setq jedi:server-command (list \"cat\" \"jedi-port.log\" ) jedi:server-args nil) It means to pass the port number recorded in the file jedi-port.log to EPC client. To start Jedi server in terminal and record port to the file, use the following command:: python jediepcserver.py --port-file jedi-port.log --pdb This command will be copied in the kill-ring (clipboard) when this command is called. You can use `--ipdb` instead of `--pdb` to use ipdb instead of pdb. Calling this command again restores the original setting of `jedi:server-command' and `jedi:server-args' then stops the running server." (interactive) (if jedi:server-command--backup (progn (setq jedi:server-command jedi:server-command--backup jedi:server-command--backup nil jedi:server-args jedi:server-args--backup) (jedi:stop-server) (message "Quit debugging. Original setting restored.")) (setq jedi:server-command--backup jedi:server-command jedi:server-args--backup jedi:server-args jedi:server-command (list "cat" (expand-file-name "jedi-port.log" jedi:source-dir)) jedi:server-args nil) (jedi:stop-server) (kill-new "python jediepcserver.py --port-file jedi-port.log --ipdb") (message "Now, start server with: --port-file jedi-port.log --ipdb.\ (command is copied in the kill-ring)"))) (provide 'jedi-core) ;; Local Variables: ;; coding: utf-8 ;; indent-tabs-mode: nil ;; End: ;;; jedi-core.el ends here emacs-jedi_0.2.8+git20220410.81c5a42/Makefile0000644000175000017500000001174414224564226017474 0ustar dogslegdogslegENV = $(PWD)/env VIRTUALENV_SYSTEM_SITE_PACKAGES ?= true VIRTUALENV = \ VIRTUALENV_SYSTEM_SITE_PACKAGES=$(VIRTUALENV_SYSTEM_SITE_PACKAGES) \ virtualenv --python=$(PYTHON) PIP_INSTALL = $(ENV)/$(BINDIR)/pip install JEDI_DEV_URL = https://github.com/davidhalter/jedi/archive/dev.zip PYTHON ?= python CASK ?= cask export EMACS ?= emacs BINDIR ?= bin ELPA_DIR = $(shell EMACS=$(EMACS) $(CASK) package-directory) # See: cask-elpa-dir VIRTUAL_EMACS = ${CASK} exec ${EMACS} -Q \ --eval "(setq jedi:environment-root \"$(ENV)\")" .PHONY : test test-1 tryout clean-elpa requirements env clean-env clean \ print-deps travis-ci doc TEST_DEPS = elpa env test: ${TEST_DEPS} ${MAKE} test-1 test-1: ${VIRTUAL_EMACS} -batch \ -L . -l test-jedi.el -f ert-run-tests-batch-and-exit tox compile: elpa clean-elc ${VIRTUAL_EMACS} -batch \ -L . -f batch-byte-compile *.el clean-elc: rm -rf *.elc tryout: compile env ${VIRTUAL_EMACS} -L . -l tryout-jedi.el doc: elpa make -C doc html ensure-git: test -d .git # Running task that can be run only in git repository elpa: ${ELPA_DIR} ${ELPA_DIR}: Cask ${CASK} install test -d $@ touch $@ clean-elpa: rm -rf ${ELPA_DIR} requirements: @echo "**************************************************************" @echo " ERROR: \"make requirements\" is obsolete!" @echo " Please run \"M-x jedi:install-server\" inside of your Emacs." @echo " * If you are using el-get, please update it first." @echo " See also: https://github.com/dimitri/el-get/pull/1603" @echo "**************************************************************" @exit 1 install-jedi-dev: ${PIP_INSTALL} --upgrade ${JEDI_DEV_URL} env: $(ENV)/$(BINDIR)/jediepcserver $(ENV)/$(BINDIR)/jediepcserver: setup.py ${VIRTUAL_EMACS} -batch -L . -l jedi.el \ --eval "(setq jedi:install-server--command '(\"pip\" \"install\" \"--editable\" \"$(PWD)\"))" \ -f "jedi:install-server-block" test -x $@ clean-env: rm -rf $(ENV) clean-el: clean-elpa clean-elc clean: clean-env clean-el rm -rf .cask print-deps: elpa env @echo "----------------------- Dependencies -----------------------" $(EMACS) --version ${VIRTUAL_EMACS} -batch -L . -l jedi.el -f jedi:print-jedi-version -ls -d $(ENV)/*/python*/site-packages/*egg-info @echo "------------------------------------------------------------" before-test: ${TEST_DEPS} tox --notest travis-ci: print-deps test test ! -d ~/.emacs.d/.python-environments # Run test against Emacs listed in ${EMACS_LIST}. # This is for running tests for multiple Emacs versions. # This is not used in Travis CI. Usage:: # # make EMACS_LIST="emacs emacs-snapshot emacs23" test-all # # See: http://stackoverflow.com/a/12110773/727827 # # Use ${MET_MAKEFLAGS} to do the tests in parallel. # # MET_MAKEFLAGS=-j4 JOBS := $(addprefix job-,${EMACS_LIST}) .PHONY: ${JOBS} ${JOBS}: job-%: ${MAKE} EMACS=$* clean-elc elpa ${MAKE} EMACS=$* ${MET_MAKEFLAGS} test-1 test-all: env ${JOBS} ### Packaging # # Create dist/${PACKAGE}-${VERSION}.tar.gz ready for distribution. # # See: (info "(elisp) Multi-file Packages") PACKAGE = jedi VERSION = $(shell grep ';; Version:' jedi.el | sed 's/^.* \([0-9].*\)$$/\1/') DIST_FILES = jedi-pkg.el jedi.el jediepcserver.py \ Makefile tryout-jedi.el .PHONY: dist ${PACKAGE}-${VERSION}.tar.gz ${PACKAGE}-${VERSION} \ clean-dist clean-dist-all dist: clean-dist ${MAKE} dist-1 dist-1: dist/${PACKAGE}-${VERSION}.tar dist/${PACKAGE}-${VERSION}.tar.gz dist/${PACKAGE}-${VERSION}.tar: ${PACKAGE}-${VERSION}.tar ${PACKAGE}-${VERSION}.tar: ${PACKAGE}-${VERSION} tar --directory dist -cvf dist/$@ $< dist/${PACKAGE}-${VERSION}.tar.gz: ${PACKAGE}-${VERSION}.tar.gz ${PACKAGE}-${VERSION}.tar.gz: ${PACKAGE}-${VERSION} tar --directory dist -cvzf dist/$@ $< ${PACKAGE}-${VERSION}: dist/${PACKAGE}-${VERSION} dist/${PACKAGE}-${VERSION}: mkdir -p $@ cp -v ${DIST_FILES} $@ clean-dist: rm -rf dist/${PACKAGE}-${VERSION}* clean-dist-all: rm -rf dist ### Package installation PACKAGE_USER_DIR = TEST_PACKAGE_DIR = dist/test install-dist: test -d '${PACKAGE_USER_DIR}' ${EMACS} --batch -Q \ -l package \ --eval " \ (add-to-list 'package-archives \ '(\"marmalade\" . \"http://marmalade-repo.org/packages/\") t)" \ --eval '(setq package-user-dir "${PWD}/${PACKAGE_USER_DIR}")' \ --eval '(package-list-packages)' \ --eval '(package-install-file "${PWD}/dist/${PACKAGE}-${VERSION}.tar")' test-install: dist/${PACKAGE}-${VERSION}.tar rm -rf ${TEST_PACKAGE_DIR} mkdir -p ${TEST_PACKAGE_DIR} ${MAKE} install-dist PACKAGE_USER_DIR=${TEST_PACKAGE_DIR} test-install-requirement: test-install ${MAKE} --directory ${TEST_PACKAGE_DIR}/${PACKAGE}-${VERSION} \ requirements ### GH pages MAKE_GH_PAGES = $(MAKE) --directory doc --file gh-pages.mk gh-pages-latest: $(MAKE_GH_PAGES) # Publish released documentation. This task can be run only when the # current revision has tag (i.e., released). gh-pages-released: # Make sure it's on tag git describe --tags --dirty | grep -v - # Run doc/gh-pages.mk $(MAKE_GH_PAGES) DOC_VER=released emacs-jedi_0.2.8+git20220410.81c5a42/conftest.py0000644000175000017500000000126214224564226020225 0ustar dogslegdogslegimport shutil import tempfile import pytest @pytest.fixture(scope='session') def clean_jedi_cache(request): """ Set `jedi.settings.cache_directory` to a temporary directory during test. Note that you can't use built-in `tmpdir` and `monkeypatch` fixture here because their scope is 'function', which is not used in 'session' scope fixture. This fixture is activated in tox.ini. """ import jedi settings = jedi.settings old = settings.cache_directory tmp = tempfile.mkdtemp(prefix='jedi-test-') settings.cache_directory = tmp @request.addfinalizer def restore(): settings.cache_directory = old shutil.rmtree(tmp) emacs-jedi_0.2.8+git20220410.81c5a42/jediepcserver.py0000755000175000017500000004147714224564226021251 0ustar dogslegdogsleg#!/usr/bin/env python """ Jedi EPC server. Copyright (C) 2012 Takafumi Arakaki Author: Takafumi Arakaki This file is NOT part of GNU Emacs. Jedi EPC server is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Jedi EPC server is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Jedi EPC server. If not, see . """ import argparse import glob import itertools import logging import logging.handlers import os import re import site import sys import pkg_resources from collections import namedtuple import jedi import jedi.api import epc import epc.server import sexpdata logger = logging.getLogger('jediepcserver') parser = argparse.ArgumentParser( formatter_class=argparse.RawTextHelpFormatter, description=__doc__) parser.add_argument( '--address', default='localhost') parser.add_argument( '--port', default=0, type=int) parser.add_argument( '--port-file', '-f', default='-', type=argparse.FileType('wt'), help='file to write port on. default is stdout.') parser.add_argument( '--sys-path', '-p', default=[], action='append', help='paths to be inserted at the top of `sys.path`.') parser.add_argument( '--sys-path-append', default=[], action='append', help='paths to be appended at the end of `sys.path`.') parser.add_argument( '--virtual-env', '-v', default=[], action='append', help='paths to be used as if VIRTUAL_ENV is set to it.') parser.add_argument( '--log', help='Save server log to this file.') parser.add_argument( '--log-level', choices=['CRITICAL', 'ERROR', 'WARN', 'INFO', 'DEBUG'], help='Logging level for log file.') parser.add_argument( '--log-rotate-max-size', default=0, type=int, help='Rotate log file after it reaches this size', ) parser.add_argument( '--log-rotate-max-count', default=3, type=int, help='Max number of log rotations before removal', ) parser.add_argument( '--log-traceback', action='store_true', default=False, help='Include traceback in logging output.') parser.add_argument( '--pdb', dest='debugger', const='pdb', action='store_const', help='start pdb when error occurs.') parser.add_argument( '--ipdb', dest='debugger', const='ipdb', action='store_const', help='start ipdb when error occurs.') PY3 = (sys.version_info[0] >= 3) NEED_ENCODE = not PY3 LogSettings = namedtuple( 'LogSettings', [ 'log_file', 'log_level', 'log_rotate_max_size', 'log_rotate_max_count', ], ) try: jedi.create_environment except AttributeError: jedi_create_environment = None else: _cached_jedi_environments = {} def jedi_create_environment(venv, safe=False): """Cache jedi environments to avoid startup cost.""" try: return _cached_jedi_environments[venv] except KeyError: logger.info('Creating jedi environment: %s', venv) if venv is None: jedienv = jedi.api.environment.get_default_environment() else: jedienv = jedi.create_environment(venv, safe=safe) _cached_jedi_environments[venv] = jedienv return jedienv jedi_script_wrapper = jedi.Script JEDI_VERSION = pkg_resources.parse_version(jedi.__version__) if JEDI_VERSION < pkg_resources.parse_version('0.16.0'): class JediScriptCompatWrapper: def __init__(self, code, path, **kwargs): self.source = code self.source_path = path self.kwargs = kwargs def complete(self, line, column): return jedi.Script(self.source, line, column, self.source_path, **self.kwargs).completions() def get_signatures(self, line, column): return jedi.Script(self.source, line, column, self.source_path, **self.kwargs).call_signatures() def goto(self, line, column): return jedi.Script(self.source, line, column, self.source_path, **self.kwargs).goto_assignments() def get_references(self, line, column): return jedi.Script(self.source, line, column, self.source_path, **self.kwargs).usages() def infer(self, line, column): return jedi.Script(self.source, line, column, self.source_path, **self.kwargs).goto_definitions() def get_names(self): return jedi.api.names(self.source, self.source_path, **self.kwargs) jedi_script_wrapper = JediScriptCompatWrapper def get_venv_sys_path(venv): if jedi_create_environment is not None: return jedi_create_environment(venv).get_sys_path() from jedi.evaluate.sys_path import get_venv_path return get_venv_path(venv) class JediEPCHandler(object): def __init__(self, sys_path=None, virtual_envs=None, sys_path_append=None): self.script_kwargs = JediEPCHandler._get_script_path_kwargs( sys_path, virtual_envs, sys_path_append ) def get_sys_path(self): environment = self.script_kwargs.get('environment') if environment is not None: return environment.get_sys_path() sys_path = self.script_kwargs.get('sys_path') if sys_path is not None: return sys_path return sys.path @staticmethod def _get_script_path_kwargs(sys_path, virtual_envs, sys_path_append): result = {} if jedi_create_environment: # Need to specify some environment explicitly to workaround # https://github.com/davidhalter/jedi/issues/1242. Otherwise jedi # will create a lot of child processes. if virtual_envs: primary_env, virtual_envs = virtual_envs[0], virtual_envs[1:] primary_env = path_expand_vars_and_user(primary_env) else: primary_env = None try: result['environment'] = jedi_create_environment(primary_env) except Exception: logger.warning( 'Cannot create environment for %r', primary_env, exc_info=1 ) if primary_env is not None: result['environment'] = jedi_create_environment(None) if not sys_path and not virtual_envs and not sys_path_append: # No additional path customizations. return result # Either multiple environments or custom sys_path extensions are # specified, or jedi version doesn't support environments. final_sys_path = [] sys_path = () if sys_path is None else sys_path final_sys_path.extend(path_expand_vars_and_user(p) for p in sys_path) for p in virtual_envs: final_sys_path.extend(get_venv_sys_path(path_expand_vars_and_user(p))) sys_path_append = () if sys_path_append is None else sys_path_append final_sys_path.extend( path_expand_vars_and_user(p) for p in sys_path_append ) dupes = set() def not_seen_yet(val): if val in dupes: return False dupes.add(val) return True result['sys_path'] = [p for p in final_sys_path if not_seen_yet(p)] return result def jedi_script(self, source, source_path): if NEED_ENCODE: source = source.encode('utf-8') source_path = source_path and source_path.encode('utf-8') return jedi_script_wrapper(code=source, path=source_path, **self.script_kwargs) def complete(self, source, line, column, source_path): def _wrap_completion_result(comp): try: docstr = comp.docstring() except Exception: logger.warning( "Cannot get docstring for completion %s", comp, exc_info=1 ) docstr = "" return dict( word=comp.name, doc=docstr, description=candidates_description(comp), symbol=candidate_symbol(comp), ) return [ _wrap_completion_result(comp) for comp in self.jedi_script(source, source_path).complete(line, column) ] def get_in_function_call(self, source, line, column, source_path): sig = self.jedi_script(source, source_path).get_signatures(line, column) call_def = sig[0] if sig else None if not call_def: return [] return dict( # p.description should do the job. But jedi-vim use replace. # So follow what jedi-vim does... params=[PARAM_PREFIX_RE.sub('', p.description).replace('\n', '') for p in call_def.params], index=call_def.index, call_name=call_def.name, ) def goto(self, source, line, column, source_path): definitions = self.jedi_script(source, source_path).goto(line, column) return [definition_to_short_dict(d) for d in definitions] def related_names(self, source, line, column, source_path): definitions = self.jedi_script(source, source_path).get_references(line, column) return [definition_to_short_dict(d) for d in definitions] def get_definition(self, source, line, column, source_path): definitions = self.jedi_script(source, source_path).infer(line, column) return [definition_to_dict(d) for d in definitions] def defined_names(self, source, source_path): top_level_names = [ defn for defn in self.jedi_script(source, source_path).get_names() if defn.parent().type == 'module' ] return list(map(get_names_recursively, top_level_names)) def get_jedi_version(self): return [dict( name=module.__name__, file=getattr(module, '__file__', []), version=get_module_version(module) or [], ) for module in [sys, jedi, epc, sexpdata]] def candidate_symbol(comp): """ Return a character representing completion type. :type comp: jedi.api.Completion :arg comp: A completion object returned by `jedi.Script.complete`. """ try: return comp.type[0].lower() except (AttributeError, TypeError): return '?' def candidates_description(comp): """ Return `comp.description` in an appropriate format. * Avoid return a string 'None'. * Strip off all newlines. This is required for using `comp.description` as candidate summary. """ desc = comp.description return _WHITESPACES_RE.sub(' ', desc) if desc and desc != 'None' else '' _WHITESPACES_RE = re.compile(r'\s+') PARAM_PREFIX_RE = re.compile(r'^param\s+') """RE to strip unwanted "param " prefix returned by param.description.""" def definition_to_dict(d): return dict( doc=d.docstring(), description=d.description, line_nr=d.line, column=d.column, module_path=str(d.module_path), name=getattr(d, 'name', '?'), full_name=getattr(d, 'full_name', '?'), type=getattr(d, 'type', '?'), ) def definition_to_short_dict(d): return dict( column=d.column, line_nr=d.line, module_path=str(d.module_path) if d.module_path != '__builtin__' else '', module_name=d.module_name, description=d.description, ) def get_names_recursively(definition, parent=None): """ Fetch interesting defined names in sub-scopes under `definition`. :type names: jedi.api_classes.Definition """ d = definition_to_dict(definition) try: d['local_name'] = parent['local_name'] + '.' + d['name'] except (AttributeError, TypeError): d['local_name'] = d['name'] if definition.type == 'class': ds = definition.defined_names() return [d] + [get_names_recursively(c, d) for c in ds] else: return [d] def get_module_version(module): notfound = object() for key in ['__version__', 'version']: version = getattr(module, key, notfound) if version is not notfound: return version try: from pkg_resources import get_distribution, DistributionNotFound try: return get_distribution(module.__name__).version except DistributionNotFound: pass except ImportError: pass def path_expand_vars_and_user(p): return os.path.expandvars(os.path.expanduser(p)) def configure_logging(log_settings): """ :type log_settings: LogSettings """ if not log_settings.log_file: return fmter = logging.Formatter('%(asctime)s:' + logging.BASIC_FORMAT) if log_settings.log_rotate_max_size > 0: handler = logging.handlers.RotatingFileHandler( filename=log_settings.log_file, mode='w', maxBytes=log_settings.log_rotate_max_size, backupCount=log_settings.log_rotate_max_count, ) else: handler = logging.FileHandler(filename=log_settings.log_file, mode='w') handler.setFormatter(fmter) if log_settings.log_level: logging.root.setLevel(log_settings.log_level.upper()) logging.root.addHandler(handler) def jedi_epc_server( address='localhost', port=0, port_file=sys.stdout, sys_path=[], virtual_env=[], sys_path_append=[], debugger=None, log_traceback=None, ): """Start EPC server. :type log_settings: LogSettings """ logger.debug( 'jedi_epc_server: sys_path=%r virtual_env=%r sys_path_append=%r', sys_path, virtual_env, sys_path_append, ) if not virtual_env and os.getenv('VIRTUAL_ENV'): logger.debug( 'Taking virtual env from VIRTUAL_ENV: %r', os.environ['VIRTUAL_ENV'], ) virtual_env = [os.environ['VIRTUAL_ENV']] handler = JediEPCHandler( sys_path=sys_path, virtual_envs=virtual_env, sys_path_append=sys_path_append, ) logger.debug( 'Starting Jedi EPC server with the following sys.path: %r', handler.get_sys_path(), ) server = epc.server.EPCServer((address, port)) server.register_function(handler.complete) server.register_function(handler.get_in_function_call) server.register_function(handler.goto) server.register_function(handler.related_names) server.register_function(handler.get_definition) server.register_function(handler.defined_names) server.register_function(handler.get_jedi_version) @server.register_function def toggle_log_traceback(): server.log_traceback = not server.log_traceback return server.log_traceback port_file.write(str(server.server_address[1])) # needed for Emacs client port_file.write("\n") port_file.flush() if port_file is not sys.stdout: port_file.close() # This is not supported Python-EPC API, but I am using this for # backward compatibility for Python-EPC < 0.0.4. In the future, # it should be passed to the constructor. server.log_traceback = bool(log_traceback) if debugger: server.set_debugger(debugger) handler = logging.StreamHandler() fmter = logging.Formatter('%(asctime)s:' + logging.BASIC_FORMAT) handler.setFormatter(fmter) handler.setLevel(logging.DEBUG) server.logger.addHandler(handler) server.logger.setLevel(logging.DEBUG) return server # def add_virtualenv_path(venv): # """Add virtualenv's site-packages to `sys.path`.""" # venv = os.path.abspath(venv) # paths = glob.glob(os.path.join( # venv, 'lib', 'python*', 'site-packages')) # if not paths: # raise ValueError('Invalid venv: no site-packages found: %s' % venv) # for path in paths: # site.addsitedir(path) def main(args=None): ns = parser.parse_args(args) ns_vars = vars(ns).copy() log_settings = LogSettings( log_file=ns_vars.pop('log'), log_level=ns_vars.pop('log_level'), log_rotate_max_size=ns_vars.pop('log_rotate_max_size'), log_rotate_max_count=ns_vars.pop('log_rotate_max_count'), ) configure_logging(log_settings) server = jedi_epc_server(**ns_vars) server.serve_forever() server.logger.info('exit') if __name__ == '__main__': main() emacs-jedi_0.2.8+git20220410.81c5a42/.travis.yml0000644000175000017500000000220214224564226020132 0ustar dogslegdogslegos: linux dist: xenial language: python git: depth: 3 python: # First python version in this list is the default for matrix.include - "3.7" - "3.9" - "3.8" - "3.6" - "3.5" - "2.7" env: jobs: - EVM_EMACS=emacs-27.1-travis-linux-xenial global: # Turn on --use-mirrors option everywhere (even in tox): - PIP_USE_MIRRORS=t jobs: include: - env: EVM_EMACS=emacs-25.1-travis - env: EVM_EMACS=emacs-25.2-travis - env: EVM_EMACS=emacs-25.3-travis - env: EVM_EMACS=emacs-26.1-travis-linux-xenial - env: EVM_EMACS=emacs-26.3-travis-linux-xenial - env: EVM_EMACS=emacs-27.1-travis-linux-xenial - env: EVM_EMACS=emacs-git-snapshot-travis-linux-xenial before_install: - pip install -q virtualenv tox tox-travis - curl -fsSL https://raw.githubusercontent.com/cask/cask/v0.8.7/go | python - export PATH="/home/travis/.cask/bin:$PATH" - git clone https://github.com/rejeep/evm.git /home/travis/.evm - export PATH="/home/travis/.evm/bin:$PATH" - evm config path /tmp - evm install $EVM_EMACS --use --skip - evm list - emacs --version - cask - make before-test script: make travis-ci emacs-jedi_0.2.8+git20220410.81c5a42/tryout-jedi.el0000644000175000017500000000027214224564226020627 0ustar dogslegdogsleg;; Jedi (autoload 'jedi:setup "jedi" nil t) (add-hook 'python-mode-hook 'jedi:setup) (setq jedi:complete-on-dot t) ;; Local Variables: ;; byte-compile-warnings: (not free-vars) ;; End: emacs-jedi_0.2.8+git20220410.81c5a42/jedi.el0000644000175000017500000000715214224564226017267 0ustar dogslegdogsleg;;; jedi.el --- a Python auto-completion for Emacs -*- lexical-binding: t; -*- ;; Copyright (C) 2015 Takafumi Arakaki ;; Author: Takafumi Arakaki ;; Package-Requires: ((emacs "24") (jedi-core "0.2.2") (auto-complete "1.4")) ;; Version: 0.2.8 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;;; Code: (require 'cl-lib) (require 'auto-complete) (require 'jedi-core) ;;; AC source (defun jedi:ac-direct-matches () (mapcar (lambda (x) (cl-destructuring-bind (&key word doc description symbol) x (popup-make-item word :symbol symbol :document (unless (equal doc "") doc) :summary description))) jedi:complete-reply)) ;;;###autoload (defun jedi:ac-setup () "Add Jedi AC sources to `ac-sources'. If auto-completion is all you need, you can call this function instead of `jedi:setup', like this:: (add-hook 'python-mode-hook 'jedi:ac-setup) Note that this function calls `auto-complete-mode' if it is not already enabled, for people who don't call `global-auto-complete-mode' in their Emacs configuration." (interactive) (add-to-list 'ac-sources 'ac-source-jedi-direct) (unless auto-complete-mode (auto-complete-mode))) (defun jedi:ac-direct-prefix () (or (ac-prefix-default) (when (= jedi:complete-request-point (point)) jedi:complete-request-point))) (defun jedi:after-change-handler (&rest _) (unless (or (ac-menu-live-p) (ac-inline-live-p)) (jedi:defined-names--singleton-deferred))) ;; (makunbound 'ac-source-jedi-direct) (ac-define-source jedi-direct '((candidates . jedi:ac-direct-matches) (prefix . jedi:ac-direct-prefix) (init . jedi:complete-request) (requires . -1))) ;;;###autoload (cl-defun jedi:complete (&key (expand ac-expand-on-auto-complete)) "Complete code at point." (interactive) (deferred:nextc (jedi:complete-request) (lambda () (let ((ac-expand-on-auto-complete expand)) (ac-start :triggered 'command))))) ;; Calling `auto-complete' or `ac-update-greedy' instead of `ac-start' ;; here did not work. (defun jedi:dot-complete (nchars) "Insert dot and complete code at point." (interactive "p") (self-insert-command nchars) (unless (or (/= nchars 1) ;; don't complete if inserted 2+ dots (ac-cursor-on-diable-face-p) ;; don't complete if the dot is immediately after int literal (looking-back "\\(\\`\\|[^._[:alnum:]]\\)[0-9]+\\.")) (jedi:complete :expand nil))) ;;;###autoload (defun jedi:auto-complete-mode () (let ((map jedi-mode-map)) (if jedi:complete-on-dot (define-key map "." 'jedi:dot-complete) (define-key map "." nil))) (when jedi:install-imenu (if jedi-mode (add-hook 'after-change-functions 'jedi:after-change-handler nil t) (remove-hook 'after-change-functions 'jedi:after-change-handler t)))) ;;;###autoload (setq jedi:setup-function #'jedi:ac-setup jedi:mode-function #'jedi:auto-complete-mode) (provide 'jedi) ;;; jedi.el ends here emacs-jedi_0.2.8+git20220410.81c5a42/Cask0000644000175000017500000000034514224564226016633 0ustar dogslegdogsleg(source gnu) (source melpa) (package "jedi" "0" "A Python auto-completion for Emacs") (depends-on "epc") (depends-on "python-environment") (development (depends-on "ert") (depends-on "auto-complete") (depends-on "mocker")) emacs-jedi_0.2.8+git20220410.81c5a42/test-jedi.el0000644000175000017500000002666514224564226020256 0ustar dogslegdogsleg;;; test-jedi.el --- Tests for jedi.el ;; Copyright (C) 2012 Takafumi Arakaki ;; Author: Takafumi Arakaki ;; This file is NOT part of GNU Emacs. ;; test-jedi.el is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; test-jedi.el is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with test-jedi.el. ;; If not, see . ;;; Commentary: ;; ;;; Code: (eval-when-compile (require 'cl)) (require 'ert) (require 'mocker) (require 'jedi) (defmacro with-python-temp-buffer (code &rest body) "Insert `code' and enable `python-mode'. cursor is beginning of buffer" (declare (indent 0) (debug t)) `(with-temp-buffer (setq python-indent-guess-indent-offset nil) (insert ,code) (goto-char (point-min)) (python-mode) (font-lock-fontify-buffer) ,@body)) (defun jedi-testing:sync (d) (epc:sync (jedi:get-epc) d)) (ert-deftest jedi:version () "Check if `jedi:version' can be parsed by `version-to-list'." (version-to-list jedi:version)) ;;; EPC (ert-deftest jedi:complete-request () (with-python-temp-buffer " import json json.l " (goto-char (1- (point-max))) (jedi-testing:sync (jedi:complete-request)) (should (equal (sort (jedi:ac-direct-matches) #'string-lessp) '("load" "loads"))))) (ert-deftest jedi:get-in-function-call-request () (with-python-temp-buffer " def foobar(qux, quux): pass foobar(obj, " (goto-char (1- (point-max))) (destructuring-bind (&key params index call_name) (jedi-testing:sync (jedi:call-deferred 'get_in_function_call)) (should (equal params '("qux" "quux"))) (should (equal index 1)) (should (equal call_name "foobar"))))) (ert-deftest jedi:goto-request () (with-python-temp-buffer " import json json.load " (goto-char (1- (point-max))) (let ((reply (jedi-testing:sync (jedi:call-deferred 'goto)))) (destructuring-bind (&key column line_nr module_path module_name description) (car reply) (should (integerp column)) (should (integerp line_nr)) (should (stringp module_path)) (should (stringp module_name)) (should (stringp description)))))) (ert-deftest jedi:get-definition-request () (with-python-temp-buffer " import json json.load " (goto-char (1- (point-max))) (let ((reply (jedi-testing:sync (jedi:call-deferred 'get_definition)))) (destructuring-bind (&key doc description line_nr column module_path name full_name type) (car reply) (should (stringp doc)) (should (stringp description)) (should (integerp line_nr)) (should (integerp column)) (should (stringp module_path)) (should (stringp name)) (should (stringp full_name)) (should (stringp type)))))) (ert-deftest jedi:show-version-info () (kill-buffer (get-buffer-create "*jedi:version*")) (jedi-testing:sync (jedi:show-version-info)) (should (get-buffer "*jedi:version*"))) ;;; Server pool (defmacro jedi-testing:with-mocked-server (start-epc-records epc--live-p-records buffers &rest body) (declare (indent 3)) `(let ((jedi:server-pool--table (make-hash-table :test 'equal)) (jedi:server-pool--gc-timer nil) ,@(mapcar (lambda (b) `(,b (generate-new-buffer "*jedi test*"))) buffers)) (mocker-let ((jedi:epc--start-epc (x y) ,start-epc-records) ;; FIXME: test suite is not yet adapted to resolving the command to ;; absolute path, so it is mocked to return the command untouched. (jedi:server-pool--resolve-command (command) ((:input-matcher (lambda (&rest _) t) :output-generator (lambda (command) command)))) (jedi:epc--live-p (x) ,epc--live-p-records) ;; Probably this mocking is too "strong". What I need to ;; mock is only `buffer-list' in `jedi:-get-servers-in-use'. (buffer-list () ((:input nil :output-generator (lambda () (loop for b in (list ,@buffers) when (buffer-live-p b) collect b)) :min-occur 0))) (jedi:server-pool--gc-when-idle () ((:record-cls 'mocker-stub-record)))) (macrolet ((check-restart (&rest args) `(jedi-testing:check-start-server ,@args)) (set-server (command &optional args) `(progn (set (make-local-variable 'jedi:server-command) ,command) (set (make-local-variable 'jedi:server-args) ,args)))) (unwind-protect (progn ,@body) (mapc #'kill-buffer (list ,@buffers))))))) (defun jedi-testing:check-start-server (buffer command server) (with-current-buffer buffer (should-not jedi:epc) (should (eq (let ((jedi:server-command command) (jedi:server-args nil)) (jedi:start-server)) server)) (should (eq jedi:epc server)))) (ert-deftest jedi:pool-single-server () "Successive call of `jedi:start-server' with the same setup should return the same server instance." (jedi-testing:with-mocked-server ;; Mock `epc:start-epc': ((:input '("python" ("jediepcserver.py")) :output 'dummy-server)) ;; Mock `jedi:epc--live-p': ((:input '(nil) :output nil) ; via `jedi:start-server' (:input '(dummy-server) :output t)) ; via `jedi:server-pool--start' ;; Buffers to use: (buf1 buf2) (check-restart buf1 '("python" "jediepcserver.py") 'dummy-server) (check-restart buf2 '("python" "jediepcserver.py") 'dummy-server))) (ert-deftest jedi:pool-per-buffer-server () "Successive call of `jedi:start-server' with different setups should return the different server instances." (jedi-testing:with-mocked-server ;; Mock `epc:start-epc': ((:input '("python" ("jediepcserver.py")) :output 'dummy-server-1) (:input '("python3" ("jediepcserver.py")) :output 'dummy-server-2)) ;; Mock `jedi:epc--live-p': ((:input '(nil) :output nil)) ; via `jedi:start-server' ;; Buffers to use: (buf1 buf2) (check-restart buf1 '("python" "jediepcserver.py") 'dummy-server-1) (check-restart buf2 '("python3" "jediepcserver.py") 'dummy-server-2))) (ert-deftest jedi:pool-restart-per-buffer-server () "When one of the server died, only the died server must be rebooted; not still living ones." (jedi-testing:with-mocked-server ;; Mock `epc:start-epc': ((:input '("python" ("jediepcserver.py")) :output 'dummy-server-1) (:input '("python3" ("jediepcserver.py")) :output 'dummy-server-2) (:input '("python" ("jediepcserver.py")) :output 'dummy-server-3)) ;; Mock `jedi:epc--live-p': ((:input '(nil) :output nil) ; via `jedi:start-server' (:input '(dummy-server-1) :output t) (:input '(nil) :output nil) ; via `jedi:start-server' (:input '(dummy-server-1) :output nil) ; server is stopped (:input '(nil) :output nil) ; via `jedi:start-server' (:input '(dummy-server-2) :output t) (:input '(nil) :output nil) ; via `jedi:start-server' (:input '(dummy-server-3) :output t)) ;; Buffers to use: (buf1 buf2 buf3) (check-restart buf1 '("python" "jediepcserver.py") 'dummy-server-1) (check-restart buf2 '("python3" "jediepcserver.py") 'dummy-server-2) (check-restart buf3 '("python" "jediepcserver.py") 'dummy-server-1) (mapc (lambda (b) (with-current-buffer b (setq jedi:epc nil))) (list buf1 buf2 buf3)) ;; Now, ``(jedi:epc--live-p dummy-server-1)`` will return nil: (check-restart buf1 '("python" "jediepcserver.py") 'dummy-server-3) (check-restart buf2 '("python3" "jediepcserver.py") 'dummy-server-2) (check-restart buf3 '("python" "jediepcserver.py") 'dummy-server-3))) (ert-deftest jedi:pool-buffer-local-server-setting () "Locally set `jedi:server-command' and `jedi:server-args' must be used." (jedi-testing:with-mocked-server ;; Mock `epc:start-epc': ((:input '("server" ("-abc")) :output 'dummy-1) (:input '("server" ("-xyz")) :output 'dummy-2)) ;; Mock `jedi:epc--live-p': ((:input '(nil) :output nil) ; via `jedi:start-server' (:input '(dummy-1) :output t)) ; via `jedi:server-pool--start' ;; Buffers to use: (buf1 buf2 buf3) ;; Set buffer local `jedi:server-command': (with-current-buffer buf1 (set-server '("server" "-abc"))) (with-current-buffer buf2 (set-server '("server" "-xyz"))) (with-current-buffer buf3 (set-server '("server" "-abc"))) ;; Check that the buffer local `jedi:server-command' is used: (should (eq (with-current-buffer buf1 (jedi:start-server)) 'dummy-1)) (should (eq (with-current-buffer buf2 (jedi:start-server)) 'dummy-2)) (should (eq (with-current-buffer buf3 (jedi:start-server)) 'dummy-1)))) (ert-deftest jedi:pool-gc-when-no-jedi-buffers () "GC should stop servers when there is no Jedi buffers." (jedi-testing:with-mocked-server ;; Mock `epc:start-epc': ((:input '("server" ("-abc")) :output 'dummy-1) (:input '("server" ("-xyz")) :output 'dummy-2)) ;; Mock `jedi:epc--live-p': ((:input '(nil) :output nil)) ; via `jedi:start-server' ;; Buffers to use: (buf1 buf2) ;; Check that in this mocked environment there is no server yet: (should (= (length (jedi:-get-servers-in-use)) 0)) ;; Start servers: (check-restart buf1 '("server" "-abc") 'dummy-1) (check-restart buf2 '("server" "-xyz") 'dummy-2) ;; GC should not stop servers in use: (jedi:server-pool--gc) (should (= (length (jedi:-get-servers-in-use)) 2)) ;; GC should stop unused servers: (mapc #'kill-buffer (list buf1 buf2)) (mocker-let ((epc:stop-epc (x) ((:input '(dummy-1)) (:input '(dummy-2))))) (jedi:server-pool--gc)) (should (= (length (jedi:-get-servers-in-use)) 0)))) ;;; Misc (ert-deftest jedi:show-setup-info-smoke-test () (jedi:show-setup-info)) ;;; Regression test (ert-deftest regression-test-194 () "Wrong column calculation when using TAB instead of space." (with-python-temp-buffer " def func(a): pass if True: x = 1 func(x) # <- tab indentation " (search-forward "def func(a):") (let ((def-line (line-number-at-pos))) (search-forward "func(x)") (goto-char (match-beginning 0)) (let ((reply (jedi-testing:sync (jedi:call-deferred 'get_definition)))) (destructuring-bind (&key doc line_nr column module_path full_name name type description) (car reply) (should (= line_nr def-line))))))) ;; Local Variables: ;; coding: utf-8 ;; indent-tabs-mode: nil ;; End: ;;; test-jedi.el ends here emacs-jedi_0.2.8+git20220410.81c5a42/CONTRIBUTING.md0000644000175000017500000000137314224564226020262 0ustar dogslegdogsleg# Contribution guide line ## Where should I ask question about Jedi.el? Please ask question in [StackOverflow with `emacs-jedi` tag][so-tag]. However, you may find some old questions in GitHub issue tracker so it is worth searching in it. [so-tag]: http://stackoverflow.com/questions/tagged/emacs-jedi ## Bug report / Question - Check [troubleshooting][troubleshooting] section first. [troubleshooting]: http://tkf.github.io/emacs-jedi/latest/#troubleshooting ## Pull request - After you submit a pull request, check the tests on Travis CI. If you find an error you can fix, please do it. - Use PEP 8 style in Python file. - Make sure that Emacs Lisp file compiles without *warning* (at least make sure you don't increase the number of warnings). emacs-jedi_0.2.8+git20220410.81c5a42/doc/0000755000175000017500000000000014224564226016572 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/doc/Makefile0000644000175000017500000001535614224564226020244 0ustar dogslegdogsleg# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source .PHONY: help clean html dirhtml singlehtml pickle \ json htmlhelp qthelp devhelp epub latex latexpdf \ text man changes linkcheck doctest gettext \ help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/*/* html: releases $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/EmacsJedi.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/EmacsJedi.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/EmacsJedi" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/EmacsJedi" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." ## Generate contributions list RELEASES = $(wildcard source/releases/v*) RELEASES_AUTHORS = $(addsuffix /authors.txt, $(RELEASES)) RELEASES_CLOSED = $(addsuffix /closed.txt, $(RELEASES)) ISSUE_URL = https://github.com/tkf/emacs-jedi/issues .PHONY: releases FORCE releases: $(RELEASES_AUTHORS) $(RELEASES_CLOSED) source/releases/%/authors.txt: source/releases/%/range Makefile git log --format='format:%an' $$(cat $<) \ | grep --invert-match "Takafumi Arakaki" \ | sort --unique \ | sed 's/\(.*\)/- `\1`_/' \ > $@ source/releases/%/closed.txt: source/releases/%/range Makefile git log --format='format:%s %b' --grep='#[0-9]\+' $$(cat $<) \ | grep -e 'fix\(es\)\?' -e 'pull request' \ | grep --extended-regexp --only-matching '#[0-9]+' \ | grep --extended-regexp --only-matching '[0-9]+' \ | sort --unique \ | sort --numeric-sort \ | sed 's%\(.*\)%`#\1 <$(ISSUE_URL)/\1>`_%' \ > $@ # Run these two targets unconditionally. See (info "(make) Force Targets") # Since source/releases/v0.2.0/range has no end, the result may differ # every time they are run. # To skip these targets, run make with "RELEASES=". source/releases/v0.2.0/authors.txt: FORCE source/releases/v0.2.0/closed.txt: FORCE # Load other makefiles. See: (info "(make) Include") include *.mk emacs-jedi_0.2.8+git20220410.81c5a42/doc/make.bat0000644000175000017500000001176714224564226020213 0ustar dogslegdogsleg@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source set I18NSPHINXOPTS=%SPHINXOPTS% source if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\EmacsJedi.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\EmacsJedi.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end emacs-jedi_0.2.8+git20220410.81c5a42/doc/gh-pages.mk0000644000175000017500000000413514224564226020621 0ustar dogslegdogsleg## Usage # Usage 1: # * Put this file in Sphinx's directory (where you find Makefile). # * Add "include *.mk" to Sphinx's Makefile. # Usage 2: # * Run make like this: make -f gh-pages.mk [TARGET] ## Configuration REPO_URL = git@github.com:tkf/emacs-jedi.git REPO_DIR = gh-pages # $(DOC_VER) can be "released", "v1.0", etc.: DOC_VER = latest DOC_DIR = $(REPO_DIR)/$(DOC_VER) DOC_PORT = 7563 ## Misc variables # To use this file from --file option, let's define variables in # Sphinx's Makefile, if they are not defined: ifndef BUILDDIR BUILDDIR = build endif ## Targets .PHONY: _gh-pages-assert-repo gh-pages-update gh-pages-push \ gh-pages-clone gh-pages-pull gh-pages-all \ gh-pages-root gh-pages-root-commit .NOTPARALLEL: gh-pages-all gh-pages-all: gh-pages-pull gh-pages-update gh-pages-push # Check if $(REPO_DIR) is really a git repository. Otherwise, # committing files in there is pretty dangerous as it might goes into # REPO's master branch. _gh-pages-assert-repo: test -d $(REPO_DIR)/.git gh-pages-clone: rm -rf $(REPO_DIR) git clone --branch gh-pages $(REPO_URL) $(REPO_DIR) gh-pages-pull: _gh-pages-assert-repo cd $(REPO_DIR) && git pull gh-pages-update: _gh-pages-assert-repo $(MAKE) clean html @echo "Clean $(DOC_DIR)" test ! -d $(DOC_DIR)/.git rm -rf $(DOC_DIR) @echo "Copy files: $(BUILDDIR)/html -> $(DOC_DIR)" cp -r $(BUILDDIR)/html $(DOC_DIR) @echo "Update gh-pages" cd $(DOC_DIR) && \ git add . && \ if [ -n "$$(git ls-files --deleted .)" ]; then \ git ls-files --deleted . | xargs git rm; \ fi && \ git commit -m "Update $(DOC_VER)" gh-pages-push: _gh-pages-assert-repo cd $(REPO_DIR) && git push -u origin gh-pages ## Root gh-pages-root-commit: gh-pages-root cd $(REPO_DIR) && \ git add *.* .nojekyll .gitignore && \ git commit -m "Update root page." gh-pages-root: $(REPO_DIR)/index.html $(REPO_DIR)/.nojekyll $(REPO_DIR)/index.html: gh-pages-index.html cp $< $@ $(REPO_DIR)/.nojekyll: touch $@ ## Misc gh-pages-serve: bash -c 'sleep 0.1s; python -m webbrowser http://localhost:$(DOC_PORT)' & cd $(REPO_DIR) && python -m SimpleHTTPServer $(DOC_PORT) emacs-jedi_0.2.8+git20220410.81c5a42/doc/gh-pages-index.html0000644000175000017500000000073614224564226022266 0ustar dogslegdogsleg Page Redirection If you are not redirected automatically, follow the link to latest or link to released emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/0000755000175000017500000000000014224564226020072 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/doc/source/index.rst0000644000175000017500000005364514224564226021750 0ustar dogslegdogsleg============================================ Jedi.el - Python auto-completion for Emacs ============================================ .. sidebar:: Links: * `Documentation `_ (at GitHub Pages) [#]_ * `Configuration`_ * `Command`_ * `Troubleshooting`_ * `FAQ`_ * :doc:`Complete overview ` * :doc:`changelog` * `Q & A in StackOverflow `_ (with ``emacs-jedi`` tag) * `Repository `_ (at GitHub) * `Issue tracker `_ (at GitHub) * `Travis CI `_ |build-status| .. [#] There are `released version `_ and `developmental version `_. What is it? =========== Jedi.el is a Python auto-completion package for Emacs. It aims at helping your Python coding in a non-destructive way. It also helps you to find information about Python objects, such as docstring, function arguments and code location. Quick start =========== (1) **Install** Jedi.el via el-get, Marmalade or MELPA (see install_ for more info), i.e., either - ``M-x el-get-install RET jedi RET`` or - ``M-x package-install RET jedi RET`` or - (manually install...) (2) **Configure** Emacs using this:: (add-hook 'python-mode-hook 'jedi:setup) (setq jedi:complete-on-dot t) ; optional If you install Jedi.el manually (BTW, you shouldn't!), you need to add more stuff to it. See `manual install`_ section. (3) **Install Python server** (jediepcserver.py) by running - ``M-x jedi:install-server`` in Emacs (see also :el:symbol:`jedi:install-server`). See install_ section for minimal examples. Screenshots =========== Jedi.el comes with a set of useful features. Here is a list of screenshots to show some of them. .. figure:: http://farm9.staticflickr.com/8261/8804536872_8d266b88ed_o.png Auto-completion and popup help. This is the main feature of Jedi.el. You don't need to type any special command. Completions and help popup as you type. .. figure:: http://farm3.staticflickr.com/2845/8793986161_e1c58607f0_o.png Popup-style call signature help. This is useful when you don't remember what argument to pass. .. figure:: http://farm8.staticflickr.com/7312/8794015799_989e2a7217_o.png eldoc-style call signature help. This is another style of showing arguments. Use `jedi:tooltip-method` to configure which style to use. .. figure:: http://farm4.staticflickr.com/3784/8804246558_0b3c998050_o.png Source code viewer (need jedi-direx_ extension). Requirements ============ Emacs ----- - EPC_ - deferred.el_ (> v0.3) - auto-complete_ or company-mode_ - python-environment.el_ For auto-complete_ users, if your completion popup is broken when width of completion candidates is wide, try the newest version of popup.el_. .. _deferred.el: https://github.com/kiwanami/emacs-deferred .. _popup.el: https://github.com/auto-complete/popup-el .. _python-environment.el: https://github.com/tkf/emacs-python-environment Jedi.el is currently tested against Emacs 24.3-devel, 24.2 Command line program -------------------- - virtualenv_ .. _virtualenv: http://www.virtualenv.org Python ------ - Jedi_ (>= 0.6.0) - python-epc_ - argparse (for Python 2.6) Jedi.el is tested against Python 2.6, 2.7, 3.2 and 3.3, 3.4. Install ======= el-get ------ If you have el-get_ installed, Jedi.el can be installed by these Emacs command: - ``M-x el-get-install RET jedi RET`` - ``M-x jedi:install-server RET`` (see also :ref:`pyinstall`) Note that Python packages are *not* installed automatically anymore (there is `a plan `_ to fix it). Here is a minimal example to setup Jedi.el via el-get_: .. literalinclude:: jedi-el-get.el :language: cl See also: :ref:`minimal-tryout`. .. _el-get: https://github.com/dimitri/el-get package.el (Marmalade or MELPA) ------------------------------- You can install Jedi.el using package.el interface. You need to add Marmalade_ or MELPA_ to :el:symbol:`package-archives`. After you setup :el:symbol:`package-archives` properly, Jedi.el can be installed by these Emacs command: - (auto-complete)``M-x package-install RET jedi RET`` - (company-mode)``M-x package-install RET company-jedi RET`` - ``M-x jedi:install-server RET`` (see also :ref:`pyinstall`) Here is a minimal example to setup Jedi.el via package.el + MELPA: .. literalinclude:: jedi-melpa.el :language: cl .. Un-comment the following once v0.2.0 is released in Marmalade: Here is a minimal example to setup Jedi.el via package.el + Marmalade. The only difference with the above MELPA case is the value of :el:symbol:`package-archives`: .. literalinclude:: jedi-marmalade.el :language: cl See also: :ref:`minimal-tryout`. .. _Marmalade: http://marmalade-repo.org .. _MELPA: http://melpa.org Manual install -------------- 1. Install EPC_ and (auto-complete_ or company-mode_). 2. Install Jedi.el. Download the repository of Jedi.el and add it to `load-path`. 3. Add ``(autoload 'jedi:setup "jedi" nil t)`` in your Emacs configuration. 4. Run ``M-x jedi:install-server RET`` (see also :ref:`pyinstall`) .. _pyinstall: Python server (jediepcserver.py) installation --------------------------------------------- As of Jedi.el v0.2.0, jediepcserver.py installation is done by running Emacs command :el:symbol:`jedi:install-server`, i.e., typing ``M-x jedi:install-server RET`` in Emacs. The same command can be used to update Python packages used by Jedi.el. So, running this command after updating Jedi.el each time is recommended. You can configure the location of the Python packages installed by :el:symbol:`jedi:install-server` by changing the following variables: - :el:symbol:`jedi:environment-root` - :el:symbol:`python-environment-directory` - :el:symbol:`python-environment-default-root-name` If you want to install Python packages manually, rather than using :el:symbol:`jedi:install-server`, see :ref:`manual-pyinstall` below. .. _manual-pyinstall: Manually install Python server (jediepcserver.py) ------------------------------------------------- Install jediepcserver.py script to wherever you want. For example, you can use... - pip:: pip install -U PATH/TO/EMACS-JEDI/ - setup.py directly:: cd PATH/TO/EMACS-JEDI/ python setup.py install Then find where your jediepcserver.py ends up. Set the location by:: (setq jedi:server-command '("PATH/TO/jediepcserver.py")) See also :el:symbol:`jedi:server-command`. Setup ===== All you need to do is to call `jedi:setup` in python buffer. To do that, add the following in your Emacs configuration:: (add-hook 'python-mode-hook 'jedi:setup) Extension ========= IPython integration ------------------- Sometimes it is useful to find completion using Python interpreter. To do that in a seamless manner, you can use IPython and its Emacs binding EIN (Emacs IPython Notebook). See ein:jedi-setup_ in the EIN manual. Using this setup, you can run auto-completion command in Jedi.el and EIN simultaneously. .. _ein:jedi-setup: http://tkf.github.com/emacs-ipython-notebook/#ein:jedi-setup .. Links .. _jedi: https://github.com/davidhalter/jedi .. _EPC: https://github.com/kiwanami/emacs-epc .. _Python binding: python-epc_ .. _python-epc: https://github.com/tkf/python-epc .. _auto-complete: https://github.com/auto-complete/auto-complete .. _company-mode: https://github.com/company-mode/company-mode .. _jedi-direx: https://github.com/tkf/emacs-jedi-direx .. Build status badge .. |build-status| image:: https://secure.travis-ci.org/tkf/emacs-jedi.png?branch=master :target: http://travis-ci.org/tkf/emacs-jedi :alt: Build Status Configuration ============= .. el:package:: jedi .. el:function:: jedi:setup .. el:function:: jedi:ac-setup .. el:variable:: jedi:complete-on-dot .. el:variable:: jedi:environment-root .. el:variable:: jedi:environment-virtualenv .. el:variable:: jedi:server-command :value: '("~/.emacs.d/.python-environments/default/bin/jediepcserver.py") .. el:variable:: jedi:server-args .. el:variable:: jedi:get-in-function-call-timeout .. el:variable:: jedi:get-in-function-call-delay .. el:variable:: jedi:tooltip-method .. el:variable:: jedi:goto-definition-config .. el:variable:: jedi:goto-definition-marker-ring-length .. el:variable:: jedi:doc-mode .. el:variable:: jedi:doc-display-buffer .. el:variable:: jedi:install-imenu .. el:variable:: jedi:imenu-create-index-function .. el:variable:: jedi:install-python-jedi-dev-command Keybinds -------- .. el:keymap:: jedi-mode-map .. el:variable:: jedi:use-shortcuts For navigating auto-complete suggestions, you can use arrow keys. Jedi.el uses `auto-complete `_, so check `its documentation `_ for other options. See also the `StackOverflow answer `_. Command ======= .. el:function:: jedi:stop-server .. el:function:: jedi:start-dedicated-server .. el:function:: jedi:complete .. el:function:: jedi:get-in-function-call .. el:function:: jedi:goto-definition .. el:function:: jedi:goto-definition-pop-marker .. el:function:: jedi:show-doc .. el:package:: helm .. el:function:: helm-jedi-related-names .. el:package:: anything .. el:function:: anything-jedi-related-names .. el:package:: jedi .. el:function:: jedi:install-server .. el:function:: jedi:install-python-jedi-dev .. el:function:: jedi:pop-to-epc-buffer .. el:function:: jedi:toggle-log-traceback .. el:function:: jedi:toggle-debug-server .. el:function:: jedi:show-setup-info .. el:function:: jedi:show-version-info Troubleshooting =============== .. note:: If you have a question, ask question in StackOverflow_ with ``emacs-jedi`` tag. We stopped using the issue tracker for Q & A. Before posting question in StackOverflow_ or bug report in the `issue tracker`_, please investigate the problem by yourself. Here is some checklist. It is best to mention that you went through this list (or stuck with somewhere) in your question or bug report. .. _StackOverflow: http://stackoverflow.com/questions/tagged/emacs-jedi #. Run :kbd:`M-x` :el:symbol:`jedi:show-setup-info` :kbd:`RET` (if you don't have it, try :el:symbol:`jedi:show-version-info` instead). This helps you in two ways. 1. Paste the result of this function when you are asking question or reporting bug, to give people basic information. Unless you are sure that it is irrelevant, it is recommended to put this information. If you think it is too long for a simple question/report, you can always use https://gist.github.com etc. 2. To make sure jedi.el is running correctly and communicating with Jedi EPC server. This is the least complex way to communicate with the Jedi server. If it doesn't work, rest of Jedi.el functions will not work. #. You can try Jedi.el without installing it, in a "clean Emacs setup" [#]_ . If you don't know what is wrong and don't know what to do next, this it the best thing to try. This helps you to find out if your setting is wrong or if it is actually a bug in Jedi.el. Check :ref:`quick-try`. If it works, compare with your Emacs setup carefully. It is likely that there is something wrong in your Emacs setup. You should also check minimal working examples in the install_ section. (Note that currently there is no automated way to do this in Windows without Cygwin. If you know it, please document!) #. To check that :el:symbol:`jedi:setup` is called properly via :el:symbol:`python-mode-hook`, run ``M-: jedi-mode RET`` in some Python file. It should return `t`. #. If you see message "auto-complete-mode is not enabled", you might forget to setup auto-complete properly. Calling ``(global-auto-complete-mode t)`` in your Emacs configuration after *loading* auto-complete should solve this problem. "After loading" means you need to call ``(require 'auto-complete)`` (or ``(require 'auto-complete-config)`` if you need) before calling ``(global-auto-complete-mode t)``. #. It is possible that Jedi's keybind conflicts with keybinds of other libraries. You can check the definition of keybind by `` k C-c ?`` (or ``C-h`` instead of ````), for example. This one should show the help for :el:symbol:`jedi:show-doc`. #. If you get something like ``deferred error : (error ...)`` in your echo area (equivalently, the ``*Messages*`` buffer), most of the time the error is from Python-Jedi. Get traceback following "`How to get traceback`_" and see where the error is from. If it is from Python-Jedi, send the bug report to its `issue tracker`__. __ https://github.com/davidhalter/jedi/issues #. Make sure you are reading right version of document. If you are using developmental version (installed via el-get, MELPA or manually from github), you should read `developmental version `_. If you installed from Marmalade, you should read `released version `_. .. [#] By "clean Emacs setup" I mean a Emacs process started in such a way that it does not read your Emacs configuration file and libraries installed by you. In this manual, several ways to do that are described. See :ref:`quick-try`. FAQ === .. _quick-try: How to quickly try Jedi.el without installing it ------------------------------------------------ There are two ways. One for new users and one for Jedi.el developers. 1. :ref:`minimal-tryout` 2. :ref:`make-tryout` .. _minimal-tryout: Use minimal example setting to try Jedi.el without installation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is recommended if you are new to Jedi.el. 1. Try Jedi.el without installation using package.el + MELPA Here is how to try el-get setup without touching your ``~/.emacs.d/``. This version uses package.el and MELPA. Once emacs is launched, type ``M-x package-install RET jedi RET`` and ``M-x jedi:install-server RET``: .. literalinclude:: jedi-melpa.sh :language: sh 2. Try Jedi.el without installation using el-get If you want to try el-get setup, do the following instead. You may remove ``--eval "(setq el-get-install-skip-emacswiki-recipes nil)"`` like the last commented line, but it will be very slow to start Emacs. Once emacs is launched, type ``M-x el-get-install RET jedi RET`` and ``M-x jedi:install-server RET`` .. literalinclude:: jedi-el-get.sh :language: sh The above methods run minimal example mentioned in the install_ section. .. note:: In older Emacs version (< 24.4), the method 1 using package.el may result in an error something like .. sourcecode:: text jedi.el:37:1:Error: Cannot open load file: python-environment In this case, :kbd:`M-x package-install RET python-environment RET` may solve the problem. .. _make-tryout: Use ``make tryout`` to try Jedi.el without installation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is recommended if you want to develop Jedi.el. If you have cask_ command, then you just have to: .. sourcecode:: sh git clone https://github.com/tkf/emacs-jedi.git cd emacs-jedi make tryout If you are too lazy to go to cask_ site to checkout how to install it, here is what you need to do:: curl -fsSkL https://raw.github.com/cask/cask/master/go | python make CASK=$HOME/.cask/bin/cask tryout ``make tryout`` will install requirements for Jedi.el separated from your local setup in ``~/.emacs.d/``. You can also check the configuration file tryout-jedi.el_ to see a minimum working configuration. This is the configuration file loaded by ``make tryout``. .. _cask: https://github.com/cask/cask .. _tryout-jedi.el: https://github.com/tkf/emacs-jedi/blob/master/tryout-jedi.el If you install cask_ in a different place or you don't add it to the ``$PATH``, you can call ``make`` like this: ``make CASK=PATH/TO/bin/cask tryout``. Typically, ``PATH/TO/bin/cask`` is ``~/.cask/bin/cask``. How to update Python dependencies --------------------------------- Simply run Emacs command ``M-x jedi:install-server``. See also :el:symbol:`jedi:install-server`. .. warning:: The following command does not work as of version 0.2.0 anymore:: make requirements pip install -r PATH/TO/requirements.txt .. warning:: (For el-get user) ``M-x el-get-update RET jedi RET`` will *not* update Python dependencies anymore. How to use Python 3 (or any other specific version of Python) ------------------------------------------------------------- Using Python 3 as default Python, only in Jedi.el ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Set :el:symbol:`jedi:environment-virtualenv` and :el:symbol:`jedi:environment-virtualenv`, like this:: (setq jedi:environment-root "jedi") ; or any other name you like (setq jedi:environment-virtualenv (append python-environment-virtualenv '("--python" "/PATH/TO/python3"))) Or you can just set, for example, ``virtualenv3`` if it is run by Python 3:: (setq jedi:environment-virtualenv (list "virtualenv3" "--system-site-packages")) .. note:: ``--system-site-packages`` is the default option in :el:symbol:`python-environment-virtualenv` so you need it if you want to the default behavior. As to why it is the default, see the discussion here: `tkf/emacs-python-environment#3 `_. .. note:: In principle, you can modify :el:symbol:`python-environment-virtualenv` and do not touch :el:symbol:`jedi:environment-virtualenv` *and* :el:symbol:`jedi:environment-root`. However, it changes default environment to use Python 3 so make sure all other Python packages you need are compatible with Python 3. Automatically use appropriate Python version ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This can be done by making :el:symbol:`jedi:server-command`, :el:symbol:`jedi:environment-root` and :el:symbol:`jedi:environment-virtualenv` buffer local using :el:symbol:`make-local-variable` and set them appropriately. See :el:symbol:`jedi:server-command` for more info. You might need to use :el:symbol:`python-environment-bin`. How to setup proxy ------------------ :el:symbol:`jedi:install-server` runs `pip install`_. So, you may want to set proxy for it. In that case, set :envvar:`http_proxy` and :envvar:`https_proxy` [#]_. If you want to set it in ``~/.bashrc``, do something like the following. Since Emacs [#]_ and other programs read this variable, it may be the best approach.:: export http_proxy=http://[user:passwd@]proxy.server:port export https_proxy=https://[user:passwd@]proxy.server:port If you want to set it in Emacs setting, do something like this:: (setenv "http_proxy" "http://[user:passwd@]proxy.server:port") (setenv "https_proxy" "https://[user:passwd@]proxy.server:port") If you want to setup proxy only for pip, you can use :envvar:`PIP_PROXY` instead of :envvar:`http_proxy` and :envvar:`https_proxy`. This sets default value for `pip --proxy option`_ (see also `pip > User Guide > Environment Variables`_). .. [#] See also: http://stackoverflow.com/questions/14149422/using-pip-behind-a-proxy (BTW, :envvar:`http_proxy` and :envvar:`https_proxy` are not mentioned in pip manual. If anybody know official information from pip regarding :envvar:`http_proxy` and :envvar:`https_proxy`, please add it here.) .. [#] `Proxies - URL Programmer's Manual `_ .. _`pip install`: http://pip.readthedocs.org/en/latest/reference/pip_install.html .. _`pip --proxy option`: http://pip.readthedocs.org/en/latest/reference/pip.html#cmdoption--proxy .. _`pip > User Guide > Environment Variables`: http://pip.readthedocs.org/en/latest/user_guide.html#environment-variables How to get traceback -------------------- You need to toggle on traceback logging for EPC server and then run :el:symbol:`jedi:pop-to-epc-buffer` when you get an error. To start traceback logging, there are several options. 1. If server-client communication works (i.e., some completion or command work), use :el:symbol:`jedi:toggle-log-traceback`. 2. Alternatively, you can start server with ``--log-traceback`` option by :el:symbol:`jedi:start-dedicated-server`. Run command by ``M-x jedi:start-dedicated-server RET`` and append ``--log-traceback`` to the default command. 3. You can use :el:symbol:`jedi:server-args` to turn on logging always. This could be useful when you don't know when the error occurs.:: (setq jedi:server-args '("--log-traceback")) How it works ============ Jedi.el uses jedi_ (an awesome Python auto-completion library) and EPC_ (an RPC stack for Emacs Lisp) and its `Python binding`_ to communicate with Python process. It also uses excellent Emacs auto-complete_ module to start completion automatically. As Jedi.el always calls Python function asynchronously (thanks to EPC_), it will not block your Emacs while your are editing. .. figure:: img/how-it-works.* How Jedi.el works. Jedi.el calls Python methods in jedi_ through EPC_ protocol. Emacs side implementation of EPC is `epc.el `_ and Python side is python-epc_. Message through socket is encoded using S-expression based protocol. See `EPC README file `_ for more details. EPC_ is built on top of asynchronous library called deferred.el_. One of the design goal for Jedi.el is to **never block user**. This is extremely important thing to have in mind because you use Emacs to edit something, not to wait some random lisp program to finish. EPC_ and deferred.el_ are perfect libraries to achieve this goal. More resources ============== .. toctree:: deprecation changelog emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/jedi-el-get.sh0000644000175000017500000000044614224564226022520 0ustar dogslegdogslegmkdir /tmp/test/ # any location is fine cd /tmp/test/ wget --no-check-certificate https://raw.github.com/tkf/emacs-jedi/master/doc/source/jedi-el-get.el HOME=${PWD} emacs -Q --eval "(setq el-get-install-skip-emacswiki-recipes nil)" -l jedi-el-get.el # HOME=${PWD} emacs -Q -l jedi-el-get.el emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/changelog.rst0000644000175000017500000001275614224564226022566 0ustar dogslegdogslegChangelog ========= v0.2.0 (WIP) ------------ Since there is a backward incompatible change in installation method, the version is bumped from 0.1.x to 0.2.x (I am not using any versioning rule, though). - Python modules are installed via python-environment.el_ now. No need to run ``make requirements`` outside of Emacs. - In fact, ``make requirements`` is obsolete now. Running this command print some error message for help and exit with an error. - StackOverflow_ is the main place for questions now. Previously it was treated in GitHub `issue tracker`_. - :el:symbol:`jedi:show-setup-info` is added to help bug reports and questions. - :el:symbol:`jedi:install-python-jedi-dev` is added. Contributions from: .. include:: releases/v0.2.0/authors.txt Closed issues and pulled patches: .. include:: releases/v0.2.0/closed.txt .. _python-environment.el: https://github.com/tkf/emacs-python-environment .. _StackOverflow: http://stackoverflow.com/questions/tagged/emacs-jedi .. _issue tracker: https://github.com/tkf/emacs-jedi/issues v0.1.3 (never released) ----------------------- (This version is not released. All changes below are available in v0.2.0.) Highlights: - `Syohei YOSHIDA`_ (@syohex) is in our team. Welcome! - Add :el:symbol:`jedi:toggle-log-traceback` and :el:symbol:`jedi:pop-to-epc-buffer`. - Add default keybind and a simple way to setup recommended keybinds. See issue `#47`_ for the reason and discussion behind this change. - Now :el:symbol:`jedi:ac-setup` auto-magically enables auto-complete-mode. This is to help people from setting up auto-complete when they were not using it before installing jedi.el. See: `#40 `_, `bbatsov/prelude#251 `_, `this question in StackOverflow `_. Contributions from: .. include:: releases/v0.1.3/authors.txt Closed issues and pulled patches: .. include:: releases/v0.1.3/closed.txt v0.1.2 (2013-05-26) ------------------- Highlights: - Jedi.el is `available from Marmalade `_. - Add imenu support (see :el:symbol:`jedi:install-imenu` and :el:symbol:`jedi:imenu-create-index-function`). Currently it is not on by default as it needs developmental version of Jedi_. - Add :el:symbol:`jedi:goto-definition-config` configurable option. - Jedi.el now pools server instances. So, for example, you can create buffer-local :el:symbol:`jedi:server-args` to setup project-specific Jedi server (issue-28_). - Do not expand common part when completing on inserting dot using :el:symbol:`jedi:dot-complete`. - Strip off newlines from candidate summary. This prevents popup to be disrupted when showing candidates summary containing newlines (e.g., ``json.__all__``). Contributions from: .. include:: releases/v0.1.2/authors.txt Closed issues and pulled patches: .. include:: releases/v0.1.2/closed.txt .. _issue-28: https://github.com/tkf/emacs-jedi/issues/28 v0.1.1 (2012-12-01) ------------------- - Add experimental "full-name" support [#fullname]_. - PR-11_ fixes Makefile for BSD make (thanks, `@goro1080`_!). - Fix issue-9_: line number sent to the server was shifted when the cursor is at the beginning of line. - Fix issue-10_: get_in_function_call was called in non-python-mode buffer. - Fix issue-7_: server process was killed unexpectedly. - Add :el:symbol:`jedi:setup-keys`. You don't need to manually add Jedi commands to :el:symbol:`python-mode-map` now. Contributions from: .. include:: releases/v0.1.1/authors.txt Closed issues and pulled patches: .. include:: releases/v0.1.1/closed.txt .. _@goro1080: https://github.com/goro1080 .. _PR-11: https://github.com/tkf/emacs-jedi/pull/11 .. _issue-10: https://github.com/tkf/emacs-jedi/issues/10 .. _issue-9: https://github.com/tkf/emacs-jedi/issues/9 .. _issue-7: https://github.com/tkf/emacs-jedi/issues/7 .. [#fullname] `jedi:get-full-name-*` functions require developmental version of Jedi_. See also: `Request: Definition.fullname · Issue #61 · davidhalter/jedi `_ v0.1.0 (2012-11-09) ------------------- - PR-8_ adds ELDoc like argument highlighting (thanks, `@syohex`_!). - PR-2_ adds meta-data in header comment for ELPA (thanks, `@syohex`_!). - PR-1_ fixes Makefile for newer pip version (thanks, `@L42y`_!). - First version. Contributions from: .. include:: releases/v0.1.0/authors.txt Closed issues and pulled patches: .. include:: releases/v0.1.0/closed.txt .. _PR-8: https://github.com/tkf/emacs-jedi/pull/8 .. _PR-2: https://github.com/tkf/emacs-jedi/pull/2 .. _PR-1: https://github.com/tkf/emacs-jedi/pull/1 .. _@syohex: https://github.com/syohex .. _@L42y: https://github.com/L42y .. authors-to-github account map: .. _Ting-Yu Lin: https://github.com/aethanyc .. _abyssly: https://github.com/abyssly .. _Akihiro Uchida: https://github.com/uchida .. _Sean Dague: https://github.com/sdague .. _Thomas Frössman: https://github.com/thomasf .. _Vyacheslav Levit: https://github.com/vlevit .. _Aaron Meurer: https://github.com/asmeurer .. _Danilo Bargen: https://github.com/dbrgn .. _Fabián Ezequiel Gallina: https://github.com/fgallina .. _immerrr: https://github.com/immerrr .. _Jaakko Pallari: https://github.com/jkpl .. _Kiyono Goro: https://github.com/goro1080 .. _L42y: https://github.com/L42y .. _Ryan Olf: https://github.com/ryanolf .. _Syohei YOSHIDA: https://github.com/syohex .. Links .. _jedi: https://github.com/davidhalter/jedi emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/img/0000755000175000017500000000000014224564226020646 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/doc/source/img/how-it-works.svg0000644000175000017500000004411014224564226023741 0ustar dogslegdogsleg image/svg+xml Python (jediepcserver.py) Emacs python-epc Jedi epc.el jedi.el Methods:- complete- goto- ... encode decode decode encode EPCoversocket Call Return emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/deprecation.rst0000644000175000017500000000073414224564226023125 0ustar dogslegdogsleg============= Deprecation ============= .. el:package:: jedi Deprecated configuration ======================== .. el:variable:: jedi:setup-keys .. el:variable:: jedi:key-complete :value: (kbd "") .. el:variable:: jedi:key-goto-definition :value: (kbd "C-.") .. el:variable:: jedi:key-show-doc :value: (kbd "C-c d") .. el:variable:: jedi:key-related-names :value: (kbd "C-c r") .. el:variable:: jedi:key-goto-definition-pop-marker :value: (kbd "C-,") emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/jedi-melpa.el0000644000175000017500000000065714224564226022433 0ustar dogslegdogsleg;; Standard package.el + MELPA setup ;; (See also: https://github.com/melpa/melpa#usage) (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) ;; Standard Jedi.el setting (add-hook 'python-mode-hook 'jedi:setup) (setq jedi:complete-on-dot t) ;; Type: ;; M-x package-install RET jedi RET ;; M-x jedi:install-server RET ;; Then open Python file. emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/jedi-melpa.sh0000644000175000017500000000030114224564226022427 0ustar dogslegdogslegmkdir /tmp/test/ # any location is fine cd /tmp/test/ wget --no-check-certificate https://raw.github.com/tkf/emacs-jedi/master/doc/source/jedi-melpa.el HOME=${PWD} emacs -Q -l jedi-melpa.el emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/jedi-marmalade.el0000644000175000017500000000066314224564226023255 0ustar dogslegdogsleg;; Standard package.el + marmalade setup ;; (See also: http://marmalade-repo.org/) (require 'package) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) (package-initialize) ;; Standard Jedi.el setting (add-hook 'python-mode-hook 'jedi:setup) (setq jedi:complete-on-dot t) ;; Type: ;; M-x package-install RET jedi RET ;; M-x jedi:install-server RET ;; Then open Python file. emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/conf.el0000644000175000017500000000077514224564226021352 0ustar dogslegdogsleg(defun jedi:parent-dir (path) (file-name-directory (directory-file-name path))) ;; Load carton.el (add-to-list 'load-path (jedi:parent-dir (jedi:parent-dir (executable-find "cask")))) (load "cask") ;; Setup `load-path' using cask.el and package.el (let* ((doc-source-path (file-name-directory load-file-name)) (project-path (jedi:parent-dir (jedi:parent-dir doc-source-path)))) (add-to-list 'load-path project-path) (cask-initialize project-path)) ;; Load Jedi.el (require 'jedi) emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/jedi-el-get.el0000644000175000017500000000112014224564226022474 0ustar dogslegdogsleg;; Standard el-get setup ;; (See also: https://github.com/dimitri/el-get#basic-setup) (add-to-list 'load-path "~/.emacs.d/el-get/el-get") (unless (require 'el-get nil 'noerror) (with-current-buffer (url-retrieve-synchronously "https://raw.github.com/dimitri/el-get/master/el-get-install.el") (goto-char (point-max)) (eval-print-last-sexp))) (el-get 'sync) ;; Standard Jedi.el setting (add-hook 'python-mode-hook 'jedi:setup) (setq jedi:complete-on-dot t) ;; Type: ;; M-x el-get-install RET jedi RET ;; M-x jedi:install-server RET ;; Then open Python file. emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/conf.py0000644000175000017500000001754014224564226021400 0ustar dogslegdogsleg# -*- coding: utf-8 -*- # # Emacs Jedi documentation build configuration file, created by # sphinx-quickstart on Sat Oct 20 14:53:06 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.join(os.path.abspath('..'), 'eldomain')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'eldomain', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Emacs Jedi' copyright = u'2012, Takafumi Arakaki' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.2.0' # The full version, including alpha/beta/rc tags. release = '0.2.0alpha2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] highlight_language = 'cl' # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'nature' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. html_theme_options = { 'nosidebar': True, } # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'EmacsJedidoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'EmacsJedi.tex', u'Emacs Jedi Documentation', u'Takafumi Arakaki', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'emacsjedi', u'Emacs Jedi Documentation', [u'Takafumi Arakaki'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'EmacsJedi', u'Emacs Jedi Documentation', u'Takafumi Arakaki', 'EmacsJedi', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # -- Options for EL domain ----------------------------------------------------- elisp_packages = { 'jedi': 'jedi', 'helm': 'helm-', 'anything': 'anything-', } emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/0000755000175000017500000000000014224564226021675 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.1.1/0000755000175000017500000000000014224564226022520 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.1.1/range0000644000175000017500000000001714224564226023535 0ustar dogslegdogslegv0.1.0..v0.1.1 emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.1.3/0000755000175000017500000000000014224564226022522 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.1.3/range0000644000175000017500000000006114224564226023536 0ustar dogslegdogslegv0.1.2..ecf1f396c824689d0b4b7a0e21ffc5cf4fd6c59c emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.1.0/0000755000175000017500000000000014224564226022517 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.1.0/range0000644000175000017500000000006114224564226023533 0ustar dogslegdogsleg34a56374163fdbff1b3ac14ed1196006f5b25a3a..v0.1.0 emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.1.2/0000755000175000017500000000000014224564226022521 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.1.2/range0000644000175000017500000000001714224564226023536 0ustar dogslegdogslegv0.1.1..v0.1.2 emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.2.0/0000755000175000017500000000000014224564226022520 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/doc/source/releases/v0.2.0/range0000644000175000017500000000005314224564226023535 0ustar dogslegdogslegecf1f396c824689d0b4b7a0e21ffc5cf4fd6c59c.. emacs-jedi_0.2.8+git20220410.81c5a42/doc/source/contents.rst0000644000175000017500000000020714224564226022460 0ustar dogslegdogsleg=========================== Jedi.el document contents =========================== .. toctree:: index deprecation changelog emacs-jedi_0.2.8+git20220410.81c5a42/doc/eldomain/0000755000175000017500000000000014224564226020362 5ustar dogslegdogslegemacs-jedi_0.2.8+git20220410.81c5a42/README.rst0000644000175000017500000000540014224564226017513 0ustar dogslegdogsleg============================================ Jedi.el - Python auto-completion for Emacs ============================================ .. sidebar:: Links: * `Documentation (dev) `_ (`released version `_) * `Screenshots `_ * `Configuration `_ * `Command `_ * `FAQ `_ * `Troubleshooting `_ * `Complete overview `_ * `Changelog `_ * `Q & A in StackOverflow `_ (with ``emacs-jedi`` tag) * `Repository `_ (at GitHub) * `Issue tracker `_ (at GitHub) * `Travis CI `_ |build-status| * `MELPA `_ |melpa-badge| * `MELPA Stable `_ |melpa-stable-badge| What is it? =========== Jedi.el is a Python auto-completion package for Emacs. It aims at helping your Python coding in a non-destructive way. It also helps you to find information about Python objects, such as docstring, function arguments and code location. For more info, read documentation. If you are using developmental version installed via el-get or MELPA, read the `developmental version `_. If you are using released version installed via Marmalade, read the `released version `_. .. figure:: http://farm9.staticflickr.com/8261/8804536872_8d266b88ed_o.png Auto-completion using Jedi.el. See more screenshots `here `_. Company Users ============= **NOTE: Please do not install 'jedi' package for company users. You should install only company-jedi.** If you use `company `_, please see `company-jedi `_. .. Build status badge .. |build-status| image:: https://secure.travis-ci.org/tkf/emacs-jedi.png?branch=master :target: http://travis-ci.org/tkf/emacs-jedi :alt: Build Status .. |melpa-badge| image:: http://melpa.org/packages/jedi-badge.svg :target: http://melpa.org/#/jedi :alt: MELPA Badge .. |melpa-stable-badge| image:: http://stable.melpa.org/packages/jedi-badge.svg :target: http://stable.melpa.org/#/jedi :alt: MELPA Stable Badge emacs-jedi_0.2.8+git20220410.81c5a42/setup.py0000644000175000017500000000126614224564226017544 0ustar dogslegdogslegtry: from setuptools import setup args = {} except ImportError: from distutils.core import setup args = dict(scripts=['jediepcserver.py']) print("""\ *** WARNING: setuptools is not found. Using distutils... It is highly recommended to install Jedi.el via M-x jedi:install-server. Note: If you are using Windows, then Jedi.el will not work with distutils. """) setup( name='jediepcserver', version='0.3.0', py_modules=['jediepcserver'], install_requires=[ "jedi>=0.11.0", "epc>=0.0.4", "argparse", "setuptools", ], entry_points={ 'console_scripts': ['jediepcserver = jediepcserver:main'], }, **args )