151 Commits

Author SHA1 Message Date
Tomas R. ed99680487 gh-130472: Use fancycompleter in import completions (#148188) 2026-05-05 01:36:43 +00:00
Tian Gao 6b632ce36b gh-139167: Allow users to hook gen_colors function to pyrepl Reader (#141619) 2026-05-02 13:28:00 -07:00
Pablo Galindo Salgado 09968dd2a9 gh-148105: _pyrepl: switch console refresh to structured rendered screens (#146584) 2026-04-08 23:42:26 +01:00
Gabriel Volles Marinho 0b20bff386 gh-146458: Fix REPL height and width tracking on resize (#146459)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-07 23:09:11 +02:00
grayjk dfeb160bc3 gh-130273: Fix traceback color output with unicode characters (GH-142529)
Account for the display width of Unicode characters so that colors and underlining in traceback output is correct.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-07 15:05:23 +02:00
Pablo Galindo Salgado f8293faf37 gh-130472: Remove readline-only hacks from PyREPL completions (#148161)
PyREPL was still carrying over two readline-specific tricks from the
fancy completer: a synthetic CSI prefix to influence sorting and a fake
blank completion entry to suppress readline's prefix insertion. Those
workarounds are not appropriate in PyREPL because the reader already
owns completion ordering and menu rendering, so the fake entries leaked
into the UI as real terminal attributes and empty menu cells.

Sort completion candidates in ReadlineAlikeReader by their visible text
with stripcolor(), and let the fancy completer return only real matches.
That keeps colored completions stable without emitting bogus escape
sequences, removes the empty completion slot, and adds regression tests
for both the low-level completer output and the reader integration.
2026-04-06 14:57:25 +00:00
Loïc Simon b07becb573 gh-140870: PyREPL auto-complete module attributes in import statements (#140871)
Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2026-04-05 19:10:59 +00:00
Loïc Simon c64baff1d8 gh-69605: Add math.integer to PyREPL module completer hardcoded list (#144811) 2026-04-05 19:31:19 +01:00
Antonio Cuni 1c4408aeca gh-130472: Integrate fancycompleter with the new repl, to get colored tab completions (#130473)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2026-04-05 14:23:07 +00:00
Pieter Eendebak 1fd66eadd2 gh-139003: Use frozenset for module level attributes in _pyrepl.utils (#139004)
Use frozenset for module level attributes
2026-03-28 20:21:19 +00:00
Stan Ulbrych 087a5f6444 _pyrepl/pager.py: call less with --clear-screen (#146382) 2026-03-28 17:23:58 +00:00
Tan Long 982459132b gh-145394: Remove duplicated isearch_add_character in _pyrepl/historical_reader.py (#145396) 2026-03-19 16:38:01 +05:30
Tan Long e13f6dccd7 gh-140131: Fix REPL cursor position on Windows when module completion suggestion line hits console width (GH-140333) 2026-03-12 16:59:43 +01:00
Pablo Galindo Salgado 46d5106cfa gh-142349: Implement PEP 810 - Explicit lazy imports (#142351)
Co-authored-by: T. Wouters <twouters@meta.com >
Co-authored-by: Brittany Reynoso <breynoso@meta.com>
Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2026-02-12 00:15:33 +00:00
AN Long 3abc03c808 gh-132888: Fix Windows API error checking in pyrepl.windows_console (#144248) 2026-02-03 13:25:29 +01:00
Loïc Simon bfac54d861 gh-69605: Check for already imported modules in PyREPL module completion (GH-139461)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2026-01-05 16:18:54 +01:00
Olga Matoula 2c39b9d2f2 gh-136924: Suspend REPL colorizing when in a REPL interactive command (GH-136926)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-01-03 14:35:34 +01:00
Chris Eibl ef6f92a2a6 gh-139262: Prevent swallowing REPL input on Windows (GH-139263)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-01-02 16:17:45 +01:00
Jan-Eric Nitschke 8a2deea1fc gh-128067: Fix pyrepl overriding printed output without newlines (#138732)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-01-02 14:04:37 +01:00
yihong ecb901dd87 Drop three unused imports (#141875) 2025-11-23 16:33:05 +00:00
Tan Long 713edbcebf gh-141415: Remove unused variables and comment in _pyrepl.windows_console.py (#141416) 2025-11-11 14:27:21 -05:00
yihong 4e6dba0ef7 gh-139246: zero-width word paste can be wrong in default repl (GH-139254)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: grayjk <grayjk@gmail.com>
2025-10-30 16:14:06 +01:00
yihong b8c8b8f1d3 gh-139391: properly handle signal.signal() in UnixConsole when called from a non-main thread (#139392) 2025-10-09 14:58:01 +00:00
DeepWzh 81959a0364 gh-133400: Fixed Ctrl+D (^D) behavior in :mod:_pyrepl module (GH-133883)
Co-authored-by: adam j hartz <adam@smatz.net>
2025-10-09 16:16:48 +02:00
Łukasz Langa 2fc7004d54 gh-134466: Don't run when termios is inaccessible (GH-138911)
Without the ability to set required capabilities, the REPL cannot
function properly (syntax highlighting and multiline editing can't
work).

We refuse to work in this degraded state.
2025-09-17 12:59:49 +02:00
yihong b9dbf6acb3 gh-135329: prevent infinite traceback loop on Ctrl-C for strace (GH-138133)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: dura0ok <slpmcf@gmail.com>
Co-authored-by: graymon <greyschwinger@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-09-16 12:39:03 +02:00
Loïc Simon 537133d2b6 gh-69605: Hardcode some stdlib submodules in PyREPL module completion (os.path, collections.abc...) (GH-138268)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-09-15 18:51:34 +02:00
Łukasz Langa 811acc85d5 gh-134953: Make the True/False/None check more efficient (GH-138931) 2025-09-15 18:27:37 +02:00
yihong 8ef7735c53 gh-128636: Fix crash in PyREPL when os.environ is overwritten with an invalid value for macOS (GH-138089)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-09-15 18:26:23 +02:00
00ll00 26cfb17942 gh-138239: Fix incorrect highlighting of "type" in type statements in the REPL (GH-138241)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-09-15 18:21:41 +02:00
Stan Ulbrych a5b9d0b8b2 gh-134953: Expand theming for True/False/None (#135000)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-09-15 16:36:17 +02:00
yihong 7a3bca50e0 gh-138318, PyREPL: builtins should not be highlighted when used as attribute names (#138319) 2025-09-08 14:04:22 +01:00
ggqlq 8750e5ecfc gh-134869: Fix Ctrl+C corrupts REPL autocomplete (#134929) 2025-08-18 21:54:39 +01:00
Hood Chatham c933a6bb32 gh-124621: Emscripten: Support pyrepl in browser (GH-136931)
Basic support for pyrepl in Emscripten. Limitations:
* requires JSPI
* no signal handling implemented

As followup work, it would be nice to implement a webworker variant
for when JSPI is not available and proper signal handling.

Because it requires JSPI, it doesn't work in Safari. Firefox requires
setting an experimental flag. All the Chromiums have full support since
May. Until we make it work without JSPI, let's keep the original web_example
around.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
2025-07-22 12:13:38 +02:00
Petr Viktorin 28153fec58 gh-135621: Simplify TermInfo (GH-136916) 2025-07-21 13:06:42 +02:00
Łukasz Langa 09dfb50f1b gh-135621: Remove dependency on curses from PyREPL (GH-136758) 2025-07-21 11:57:34 +02:00
Olga Matoula 3a64844533 gh-136801: Fix PyREPL syntax highlightning on match cases after multi-line case (GH-136804) 2025-07-19 15:15:49 +02:00
Richard Si be02e68158 gh-72327: Suggest using system terminal for pip install in PyREPL (#136328)
Users new to Python packaging often try to use pip from the REPL only to
be met with a confusing SyntaxError. If this happens, guide the user to
use a system terminal instead to invoke pip.

Closes #72327

---------

Co-authored-by: Tom Viner <tom@viner.tv>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2025-07-15 14:25:07 +00:00
Dzmitry Plashchynski f320c951c3 gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (GH-131201)
Fix "msvcrt" import warning on Linux when "_ctypes" is not available.

On Linux, compiling without "libffi" causes a
"No module named 'msvcrt'" warning when launching PyREPL.
2025-07-15 09:44:31 +02:00
sobolevn b3ae76911d Bump mypy to 1.16.1 (#135720) 2025-06-23 15:29:30 +03:00
Loïc Simon 0e3bc962c6 gh-69605: Disable PyREPL module autocomplete fallback on regular completion (gh-134181)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
2025-05-26 01:05:08 +02:00
Chris Eibl 91b48868a8 GH-130328: Speedup pasting in legacy console on Windows (gh-133728) 2025-05-25 15:17:43 +02:00
Yuichiro Tachibana (Tsuchiya) b1b8962443 gh-127960 Fix the REPL to set the correct namespace by setting the correct __main__ module (gh-134275)
The `__main__` module imported in the `_pyrepl` module points to the `_pyrepl` module itself when the interpreter was launched without `-m` option and didn't execute a module,
while it's an unexpected behavior that `__main__` can be `_pyrepl` and relative imports such as `from . import *` works based on the `_pyrepl` module.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-22 02:18:00 +02:00
Kevin Hernández a3a3cf6d15 gh-134215: PyREPL: Do not show underscored modules by default during autocompletion (gh-134267)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 22:26:48 +02:00
Chris Patti c91ad5da9d gh-128066: Properly handle history file writes for RO fs on PyREPL (gh-134380)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 21:47:57 +02:00
Tom Wang 8421b03b16 gh-134235: Import Autocomplete for Builtin Modules (GH-134277)
* added enhancement auto completing import with sys builtins

---------

Co-authored-by: Hunter <hyoung3@gmail.com>
2025-05-19 14:21:30 -07:00
Loïc Simon 71ea6a6798 gh-134158: Fix PyREPL coloring of double braces in f/t-strings (gh-134159)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-19 16:12:23 +02:00
Kirill Podoprigora c31547a591 gh-134097: Print number of refs & blocks after each statement in new REPL (gh-134136)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-19 15:30:43 +02:00
Łukasz Langa b2fabce6ab gh-133541: Handle SyntaxError raised by the tokenizer on user input (#133606) 2025-05-08 21:14:38 +01:00
Matt Wozniski fd37f1a8ad gh-133490: Fix syntax highlighting for remote PDB (#133494) 2025-05-06 11:44:49 +02:00