Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab-Completion in Development REPL #3010

Open
1 task done
hoffmanr-cshs opened this issue Nov 21, 2024 · 0 comments
Open
1 task done

Tab-Completion in Development REPL #3010

hoffmanr-cshs opened this issue Nov 21, 2024 · 0 comments

Comments

@hoffmanr-cshs
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like

The development REPL is a great feature, and tab-completion would make it that much more powerful and easier to work with. I've put together a working proof-of-concept of the dev REPL with tab-completion support at hoffmanr-cshs/sanic@6596625, showing how approachable an implementation could be.

Additional context

The above fork uses the new readline.backend attribute in Python 3.13 and later, and for older versions falls back on checking the readline module's metadata / docstring to detect the backend in use. (testing the contents of the docstring may look a bit janky, but it seems to be what was standard / recommended up until Python 3.13 - see discussion python/cpython#112510 and example, more examples)

I've tested my fork on MacOS with python versions 3.10-3.12, including variants with GNU readline installed. Given that most of the complexity is going to be in dealing with the readline / libedit mess on Mac, hopefully this will cover most of the edgiest cases. With that said, I'm not 100% sure how this would interact with users' own inputrc or editrc files (especially complex ones or unusual key binds), or if that would match the Python built-in interpreter's behavior. More testing would potentially be needed, even beyond just verifying that it runs on different platforms and python versions.

So, I thought it best to raise this as an issue / feature request (rather than just firing a half-baked PR out into the void), to see if there's anyone else as interested in this feature as I am!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant