-
Notifications
You must be signed in to change notification settings - Fork 168
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
Define JSON Schema for construct.yml
#943
Open
jaimergp
wants to merge
30
commits into
conda:main
Choose a base branch
from
jaimergp:pydantic-schema
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+2,261
−1,435
Conversation
This file contains 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
bollwyvl
reviewed
Feb 28, 2025
jaimergp
commented
Mar 5, 2025
construct.yml
jaimergp
commented
Mar 6, 2025
…o pydantic-schema
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 PR converts our venerable
construct.py
"schema" to a proper JSON Schema. The Schema is built with Pydantic at "commit time" as we do with docs regeneration. At runtime, only the lightweightjsonschema
package is used for validation.With this change we have:
construct.yml
to the schema in the repoHowever we have lost the ability to report type information in the docs (the autogenerated annotations are too wordy and noisy). I'm not too worried about this because the information was sometimes inaccurate anyway. Instead users are encouraged to use the schema directly, either in their IDE, or exploring it interactively in apps like https://json-schema.app/view/%23?url=https%3A%2F%2Fraw.githubusercontent.com%2Fjaimergp%2Fconstructor%2Frefs%2Fheads%2Fpydantic-schema%2Fconstructor%2Fdata%2Fconstructor.schema.json.
Checklist - did you ...
news
directory (using the template) for the next release's release notes?Additional context:
@bollwyvl mentioned this in a conda-forge Zulip thread and I couldn't resist to attempt a crude conversion. The first commit already gives you inline descriptions and some type validation.
Plenty of work ahead for the very diverse types and actual default values, plus integration with
constructor
itself.For fun and laughs, this is the crude script that I used to convert our venerable
KEYS
"schema" to a Pydantic model: