Debian Codegraph @

README.rst

raw
1 ####################################################################################
2 Jedi - an awesome autocompletion, static analysis and refactoring library for Python
3 ####################################################################################
4
5 **I released the successor to Jedi: A
6 Mypy-Compatible Python Language Server Built in Rust** - `Zuban <https://github.com/zubanls/zuban>`_
7
8 .. image:: http://isitmaintained.com/badge/open/davidhalter/jedi.svg
9 :target: https://github.com/davidhalter/jedi/issues
10 :alt: The percentage of open issues and pull requests
11
12 .. image:: http://isitmaintained.com/badge/resolution/davidhalter/jedi.svg
13 :target: https://github.com/davidhalter/jedi/issues
14 :alt: The resolution time is the median time an issue or pull request stays open.
15
16 .. image:: https://github.com/davidhalter/jedi/actions/workflows/ci.yml/badge.svg?branch=master
17 :target: https://github.com/davidhalter/jedi/actions
18 :alt: Tests
19
20 .. image:: https://pepy.tech/badge/jedi
21 :target: https://pepy.tech/project/jedi
22 :alt: PyPI Downloads
23
24
25 Jedi is a static analysis tool for Python that is typically used in
26 IDEs/editors plugins. Jedi has a focus on autocompletion and goto
27 functionality. Other features include refactoring, code search and finding
28 references.
29
30 Jedi has a simple API to work with. There is a reference implementation as a
31 `VIM-Plugin <https://github.com/davidhalter/jedi-vim>`_. Autocompletion in your
32 REPL is also possible, IPython uses it natively and for the CPython REPL you
33 can install it. Jedi is well tested and bugs should be rare.
34
35 Jedi can currently be used with the following editors/projects:
36
37 - Vim (jedi-vim_, YouCompleteMe_, deoplete-jedi_, completor.vim_)
38 - `Visual Studio Code`_ (via `Python Extension <https://marketplace.visualstudio.com/items?itemName=ms-python.python>`_)
39 - Emacs (Jedi.el_, company-mode_, elpy_, anaconda-mode_, ycmd_)
40 - Sublime Text (SublimeJEDI_ [ST2 + ST3], anaconda_ [only ST3])
41 - TextMate_ (Not sure if it's actually working)
42 - Kate_ version 4.13+ supports it natively, you have to enable it, though. [`see
43 <https://projects.kde.org/projects/kde/applications/kate/repository/show?rev=KDE%2F4.13>`_]
44 - Atom_ (autocomplete-python-jedi_)
45 - `GNOME Builder`_ (with support for GObject Introspection)
46 - Gedit (gedi_)
47 - wdb_ - Web Debugger
48 - `Eric IDE`_
49 - `IPython 6.0.0+ <https://ipython.readthedocs.io/en/stable/whatsnew/version6.html>`_
50 - `xonsh shell <https://xon.sh/contents.html>`_ has `jedi extension <https://xon.sh/xontribs.html#jedi>`_
51
52 and many more!
53
54 There are a few language servers that use Jedi:
55
56 - `jedi-language-server <https://github.com/pappasam/jedi-language-server>`_
57 - `python-language-server <https://github.com/palantir/python-language-server>`_ (currently unmaintained)
58 - `python-lsp-server <https://github.com/python-lsp/python-lsp-server>`_ (fork from python-language-server)
59 - `anakin-language-server <https://github.com/muffinmad/anakin-language-server>`_
60
61 Here are some pictures taken from jedi-vim_:
62
63 .. image:: https://github.com/davidhalter/jedi/raw/master/docs/_screenshots/screenshot_complete.png
64
65 Completion for almost anything:
66
67 .. image:: https://github.com/davidhalter/jedi/raw/master/docs/_screenshots/screenshot_function.png
68
69 Documentation:
70
71 .. image:: https://github.com/davidhalter/jedi/raw/master/docs/_screenshots/screenshot_pydoc.png
72
73
74 Get the latest version from `github <https://github.com/davidhalter/jedi>`_
75 (master branch should always be kind of stable/working).
76
77 Docs are available at `https://jedi.readthedocs.org/en/latest/
78 <https://jedi.readthedocs.org/en/latest/>`_. Pull requests with enhancements
79 and/or fixes are awesome and most welcome. Jedi uses `semantic versioning
80 <https://semver.org/>`_.
81
82 If you want to stay **up-to-date** with releases, please **subscribe** to this
83 mailing list: https://groups.google.com/g/jedi-announce. To subscribe you can
84 simply send an empty email to ``[email protected]``.
85
86 Issues & Questions
87 ==================
88
89 You can file issues and questions in the `issue tracker
90 <https://github.com/davidhalter/jedi/>`. Alternatively you can also ask on
91 `Stack Overflow <https://stackoverflow.com/questions/tagged/python-jedi>`_ with
92 the label ``python-jedi``.
93
94 Installation
95 ============
96
97 `Check out the docs <https://jedi.readthedocs.org/en/latest/docs/installation.html>`_.
98
99 Features and Limitations
100 ========================
101
102 Jedi's features are listed here:
103 `Features <https://jedi.readthedocs.org/en/latest/docs/features.html>`_.
104
105 You can run Jedi on Python 3.10+ but it should also
106 understand code that is older than those versions. Additionally you should be
107 able to use `Virtualenvs <https://jedi.readthedocs.org/en/latest/docs/api.html#environments>`_
108 very well.
109
110 Tips on how to use Jedi efficiently can be found `here
111 <https://jedi.readthedocs.org/en/latest/docs/features.html#recipes>`_.
112
113 API
114 ---
115
116 You can find a comprehensive documentation for the
117 `API here <https://jedi.readthedocs.org/en/latest/docs/api.html>`_.
118
119 Autocompletion / Goto / Documentation
120 -------------------------------------
121
122 There are the following commands:
123
124 - ``jedi.Script.goto``
125 - ``jedi.Script.infer``
126 - ``jedi.Script.help``
127 - ``jedi.Script.complete``
128 - ``jedi.Script.get_references``
129 - ``jedi.Script.get_signatures``
130 - ``jedi.Script.get_context``
131
132 The returned objects are very powerful and are really all you might need.
133
134 Autocompletion in your REPL (IPython, etc.)
135 -------------------------------------------
136
137 Jedi is a dependency of IPython. Autocompletion in IPython with Jedi is
138 therefore possible without additional configuration.
139
140 Here is an `example video <https://vimeo.com/122332037>`_ how REPL completion
141 can look like.
142 For the ``python`` shell you can enable tab completion in a `REPL
143 <https://jedi.readthedocs.org/en/latest/docs/usage.html#tab-completion-in-the-python-shell>`_.
144
145 Static Analysis
146 ---------------
147
148 For a lot of forms of static analysis, you can try to use
149 ``jedi.Script(...).get_names``. It will return a list of names that you can
150 then filter and work with. There is also a way to list the syntax errors in a
151 file: ``jedi.Script.get_syntax_errors``.
152
153
154 Refactoring
155 -----------
156
157 Jedi supports the following refactorings:
158
159 - ``jedi.Script.inline``
160 - ``jedi.Script.rename``
161 - ``jedi.Script.extract_function``
162 - ``jedi.Script.extract_variable``
163
164 Code Search
165 -----------
166
167 There is support for module search with ``jedi.Script.search``, and project
168 search for ``jedi.Project.search``. The way to search is either by providing a
169 name like ``foo`` or by using dotted syntax like ``foo.bar``. Additionally you
170 can provide the API type like ``class foo.bar.Bar``. There are also the
171 functions ``jedi.Script.complete_search`` and ``jedi.Project.complete_search``.
172
173 Development
174 ===========
175
176 There's a pretty good and extensive `development documentation
177 <https://jedi.readthedocs.org/en/latest/docs/development.html>`_.
178
179 Testing
180 =======
181
182 The test suite uses ``pytest``::
183
184 pip install pytest
185
186 If you want to test only a specific Python version (e.g. Python 3.14), it is as
187 easy as::
188
189 python3.14 -m pytest
190
191 For more detailed information visit the `testing documentation
192 <https://jedi.readthedocs.org/en/latest/docs/testing.html>`_.
193
194 Acknowledgements
195 ================
196
197 Thanks a lot to all the
198 `contributors <https://jedi.readthedocs.org/en/latest/docs/acknowledgements.html>`_!
199
200
201 .. _jedi-vim: https://github.com/davidhalter/jedi-vim
202 .. _youcompleteme: https://github.com/ycm-core/YouCompleteMe
203 .. _deoplete-jedi: https://github.com/zchee/deoplete-jedi
204 .. _completor.vim: https://github.com/maralla/completor.vim
205 .. _Jedi.el: https://github.com/tkf/emacs-jedi
206 .. _company-mode: https://github.com/syohex/emacs-company-jedi
207 .. _elpy: https://github.com/jorgenschaefer/elpy
208 .. _anaconda-mode: https://github.com/proofit404/anaconda-mode
209 .. _ycmd: https://github.com/abingham/emacs-ycmd
210 .. _sublimejedi: https://github.com/srusskih/SublimeJEDI
211 .. _anaconda: https://github.com/DamnWidget/anaconda
212 .. _wdb: https://github.com/Kozea/wdb
213 .. _TextMate: https://github.com/lawrenceakka/python-jedi.tmbundle
214 .. _Kate: https://kate-editor.org
215 .. _Atom: https://atom.io/
216 .. _autocomplete-python-jedi: https://atom.io/packages/autocomplete-python-jedi
217 .. _GNOME Builder: https://wiki.gnome.org/Apps/Builder
218 .. _Visual Studio Code: https://code.visualstudio.com/
219 .. _gedi: https://github.com/isamert/gedi
220 .. _Eric IDE: https://eric-ide.python-projects.org