A Python package providing Pydantic models for the Boutiques descriptor standard, with automatic JSON Schema generation for VS Code and other integrations.
This package provides:
- Fully typed Pydantic models representing the Boutiques descriptor specification
- Automatic JSON Schema generation published to GitHub Pages
- Validation and serialization utilities for Boutiques descriptors
- VS Code integration for real-time validation and autocompletion
pip install boutiques-schema-pydanticfrom boutiques_schema_pydantic.v_0_5 import Descriptor
# Create a descriptor from scratch
descriptor = Descriptor(
name="my-tool",
tool_version="0.1.0",
description="My amazing tool",
command_line="command [INPUT] [OUTPUT]",
inputs=[...],
output_files=[...],
# other required fields
)
# Validate and export to JSON
descriptor_json = descriptor.model_dump_json(indent=2)
with open("descriptor.json", "w") as f:
f.write(descriptor_json)
# Load and validate an existing descriptor
with open("existing_descriptor.json", "r") as f:
loaded_descriptor = Descriptor.model_validate_json(f.read())This repository automatically publishes JSON Schema files to GitHub Pages, allowing for real-time validation and autocompletion in VS Code.
To use this in VS Code:
- Add the following to your VS Code
settings.json:
{
"json.schemas": [
{
"fileMatch": ["descriptors/**/*.json"],
"url": "https://styx-api.github.io/boutiques-schema-pydantic/boutiques-0.5.json"
}
]
}- Now when editing any file matching the patterns above, you'll get:
- Real-time validation
- Property autocompletion
- Documentation on hover
- IntelliSense suggestions
boutiques-schema-generator --helpGenerate all schemas:
boutiques-schema-generator-allThis will create updated schema files in the public/ directory.
pytestThis project is licensed under the MIT License - see the LICENSE file for details.