Skip to content
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

Add JSON schema generation #2005

Merged
merged 4 commits into from
Mar 25, 2024
Merged

Add JSON schema generation #2005

merged 4 commits into from
Mar 25, 2024

Conversation

JonathanPlasse
Copy link
Contributor

@JonathanPlasse JonathanPlasse commented Mar 23, 2024

This PR implements the Maturin JSON schema for the section tool.maturin in pyproject.toml files.

To run the generation, you can use the following command:

cargo run --features schemars generate-json-schema

I use Ruff generate_json_schema.rs as a base to implement the JSON schema generation.

Remaining tasks:

  • Integrate the generation better
  • Check in CI if the Maturin schema is up to date

Copy link

netlify bot commented Mar 23, 2024

Deploy Preview for maturin-guide ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9593513
🔍 Latest deploy log https://app.netlify.com/sites/maturin-guide/deploys/65febef4bb16200008b55141
😎 Deploy Preview https://deploy-preview-2005--maturin-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Mar 23, 2024

Deploy Preview for maturin-guide ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9b4d0f9
🔍 Latest deploy log https://app.netlify.com/sites/maturin-guide/deploys/66005738977dd300087960aa
😎 Deploy Preview https://deploy-preview-2005--maturin-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@messense
Copy link
Member

messense commented Mar 23, 2024

Thanks, IMO it's better to be placed in a separated crate that depends on maturin instead, we don't want two bin targets in maturin crate.

@konstin
Copy link
Member

konstin commented Mar 23, 2024

Can we make this a subcommand instead of a separate crate? I'd avoid splitting out into a new crate over helper functionality

@messense
Copy link
Member

Can we make this a subcommand instead of a separate crate? I'd avoid splitting out into a new crate over helper functionality

I am also fine with a subcommand.

@konstin
Copy link
Member

konstin commented Mar 23, 2024

@konstin
Copy link
Member

konstin commented Mar 23, 2024

With switched to a (hidden?) subcommand and CI passing i'm r+ on the code.

@JonathanPlasse
Copy link
Contributor Author

I switched to the JSON generation to a hidden sub-command.
I would like to merge this and leave the update script for a following PR.

Copy link
Member

@messense messense left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@messense
Copy link
Member

leave the update script for a following PR.

It seems that the schema generation currently does not put a newline in the end, which triggers the pre-commit autofixes. We should get this fixed when adding schema checks in CI.

@messense messense merged commit f9d6616 into PyO3:main Mar 25, 2024
28 of 29 checks passed
@JonathanPlasse JonathanPlasse deleted the json-schema-generation branch March 25, 2024 05:31
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Jun 6, 2024
https://build.opensuse.org/request/show/1178629
by user mia + anag+factory
- Update to 1.6.0
  * Add pypi name validation
    gh#PyO3/maturin#2007
  * Add JSON schema generation
    gh#PyO3/maturin#2005
  * Detect compiling from Linux gnu to Linux musl as cross compiling
    gh#PyO3/maturin#2010
  * Upgrade uniffi to 0.27.0
    gh#PyO3/maturin#2021
  * Add instrumentation support for develop
    gh#PyO3/maturin#2019
  * Make tracing-subscriber mandatory
    gh#PyO3/maturin#2022
  * Import hook upgrade
    gh#PyO3/maturin#2024
  * Add uv as develop backend command
    gh#PyO3/maturin#2015
  * Also try uv in PATH in develop --uv
    gh#PyO3/maturin#2026
  * docs: update pyo3 to match tutorial
    gh#PyO3/maturin#2029
  * Add support for AIX
    gh#PyO3/maturin#2030
  * Remove rust-cpython from project init/new template
    gh#PyO3/maturin#2034
  * Only run uv tests
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.

Add JSON schema generation for pyproject.toml with schemars for SchemaStore
3 participants