cpython
cpython copied to clipboard
Colorize sqlite3 CLI
Feature or enhancement
Proposal:
I will open a pr once https://github.com/python/cpython/pull/133393 is complete.
General idea is to follow repl color scheme:
sqlite>: repl magenta (i.e. >>>)
keywords: repl keyword blue (i.e. def)
.quit/.help: repl turquoise (i.e. exit)
rest: no color
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
- gh-133461
- gh-135224
- gh-136079
See also theming support, which will hopefully be merged soon: issue https://github.com/python/cpython/issues/133346 / PR https://github.com/python/cpython/pull/133347.
I like how Stan is already talking in terms of semantic classes.
Unfortunately the code currently uses a subclass of InteractiveConsole (color support anytime soon? ;-) so I would have to write a raw_input, but that still has to wait for the other pr ideally.
For now I will open a pr adding color to the line starts as it is not depending on the pr. (Progressing like pyrepl coloring...)
This is not in the sqlite3 project.
cc @ezio-melotti Can the project be set up to add them when the label is used topic-sqlite3, it would be a good test for the github workflow-like automations for projects that we discussed earlier?
Done!
Details
I enabled the auto-add workflow:which matches 7 issues -- including this one -- but doesn't add them unless they are updated or newly created:
Note: after enabling the workflow and posting this message, the issue wasn't added to the workflow, so I added it manually. The GitHub docs are not clear on what "updated" means (apparently posting a message doesn't count as an update).
Note: I initially added in:title to the auto-add workflow query, but I got an error stating that it's invalid. Even after removing it, the query matches 7 issues, even though when I follow the "See 7 existing issues" link I get 50 issues. I now reported this issue to GitHub.
posting this message, the issue wasn't added to the workflow
That is odd, maybe it only checks on title modifications?
I initially added in:title to the auto-add workflow query, but I got an error stating that it's invalid.
We could add on the label addition instead like other projects.
We could add on the label addition instead like other projects.
Done, and it seems it work on label addition (tested on #129926).
The new sqlite CLI allows spaces between a dot and the command:
sqlite> . quit
I don't think that was an intentional change?
I don't think that was an intentional change?
I believe @serhiy-storchaka merged the change that opened up allowing this.
For reference, the issue: https://github.com/python/cpython/issues/133439, the commit: https://github.com/python/cpython/commit/ebd4881db2e8448b238d8ca2f6fcf331826132dd
It also has several other errors, like no spacing between words in the error message. (I have a pr to fix these: https://github.com/python/cpython/pull/133807/)
I don't think that was an intentional change?
It was intentional. The SQLite CLI allows this.
Thank you for the fix! Is there anything more to do for this issue?
Is there anything more to do for this issue?
The goal for this issue was:
and so far we have:
Though realistically if we do want to implement this, it shouldn't be in sqlite3 because it will just create a mess and add too much complex logic to maintain (in a module that should not have it), especially with the tab completion now.
So I propose to just add a Whats New note like was done in 3.13 for the REPL, and we can always reopen in the future.