-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Make pygments mandatory and fix string highlighting #13189
Make pygments mandatory and fix string highlighting #13189
Conversation
The-Compiler
commented
Feb 3, 2025
- Closes Add "color" install extra #7683
- Fixes (🎁) color the diff of strings #13175
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
747caba
to
44e9f68
Compare
Didn't quite work out as planned, as I didn't see that the pytest/src/_pytest/assertion/util.py Lines 590 to 599 in afdf03b
Opted to add a |
Sounds good to me. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome PR, this is a very welcome change
I think it would make sense to document the extra somewhere. explain why it exists/what it does
I don't think there's a good place for this in the docs, especially because we don't do this kind of thing for any of the other dependencies either. And if you see it in action (and/or know what Pygments does), I think it's kind of obvious. |
I have no idea what pygments is/does, and I have no idea how to discover if a package has any extras or not. I think not stating that this extra functionality is available would be a disservice to your users 🙂 |
This PR makes it a dependency, not an extra. You don't need to know it exists, you will just get syntax highlighting after installing pytest. |
oh, my mistake! sorry, okay that's great! |
44e9f68
to
ca6557e
Compare
ca6557e
to
cb089b6
Compare
@Pierre-Sassoulas @Zac-HD @RonnyPfannschmidt Do you have any objections/concerns with adding Pygments as a default dependency (at least until PEP 771 – Default Extras for Python Software Packages | peps.python.org is a thing), or should I merge this? (Sorry for the explicit ping - not asking for a full review as I think we have this covered, just for an opinion on the dependency because I'd like to give everyone a chance to speak up if there is some implication I didn't consider) |
In general I prefer minimal dependencies, but I think the case for Pygments is strong enough to add it in this case. If we do get a default-extras PEP I'd be keen to move it to that and make sure we test without it too though. |
The PEP is now up for discussion, please leave a comment if you'd like to add your support or give other feedback: https://discuss.python.org/t/pep-771-default-extras-for-python-software-packages/79706 |