Skip to content

Bugfix: Restore native in __init__.py #2484

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

Merged
merged 2 commits into from
Aug 6, 2023

Conversation

psobolewskiPhD
Copy link
Contributor

Over at https://github.com/napari/napari
We're getting test failures due to a validation error:
napari/napari#6121

napari/utils/events/evented_model.py:246: in __init__
    super().__init__(**kwargs)
pydantic/main.py:341: in pydantic.main.BaseModel.__init__
    ???
E   pydantic.error_wrappers.ValidationError: 1 validation error for Theme
E   syntax_style
E     Incorrect `syntax_style` value: native provided. Please use one of the following:  abap, algol, algol_nu, arduino, autumn, bw, borland, colorful, default, dracula, emacs, fruity, friendly, friendly_grayscale, github-dark, gruvbox-dark, gruvbox-light, igor, inkpot, lightbulb, lilypond, lovelace, manni, material, monokai, murphy, nord, nord-darker, one-dark, paraiso-dark, paraiso-light, pastie, perldoc, rainbow_dash, rrt, sas, solarized-dark, solarized-light, staroffice, stata, stata-dark, stata-light, tango, trac, vim, vs, xcode, zenburn
E   assert 'native' in {'abap': 'abap::AbapStyle', 'algol': 'algol::AlgolStyle', 'algol_nu': 'algol_nu::Algol_NuStyle', 'arduino': 'arduino::ArduinoStyle', ...} (type=assertion_error)

Investigating, I noticed that in PR #2443 native was dropped from the list. I assume it was not intentional, because the style itself does not appear to have been removed:
https://github.com/pygments/pygments/blob/master/pygments/styles/native.py

So in this PR I re-add 'native': 'native::NativeStyle', to the list in the proper alphabetical spot.
This fixes our issues in napari.

@jeanas jeanas merged commit 1eaa6d7 into pygments:master Aug 6, 2023
@jeanas
Copy link
Contributor

jeanas commented Aug 6, 2023

Thank you. @Anteru Are you available for a hotfix release?

@Anteru
Copy link
Collaborator

Anteru commented Aug 6, 2023

Yeah, I was just about to do one :( Just double-checking we didn't throw away more styles in that PR.

@Anteru Anteru added this to the 2.16.1 milestone Aug 6, 2023
@Anteru
Copy link
Collaborator

Anteru commented Aug 6, 2023

Turns out the style map wasn't even sorted properly ... what a mess 😢

@Anteru
Copy link
Collaborator

Anteru commented Aug 6, 2023

Shipped as 2.16.1. Sorry for the inconvenience -- looks like we need some better test strategy for the style map, given people can edit this manually and it should be possible to iterate over all files in styles/*, get all classes derived from Style, and verify against that list.

@jeanas
Copy link
Contributor

jeanas commented Aug 6, 2023

Yeah, we can probably do the same for styles as we're doing with tox -e mapfiles for lexers and formatters.

@Anteru
Copy link
Collaborator

Anteru commented Aug 6, 2023

We can and we should :)

@psobolewskiPhD
Copy link
Contributor Author

Thanks y'all, really appreciate such a quick response and on a weekend no less.
❤️

@psobolewskiPhD psobolewskiPhD deleted the psobolewskiPhD-patch-1 branch August 6, 2023 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants