From 94d2563a3569ceda457cedd45ab406129557e2cc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 8 Nov 2021 14:25:29 +0100 Subject: Merging upstream version 3.0.20. Signed-off-by: Daniel Baumann --- .github/workflows/test.yaml | 39 ----- CHANGELOG | 36 +++-- PKG-INFO | 263 +++++++++++++++++++++++++++++++++ docs/concurrency-challenges.rst | 91 ------------ mypy.ini | 6 - ptpython.egg-info/PKG-INFO | 263 +++++++++++++++++++++++++++++++++ ptpython.egg-info/SOURCES.txt | 54 +++++++ ptpython.egg-info/dependency_links.txt | 1 + ptpython.egg-info/entry_points.txt | 8 + ptpython.egg-info/requires.txt | 13 ++ ptpython.egg-info/top_level.txt | 1 + ptpython/completer.py | 11 +- ptpython/py.typed | 0 ptpython/repl.py | 15 ++ setup.cfg | 7 +- setup.py | 2 +- 16 files changed, 658 insertions(+), 152 deletions(-) delete mode 100644 .github/workflows/test.yaml create mode 100644 PKG-INFO delete mode 100644 docs/concurrency-challenges.rst delete mode 100644 mypy.ini create mode 100644 ptpython.egg-info/PKG-INFO create mode 100644 ptpython.egg-info/SOURCES.txt create mode 100644 ptpython.egg-info/dependency_links.txt create mode 100644 ptpython.egg-info/entry_points.txt create mode 100644 ptpython.egg-info/requires.txt create mode 100644 ptpython.egg-info/top_level.txt delete mode 100644 ptpython/py.typed diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 0368ba7..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: test - -on: - push: # any branch - pull_request: - branches: [master] - -jobs: - test-ubuntu: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v2 - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install Dependencies - run: | - sudo apt remove python3-pip - python -m pip install --upgrade pip - python -m pip install . black isort mypy pytest readme_renderer - python -m pip install . types-dataclasses # Needed for Python 3.6 - pip list - - name: Type Checker - run: | - mypy ptpython - isort -c --profile black ptpython examples setup.py - black --check ptpython examples setup.py - - name: Run Tests - run: | - ./tests/run_tests.py - - name: Validate README.md - # Ensure that the README renders correctly (required for uploading to PyPI). - run: | - python -m readme_renderer README.rst > /dev/null diff --git a/CHANGELOG b/CHANGELOG index 6a1eb21..69a95e7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,19 @@ CHANGELOG ========= -3.0.19: 2020-07-08 +3.0.20: 2021-09-14 +------------------ + +New features: +- For `DictionaryCompleter`: show parentheses after methods. + +Fixes: +- Don't crash when trying to complete broken mappings in `DictionaryCompleter`. +- Don't crash when an older version of `black` is installed that is not + compatible. + + +3.0.19: 2021-07-08 ------------------ Fixes: @@ -10,14 +22,14 @@ Fixes: - Allow usage of `await` in assignment expressions or for-loops. -3.0.18: 2020-06-26 +3.0.18: 2021-06-26 ------------------ Fixes: - Made "black" an optional dependency. -3.0.17: 2020-03-22 +3.0.17: 2021-03-22 ------------------ Fixes: @@ -26,7 +38,7 @@ Fixes: - Fix race condition during retrieval of signatures. -3.0.16: 2020-02-11 +3.0.16: 2021-02-11 ------------------ (Commit 7f619e was missing in previous release.) @@ -38,7 +50,7 @@ Fixes: completions were missed out if the fuzzy completer doesn't find them. -3.0.15: 2020-02-11 +3.0.15: 2021-02-11 ------------------ New features: @@ -48,7 +60,7 @@ Fixes: - Fix `AttributeError` during retrieval of signatures with type annotations. -3.0.14: 2020-02-10 +3.0.14: 2021-02-10 ------------------ New features: @@ -67,7 +79,7 @@ Fixes: - Hide signature when sidebar is visible. -3.0.13: 2020-01-26 +3.0.13: 2021-01-26 ------------------ New features: @@ -82,7 +94,7 @@ Fixes: - Fix line ending bug in pager. -3.0.12: 2020-01-24 +3.0.12: 2021-01-24 ------------------ New features: @@ -96,7 +108,7 @@ Fixes: - Properly handle `SystemExit`. -3.0.11: 2020-01-20 +3.0.11: 2021-01-20 ------------------ New features: @@ -119,7 +131,7 @@ Fixes: - Don't execute PYTHONSTARTUP when -i flag was given. -3.0.10: 2020-01-13 +3.0.10: 2021-01-13 ------------------ Fixes: @@ -128,7 +140,7 @@ Fixes: default. -3.0.9: 2020-01-10 +3.0.9: 2021-01-10 ----------------- New features: @@ -137,7 +149,7 @@ New features: - Show REPL title in pager. -3.0.8: 2020-01-05 +3.0.8: 2021-01-05 ----------------- New features: diff --git a/PKG-INFO b/PKG-INFO new file mode 100644 index 0000000..9446457 --- /dev/null +++ b/PKG-INFO @@ -0,0 +1,263 @@ +Metadata-Version: 2.1 +Name: ptpython +Version: 3.0.20 +Summary: Python REPL build on top of prompt_toolkit +Home-page: https://github.com/prompt-toolkit/ptpython +Author: Jonathan Slenders +License: UNKNOWN +Description: ptpython + ======== + + |Build Status| |PyPI| |License| + + *A better Python REPL* + + :: + + pip install ptpython + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/example1.png + + Ptpython is an advanced Python REPL. It should work on all + Python versions from 2.6 up to 3.9 and work cross platform (Linux, + BSD, OS X and Windows). + + Note: this version of ptpython requires at least Python 3.6. Install ptpython + 2.0.5 for older Python versions. + + + Installation + ************ + + Install it using pip: + + :: + + pip install ptpython + + Start it by typing ``ptpython``. + + + Features + ******** + + - Syntax highlighting. + - Multiline editing (the up arrow works). + - Autocompletion. + - Mouse support. [1] + - Support for color schemes. + - Support for `bracketed paste `_ [2]. + - Both Vi and Emacs key bindings. + - Support for double width (Chinese) characters. + - ... and many other things. + + + [1] Disabled by default. (Enable in the menu.) + + [2] If the terminal supports it (most terminals do), this allows pasting + without going into paste mode. It will keep the indentation. + + __pt_repr__: A nicer repr with colors + ************************************* + + When classes implement a ``__pt_repr__`` method, this will be used instead of + ``__repr__`` for printing. Any `prompt_toolkit "formatted text" + `_ + can be returned from here. In order to avoid writing a ``__repr__`` as well, + the ``ptpython.utils.ptrepr_to_repr`` decorator can be applied. For instance: + + .. code:: python + + from ptpython.utils import ptrepr_to_repr + from prompt_toolkit.formatted_text import HTML + + @ptrepr_to_repr + class MyClass: + def __pt_repr__(self): + return HTML('Hello world!') + + More screenshots + **************** + + The configuration menu: + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/ptpython-menu.png + + The history page and its help: + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/ptpython-history-help.png + + Autocompletion: + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/file-completion.png + + + Embedding the REPL + ****************** + + Embedding the REPL in any Python application is easy: + + .. code:: python + + from ptpython.repl import embed + embed(globals(), locals()) + + You can make ptpython your default Python REPL by creating a `PYTHONSTARTUP file + `_ containing code + like this: + + .. code:: python + + import sys + try: + from ptpython.repl import embed + except ImportError: + print("ptpython is not available: falling back to standard prompt") + else: + sys.exit(embed(globals(), locals())) + + + Multiline editing + ***************** + + Multi-line editing mode will automatically turn on when you press enter after a + colon. + + To execute the input in multi-line mode, you can either press ``Alt+Enter``, or + ``Esc`` followed by ``Enter``. (If you want the first to work in the OS X + terminal, you have to check the "Use option as meta key" checkbox in your + terminal settings. For iTerm2, you have to check "Left option acts as +Esc" in + the options.) + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/multiline.png + + + Syntax validation + ***************** + + Before execution, ``ptpython`` will see whether the input is syntactically + correct Python code. If not, it will show a warning, and move the cursor to the + error. + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/validation.png + + + Additional features + ******************* + + Running system commands: Press ``Meta-!`` in Emacs mode or just ``!`` in Vi + navigation mode to see the "Shell command" prompt. There you can enter system + commands without leaving the REPL. + + Selecting text: Press ``Control+Space`` in Emacs mode or ``V`` (major V) in Vi + navigation mode. + + + Configuration + ************* + + It is possible to create a ``config.py`` file to customize configuration. + ptpython will look in an appropriate platform-specific directory via `appdirs + `. See the ``appdirs`` documentation for the + precise location for your platform. A ``PTPYTHON_CONFIG_HOME`` environment + variable, if set, can also be used to explicitly override where configuration + is looked for. + + Have a look at this example to see what is possible: + `config.py `_ + + + IPython support + *************** + + Run ``ptipython`` (prompt_toolkit - IPython), to get a nice interactive shell + with all the power that IPython has to offer, like magic functions and shell + integration. Make sure that IPython has been installed. (``pip install + ipython``) + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/ipython.png + + This is also available for embedding: + + .. code:: python + + from ptpython.ipython.repl import embed + embed(globals(), locals()) + + + Django support + ************** + + `django-extensions `_ + has a ``shell_plus`` management command. When ``ptpython`` has been installed, + it will by default use ``ptpython`` or ``ptipython``. + + + PDB + *** + + There is an experimental PDB replacement: `ptpdb + `_. + + + Windows support + *************** + + ``prompt_toolkit`` and ``ptpython`` works better on Linux and OS X than on + Windows. Some things might not work, but it is usable: + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/windows.png + + + FAQ + *** + + **Q**: The ``Ctrl-S`` forward search doesn't work and freezes my terminal. + + **A**: Try to run ``stty -ixon`` in your terminal to disable flow control. + + **Q**: The ``Meta``-key doesn't work. + + **A**: For some terminals you have to enable the Alt-key to act as meta key, but you + can also type ``Escape`` before any key instead. + + + Alternatives + ************ + + - `BPython `_ + - `IPython `_ + + If you find another alternative, you can create an issue and we'll list it + here. If you find a nice feature somewhere that is missing in ``ptpython``, + also create a GitHub issue and maybe we'll implement it. + + + Special thanks to + ***************** + + - `Pygments `_: Syntax highlighter. + - `Jedi `_: Autocompletion library. + - `wcwidth `_: Determine columns needed for a wide characters. + - `prompt_toolkit `_ for the interface. + + .. |Build Status| image:: https://api.travis-ci.org/prompt-toolkit/ptpython.svg?branch=master + :target: https://travis-ci.org/prompt-toolkit/ptpython# + + .. |License| image:: https://img.shields.io/github/license/prompt-toolkit/ptpython.svg + :target: https://github.com/prompt-toolkit/ptpython/blob/master/LICENSE + + .. |PyPI| image:: https://pypip.in/version/ptpython/badge.svg + :target: https://pypi.python.org/pypi/ptpython/ + :alt: Latest Version + +Platform: UNKNOWN +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python +Requires-Python: >=3.6 +Provides-Extra: ptipython +Provides-Extra: all diff --git a/docs/concurrency-challenges.rst b/docs/concurrency-challenges.rst deleted file mode 100644 index b56d969..0000000 --- a/docs/concurrency-challenges.rst +++ /dev/null @@ -1,91 +0,0 @@ - -Concurrency-related challenges regarding embedding of ptpython in asyncio code -============================================================================== - -Things we want to be possible ------------------------------ - -- Embed blocking ptpython in non-asyncio code (the normal use case). -- Embed blocking ptpython in asyncio code (the event loop will block). -- Embed awaitable ptpython in asyncio code (the loop will continue). -- React to resize events (SIGWINCH). -- Support top-level await. -- Be able to patch_stdout, so that logging messages from another thread will be - printed above the prompt. -- It should be possible to handle `KeyboardInterrupt` during evaluation of an - expression. -- The "eval" should happen in the same thread from where embed() was called. - - -Limitations of asyncio/python ------------------------------ - -- We can only listen to SIGWINCH signal (resize) events in the main thread. - -- Usage of Control-C for triggering a `KeyboardInterrupt` only works for code - running in the main thread. (And only if the terminal was not set in raw - input mode). - -- Spawning a new event loop from within a coroutine, that's being executed in - an existing event loop is not allowed in asyncio. We can however spawn any - event loop in a separate thread, and wait for that thread to finish. - -- For patch_stdout to work correctly, we have to know what prompt_toolkit - application is running on the terminal, then tell that application to print - the output and redraw itself. - - -Additional challenges for IPython ---------------------------------- - -IPython supports integration of 3rd party event loops (for various GUI -toolkits). These event loops are supposed to continue running while we are -prompting for input. In an asyncio environment, it means that there are -situations where we have to juggle three event loops: - -- The asyncio loop in which the code was embedded. -- The asyncio loop from the prompt. -- The 3rd party GUI loop. - -Approach taken in ptpython 3.0.11 ---------------------------------- - -For ptpython, the most reliable solution is to to run the prompt_toolkit input -prompt in a separate background thread. This way it can use its own asyncio -event loop without ever having to interfere with whatever runs in the main -thread. - -Then, depending on how we embed, we do the following: -When a normal blocking embed is used: - * We start the UI thread for the input, and do a blocking wait on - `thread.join()` here. - * The "eval" happens in the main thread. - * The "print" happens also in the main thread. Unless a pager is shown, - which is also a prompt_toolkit application, then the pager itself is runs - also in another thread, similar to the way we do the input. - -When an awaitable embed is used, for embedding in a coroutine, but having the -event loop continue: - * We run the input method from the blocking embed in an asyncio executor - and do an `await loop.run_in_excecutor(...)`. - * The "eval" happens again in the main thread. - * "print" is also similar, except that the pager code (if used) runs in an - executor too. - -This means that the prompt_toolkit application code will always run in a -different thread. It means it won't be able to respond to SIGWINCH (window -resize events), but prompt_toolkit's 3.0.11 has now terminal size polling which -solves this. - -Control-C key presses won't interrupt the main thread while we wait for input, -because the prompt_toolkit application turns the terminal in raw mode, while -it's reading, which means that it will receive control-c key presses as raw -data in its own thread. - -Top-level await works in most situations as expected. -- If a blocking embed is used. We execute ``loop.run_until_complete(code)``. - This assumes that the blocking embed is not used in a coroutine of a running - event loop, otherwise, this will attempt to start a nested event loop, which - asyncio does not support. In that case we will get an exception. -- If an awaitable embed is used. We literally execute ``await code``. This will - integrate nicely in the current event loop. diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 5a7ef2e..0000000 --- a/mypy.ini +++ /dev/null @@ -1,6 +0,0 @@ -[mypy] -ignore_missing_imports = True -no_implicit_optional = True -platform = win32 -strict_equality = True -strict_optional = True diff --git a/ptpython.egg-info/PKG-INFO b/ptpython.egg-info/PKG-INFO new file mode 100644 index 0000000..9446457 --- /dev/null +++ b/ptpython.egg-info/PKG-INFO @@ -0,0 +1,263 @@ +Metadata-Version: 2.1 +Name: ptpython +Version: 3.0.20 +Summary: Python REPL build on top of prompt_toolkit +Home-page: https://github.com/prompt-toolkit/ptpython +Author: Jonathan Slenders +License: UNKNOWN +Description: ptpython + ======== + + |Build Status| |PyPI| |License| + + *A better Python REPL* + + :: + + pip install ptpython + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/example1.png + + Ptpython is an advanced Python REPL. It should work on all + Python versions from 2.6 up to 3.9 and work cross platform (Linux, + BSD, OS X and Windows). + + Note: this version of ptpython requires at least Python 3.6. Install ptpython + 2.0.5 for older Python versions. + + + Installation + ************ + + Install it using pip: + + :: + + pip install ptpython + + Start it by typing ``ptpython``. + + + Features + ******** + + - Syntax highlighting. + - Multiline editing (the up arrow works). + - Autocompletion. + - Mouse support. [1] + - Support for color schemes. + - Support for `bracketed paste `_ [2]. + - Both Vi and Emacs key bindings. + - Support for double width (Chinese) characters. + - ... and many other things. + + + [1] Disabled by default. (Enable in the menu.) + + [2] If the terminal supports it (most terminals do), this allows pasting + without going into paste mode. It will keep the indentation. + + __pt_repr__: A nicer repr with colors + ************************************* + + When classes implement a ``__pt_repr__`` method, this will be used instead of + ``__repr__`` for printing. Any `prompt_toolkit "formatted text" + `_ + can be returned from here. In order to avoid writing a ``__repr__`` as well, + the ``ptpython.utils.ptrepr_to_repr`` decorator can be applied. For instance: + + .. code:: python + + from ptpython.utils import ptrepr_to_repr + from prompt_toolkit.formatted_text import HTML + + @ptrepr_to_repr + class MyClass: + def __pt_repr__(self): + return HTML('Hello world!') + + More screenshots + **************** + + The configuration menu: + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/ptpython-menu.png + + The history page and its help: + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/ptpython-history-help.png + + Autocompletion: + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/file-completion.png + + + Embedding the REPL + ****************** + + Embedding the REPL in any Python application is easy: + + .. code:: python + + from ptpython.repl import embed + embed(globals(), locals()) + + You can make ptpython your default Python REPL by creating a `PYTHONSTARTUP file + `_ containing code + like this: + + .. code:: python + + import sys + try: + from ptpython.repl import embed + except ImportError: + print("ptpython is not available: falling back to standard prompt") + else: + sys.exit(embed(globals(), locals())) + + + Multiline editing + ***************** + + Multi-line editing mode will automatically turn on when you press enter after a + colon. + + To execute the input in multi-line mode, you can either press ``Alt+Enter``, or + ``Esc`` followed by ``Enter``. (If you want the first to work in the OS X + terminal, you have to check the "Use option as meta key" checkbox in your + terminal settings. For iTerm2, you have to check "Left option acts as +Esc" in + the options.) + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/multiline.png + + + Syntax validation + ***************** + + Before execution, ``ptpython`` will see whether the input is syntactically + correct Python code. If not, it will show a warning, and move the cursor to the + error. + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/validation.png + + + Additional features + ******************* + + Running system commands: Press ``Meta-!`` in Emacs mode or just ``!`` in Vi + navigation mode to see the "Shell command" prompt. There you can enter system + commands without leaving the REPL. + + Selecting text: Press ``Control+Space`` in Emacs mode or ``V`` (major V) in Vi + navigation mode. + + + Configuration + ************* + + It is possible to create a ``config.py`` file to customize configuration. + ptpython will look in an appropriate platform-specific directory via `appdirs + `. See the ``appdirs`` documentation for the + precise location for your platform. A ``PTPYTHON_CONFIG_HOME`` environment + variable, if set, can also be used to explicitly override where configuration + is looked for. + + Have a look at this example to see what is possible: + `config.py `_ + + + IPython support + *************** + + Run ``ptipython`` (prompt_toolkit - IPython), to get a nice interactive shell + with all the power that IPython has to offer, like magic functions and shell + integration. Make sure that IPython has been installed. (``pip install + ipython``) + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/ipython.png + + This is also available for embedding: + + .. code:: python + + from ptpython.ipython.repl import embed + embed(globals(), locals()) + + + Django support + ************** + + `django-extensions `_ + has a ``shell_plus`` management command. When ``ptpython`` has been installed, + it will by default use ``ptpython`` or ``ptipython``. + + + PDB + *** + + There is an experimental PDB replacement: `ptpdb + `_. + + + Windows support + *************** + + ``prompt_toolkit`` and ``ptpython`` works better on Linux and OS X than on + Windows. Some things might not work, but it is usable: + + .. image :: https://github.com/jonathanslenders/ptpython/raw/master/docs/images/windows.png + + + FAQ + *** + + **Q**: The ``Ctrl-S`` forward search doesn't work and freezes my terminal. + + **A**: Try to run ``stty -ixon`` in your terminal to disable flow control. + + **Q**: The ``Meta``-key doesn't work. + + **A**: For some terminals you have to enable the Alt-key to act as meta key, but you + can also type ``Escape`` before any key instead. + + + Alternatives + ************ + + - `BPython `_ + - `IPython `_ + + If you find another alternative, you can create an issue and we'll list it + here. If you find a nice feature somewhere that is missing in ``ptpython``, + also create a GitHub issue and maybe we'll implement it. + + + Special thanks to + ***************** + + - `Pygments `_: Syntax highlighter. + - `Jedi `_: Autocompletion library. + - `wcwidth `_: Determine columns needed for a wide characters. + - `prompt_toolkit `_ for the interface. + + .. |Build Status| image:: https://api.travis-ci.org/prompt-toolkit/ptpython.svg?branch=master + :target: https://travis-ci.org/prompt-toolkit/ptpython# + + .. |License| image:: https://img.shields.io/github/license/prompt-toolkit/ptpython.svg + :target: https://github.com/prompt-toolkit/ptpython/blob/master/LICENSE + + .. |PyPI| image:: https://pypip.in/version/ptpython/badge.svg + :target: https://pypi.python.org/pypi/ptpython/ + :alt: Latest Version + +Platform: UNKNOWN +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python +Requires-Python: >=3.6 +Provides-Extra: ptipython +Provides-Extra: all diff --git a/ptpython.egg-info/SOURCES.txt b/ptpython.egg-info/SOURCES.txt new file mode 100644 index 0000000..01ce1c4 --- /dev/null +++ b/ptpython.egg-info/SOURCES.txt @@ -0,0 +1,54 @@ +.gitignore +CHANGELOG +LICENSE +MANIFEST.in +README.rst +pyproject.toml +setup.cfg +setup.py +docs/images/example1.png +docs/images/file-completion.png +docs/images/ipython.png +docs/images/multiline.png +docs/images/ptpython-history-help.png +docs/images/ptpython-menu.png +docs/images/ptpython.png +docs/images/validation.png +docs/images/windows.png +examples/asyncio-python-embed.py +examples/asyncio-ssh-python-embed.py +examples/python-embed-with-custom-prompt.py +examples/python-embed.py +examples/python-input.py +examples/ssh-and-telnet-embed.py +examples/ptpython_config/config.py +examples/test-cases/ptpython-in-other-thread.py +ptpython/__init__.py +ptpython/__main__.py +ptpython/completer.py +ptpython/eventloop.py +ptpython/filters.py +ptpython/history_browser.py +ptpython/ipython.py +ptpython/key_bindings.py +ptpython/layout.py +ptpython/lexer.py +ptpython/prompt_style.py +ptpython/python_input.py +ptpython/repl.py +ptpython/signatures.py +ptpython/style.py +ptpython/utils.py +ptpython/validator.py +ptpython.egg-info/PKG-INFO +ptpython.egg-info/SOURCES.txt +ptpython.egg-info/dependency_links.txt +ptpython.egg-info/entry_points.txt +ptpython.egg-info/requires.txt +ptpython.egg-info/top_level.txt +ptpython/contrib/__init__.py +ptpython/contrib/asyncssh_repl.py +ptpython/entry_points/__init__.py +ptpython/entry_points/run_ptipython.py +ptpython/entry_points/run_ptpython.py +tests/run_tests.py \ No newline at end of file diff --git a/ptpython.egg-info/dependency_links.txt b/ptpython.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/ptpython.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/ptpython.egg-info/entry_points.txt b/ptpython.egg-info/entry_points.txt new file mode 100644 index 0000000..c8c4061 --- /dev/null +++ b/ptpython.egg-info/entry_points.txt @@ -0,0 +1,8 @@ +[console_scripts] +ptipython = ptpython.entry_points.run_ptipython:run +ptipython3 = ptpython.entry_points.run_ptipython:run +ptipython3.9 = ptpython.entry_points.run_ptipython:run +ptpython = ptpython.entry_points.run_ptpython:run +ptpython3 = ptpython.entry_points.run_ptpython:run +ptpython3.9 = ptpython.entry_points.run_ptpython:run + diff --git a/ptpython.egg-info/requires.txt b/ptpython.egg-info/requires.txt new file mode 100644 index 0000000..9cf7d55 --- /dev/null +++ b/ptpython.egg-info/requires.txt @@ -0,0 +1,13 @@ +appdirs +jedi>=0.16.0 +prompt_toolkit<3.1.0,>=3.0.18 +pygments + +[:python_version < "3.8"] +importlib_metadata + +[all] +black + +[ptipython] +ipython diff --git a/ptpython.egg-info/top_level.txt b/ptpython.egg-info/top_level.txt new file mode 100644 index 0000000..5af80c7 --- /dev/null +++ b/ptpython.egg-info/top_level.txt @@ -0,0 +1 @@ +ptpython diff --git a/ptpython/completer.py b/ptpython/completer.py index 285398c..51a4086 100644 --- a/ptpython/completer.py +++ b/ptpython/completer.py @@ -505,6 +505,10 @@ class DictionaryCompleter(Completer): display=f"[{k_repr}]", display_meta=abbr_meta(self._do_repr(result[k])), ) + except KeyError: + # `result[k]` lookup failed. Trying to complete + # broken object. + pass except ReprFailedError: pass @@ -521,6 +525,10 @@ class DictionaryCompleter(Completer): display=f"[{k_repr}]", display_meta=abbr_meta(self._do_repr(result[k])), ) + except KeyError: + # `result[k]` lookup failed. Trying to complete + # broken object. + pass except ReprFailedError: pass @@ -545,9 +553,8 @@ class DictionaryCompleter(Completer): def get_suffix(name: str) -> str: try: obj = getattr(result, name, None) - if inspect.isfunction(obj): + if inspect.isfunction(obj) or inspect.ismethod(obj): return "()" - if isinstance(obj, dict): return "{}" if isinstance(obj, (list, tuple)): diff --git a/ptpython/py.typed b/ptpython/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/ptpython/repl.py b/ptpython/repl.py index 220c673..b55b5d5 100644 --- a/ptpython/repl.py +++ b/ptpython/repl.py @@ -135,6 +135,12 @@ class PythonRepl(PythonInput): text = self.read() except EOFError: return + except BaseException as e: + # Something went wrong while reading input. + # (E.g., a bug in the completer that propagates. Don't + # crash the REPL.) + traceback.print_exc() + continue # Run it; display the result (or errors if applicable). self.run_and_show_expression(text) @@ -192,6 +198,12 @@ class PythonRepl(PythonInput): text = await loop.run_in_executor(None, self.read) except EOFError: return + except BaseException: + # Something went wrong while reading input. + # (E.g., a bug in the completer that propagates. Don't + # crash the REPL.) + traceback.print_exc() + continue # Eval. await self.run_and_show_expression_async(text) @@ -333,6 +345,9 @@ class PythonRepl(PythonInput): # not used. try: import black + + if not hasattr(black, "Mode"): + raise ImportError except ImportError: pass # no Black package in your installation else: diff --git a/setup.cfg b/setup.cfg index 3c6e79c..adf5ed7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,7 @@ [bdist_wheel] -universal=1 +universal = 1 + +[egg_info] +tag_build = +tag_date = 0 + diff --git a/setup.py b/setup.py index faab112..72a0e8b 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with open(os.path.join(os.path.dirname(__file__), "README.rst")) as f: setup( name="ptpython", author="Jonathan Slenders", - version="3.0.19", + version="3.0.20", url="https://github.com/prompt-toolkit/ptpython", description="Python REPL build on top of prompt_toolkit", long_description=long_description, -- cgit v1.2.3