Repository navigation
feat: add schema and validate-pyproject support - #4181
Merged
Merged
Conversation
JelleZijlstra
left a comment
Collaborator
There was a problem hiding this comment.
Thank you! Some nits and questions below.
| }, | ||
| "ipynb": { | ||
| "type": "boolean", | ||
| "description": "Format all input files like Jupyter Notebooks regardless of file extension.This is useful when piping source on standard input.", |
Contributor
Author
There was a problem hiding this comment.
Rebased and picked it up (will push soon).
henryiii
commented
Jan 27, 2024
henryiii
force-pushed
the
henryiii/feat/schema
branch
2 times, most recently
from
January 28, 2024 04:04
4b20edf to
73c6cd3
Compare
henryiii
marked this pull request as ready for review
January 28, 2024 04:07
JelleZijlstra
approved these changes
Jan 28, 2024
Collaborator
|
@henryiii I fixed a few CI issues but the entry points check appears broken on 3.9 and below: |
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
henryiii
force-pushed
the
henryiii/feat/schema
branch
from
January 28, 2024 13:45
6d3a20b to
275de9a
Compare
henryiii
force-pushed
the
henryiii/feat/schema
branch
from
January 28, 2024 13:56
5495f06 to
b5a7d07
Compare
Contributor
Author
|
diff-shades reporting "Opération was cancelled" is normal? |
Collaborator
|
It's a known issue, unfortunately. This change is highly unlikely to affect Black's formatting, so I'll merge. Thank you! |
Contributor
Author
|
Awesome, thanks!
I would hope so. 😆 I'll make the SchemaStore contribution next & mention this PR. |
This was referenced Jan 29, 2024
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.
Description
This adds a script (Python 3.10+ required) to produce a JSONSchema. I've added it to the package, and provided a helper function / entrypoint to allow validate-pyproject to use it. You can try it out like this:
You can also adjust the tool.black section and see the validation errors. :)
I've also included a
--schemastoreoption, which adjusts the output a little for SchemaStore. After this goes in, I'll make a PR to SchemaStore with the schema. The main difference isenable-unstable-featureis simplified to just be any string. If someone is getting the schema directly from black, then they get the exact enum of options, but SchemaStore is not versioned.Closes #4160.
This goes along with #4178 and doesn't include all the interesting ways to set things that are technically currently supported, like using strings instead of bools and using
_instead of-.Checklist - did you ...
CHANGES.mdif necessary?I'll adjust those things after I see how much/little is needed here. I could add (re)generation of the schema file to CI, some tests using validate-pyproject, etc. Or I could remove parts too.
I also realize I forgot to see if this works on Python 3.8, as the importlib logic is different there.