GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-131507: Add support for syntax highlighting in PyREPL by ambv · Pull Request #133247 · python/cpython Conversation
|
|
🤖 New build scheduled with the buildbot fleet by @ambv for commit ffebbbe 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133247%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being too nitpicky, but I still find the blue used for keywords to be too dark when coupled with dark-themed terminals (e.g. #131562 (comment)). Do you think we could use a more contrasting color?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I disagree about the blue color, the fact that Ubuntu colors it too dim is not actionable for the Python project. Adjust your terminal. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The refleak failures are unrelated, see #133258. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry for only spotting the Yeah, simple is always better 👍
I can confirm: this PR is now way faster pasting in the virtual terminal mode on Windows 🚀 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| done = "\x1b[201~" | ||
| data = "" | ||
| import time | ||
| start = time.time() |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Leftover from testing?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The trace below shows time. I can move the import up.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Then use perf_counter please
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I left a bunch of questions and nitpicks but overall this looks fantastic.
I've reviewed the tokenizer-related parts of the implementation and I'm comfortable with the current approach. We have already discussed this offline but for everyone else reading: while the soft keyword detection uses heuristics, this is a reasonable compromise as bringing in a more correct solution would require a full parser run, which would be much heavier and slower for this use case and we don't even have the technology now to do partial input in the PEG parser so whatever we do will be in python and much slower.
I've also run some performance benchmarks and things look really good — the impact on responsiveness is minimal, even with syntax highlighting enabled by default. And on Windows seem to be super fast.
I'm happy to explore further optimizations in the future, such as avoiding repeated tokenization during screen refreshes. But as it stands, this looks solid. Great work!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
The only open question is what to do for setting the theme officially (right now is a "experimental" API) but I think since that affects other parts of the interpreter (such as tracebacks) this is out of scope of this particular PR, so I propose to discuss this separately |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
In a legacy Windows console, the prompt is no longer colored, but e.g. a SyntaxError still is. Also, syntax highlighting is turned off (this maybe is wanted behaviour?) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Good catch, @chris-eibl. I'll fix it forward in a subsequent PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Calling cpython/Lib/_pyrepl/windows_console.py Lines 150 to 155 in fac41f5
does fix it for me. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…nGH-133247) Co-authored-by: Victorien <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.