Skip to content

chore: add a utility to generate a schema file#16601

Open
henryiii wants to merge 3 commits into
python:masterfrom
henryiii:henryiii/chore/schema
Open

chore: add a utility to generate a schema file#16601
henryiii wants to merge 3 commits into
python:masterfrom
henryiii:henryiii/chore/schema

Conversation

@henryiii

@henryiii henryiii commented Dec 1, 2023

Copy link
Copy Markdown
Contributor

This is a utility script to generate a JSONSchema file, as PR'd to SchemaStore in SchemaStore/schemastore#3422. Discussion at #16491. Currently, I'm not doing anything locally with the schema file. Ideally, I think it could be saved in mypy/resources/mypy.schema.json. A simple function to retrieve it plus an entry point would allow validate-pyproject to validate the schema file (as done by cibuildwheel & scikit-build-core). I could add a job to verify the rendering stays in sync in CI.

But starting with just the script I used to generate the SchemaStore submission, will take suggestions on what direction to go.

Comment thread misc/make_schema.py Outdated
@henryiii

Copy link
Copy Markdown
Contributor Author

I'll rebase and update in a day or two. :)

@wyattscarpenter

Copy link
Copy Markdown
Contributor

Well, presumably you know what you're doing and have some git workflow you prefer, so go ahead and do it however you like. But you could also just hit that "accept suggestion" button and see what happens 🚀

(Disclaimer: I'm not a maintainer on this project and all of my suggestions should be interpreted as a guy speculating aimlessly.)

@wyattscarpenter

Copy link
Copy Markdown
Contributor

I notice you wrote this in 3.10, so as to use match case syntax. That seems fine to me. A good choice, even. However, the type checker is complaining. You could easily silence that with a assert sys.version_info > (3,9) line that will make the type checker just ignore this file in 3.9 mode... except that, unfortunately, match-case syntax specifically breaks that, as a bug #19923

@henryiii

Copy link
Copy Markdown
Contributor Author

I can do that, but pretty sure I'll need to rerun it too. ;)

henryiii and others added 2 commits September 30, 2025 10:37
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: wyattscarpenter <wyattscarpenter@gmail.com>
@henryiii henryiii force-pushed the henryiii/chore/schema branch from 17cfe52 to 420b6c8 Compare September 30, 2025 14:39
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
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.

2 participants