Support GNU readline-like keybinds in the Windows REPL

CPython for Unix builds with GNU readline, which doesn’t support Windows, so the user experience in the Windows Python REPL is much worse compared to Unix. I would like for the Windows REPL to at least support keybinds like C-P, C-N, C-A, C-E etc. I know this is a complicated problem and I’ve found a lot of related issues on Github, but none of them specifically mention the usability of the Windows REPL or the implementation of readline-like features for Windows as a main issue.

For inspiration, Node.js emulates most readline features through an internal javascript library.

My question: Is there anything substantial blocking the removal of GNU readline as a dependency (for a custom cross-platform implementation)? If the worry is breaking API or breaking other applications, what specific readline API does python expose?

Not worse, just different. I find the Windows experience very comfortable (and consistent with all the other Windows CLI programs I use) whereas the Unix experience is unfamiliar and frustrating.

People’s tastes vary.

If you want readline support in WIndows, you can install a readline library (which admittedly you’ll have to find yourself) and Python will recognise it and activate the same readline support as used in Unix.

Is this true? Could you please point to the documentation or source code where CPython activates readline for Windows if a library is found? AFAIK from reading the docs and source code, the builtin readline module could support the readline emulation library of editline/libedit, but runtime detection is only done on macOS

In the PC build config header, I found this:

But this macro isn’t used anywhere else in the code base.

Sorry I misremembered. What is needed is a readline module that implements the interface documented in the stdlib. The pyreadline project provided such a module on Windows. It’s not been updated since 2015 so it may be unmaintained these days. But I’m sure someone with enough interest could check if it still works and bring it up to date.

Compiling more issues related to CPython’s use of readline/editline

Closed:

Open: