Add argparse to pygemnts2chroma_xml.py script#1140
Merged
alecthomas merged 1 commit intoSep 12, 2025
Conversation
alecthomas
reviewed
Sep 11, 2025
|
|
||
| ```sh | ||
| python3 _tools/pygments2chroma_xml.py \ | ||
| cd _tools |
Owner
There was a problem hiding this comment.
This change and the .. below seem unnecessary...
Owner
There was a problem hiding this comment.
Also the script is executable, you can actually just run ./_tools/pygments2chroma_xml.py
Want to run this too?
uv add --script ./_tools/pygments2chroma_xml.py pystache pygments
As the script currently doesn't have the dependencies embedded, it won't automatically download them or create a venv.
Contributor
Author
There was a problem hiding this comment.
Yes that makes more sense.
Do we still need the _tools/pyprojects.toml file then?
1478f1b to
adf7b19
Compare
alecthomas
approved these changes
Sep 12, 2025
alecthomas
approved these changes
Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I also adapted the README to use
uvsince this removes an install step (uv resolves and installs dependencies onuv run).We could also debate if we should switch from
KotlinLexeras an example to some other lexer as there seems to be a bug upstream in pygments whereKotlinLexer.get_tokendefs()returns a string that is not valid unicode. You can read more about the bug in this issue.With argparse the error messages are a lot nicer and the script can better explain itself.