8000 Tab-Completion in Development REPL · Issue #3010 · sanic-org/sanic · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Tab-Completion in Development REPL #3010
Open
@hoffmanr-cshs

Description

@hoffmanr-cshs

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0