replstartup.py 950 B

1234567891011121314151617181920212223242526272829
  1. """
  2. To use Jedi completion in Python interpreter, add the following in your shell
  3. setup (e.g., ``.bashrc``). This works only on Linux/Mac, because readline is
  4. not available on Windows. If you still want Jedi autocompletion in your REPL,
  5. just use IPython instead::
  6. export PYTHONSTARTUP="$(python -m jedi repl)"
  7. Then you will be able to use Jedi completer in your Python interpreter::
  8. $ python
  9. Python 3.9.2+ (default, Jul 20 2020, 22:15:08)
  10. [GCC 4.6.1] on linux2
  11. Type "help", "copyright", "credits" or "license" for more information.
  12. >>> import os
  13. >>> os.path.join('a', 'b').split().in<TAB> # doctest: +SKIP
  14. ..dex ..sert
  15. """
  16. import jedi.utils
  17. from jedi import __version__ as __jedi_version__
  18. print('REPL completion using Jedi %s' % __jedi_version__)
  19. jedi.utils.setup_readline(fuzzy=False)
  20. del jedi
  21. # Note: try not to do many things here, as it will contaminate global
  22. # namespace of the interpreter.