Skip to main content

PyPI version shields.io PyPI pyversions Ruff Checked with mypy

Schemapack

Make your JSON Schemas sociable and create linked data models.

Description

Schemapack is a library that defines a lightweight data modeling framework based on a schema description, a compatible data instance format, and the tooling that supports them. It introduces two main components: the schemapack, which describes linked data structures, and the datapack, which represents the data conforming to those structures. The tooling around schemapack and datapack focuses on loading, extraction, and validation, and supports partial extraction and data embedding operations. The Schemapack library includes a CLI component that provides access to core functionality via the command line.

Installation

This package is available at PyPI: https://pypi.org/project/schemapack

Install:

bash

pip install schemapack

Upgrade:

pip install --upgrade schemapack

Usage

bash

schemapack --help


 Usage: schemapack [OPTIONS] COMMAND [ARGS]...

 Common arguments and options.

╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --version                     Show the version of the library and exit.                                                                   │
│ --install-completion          Install completion for the current shell.                                                                   │
│ --show-completion             Show completion for the current shell, to copy it or customize the installation.                            │
│ --help                        Show this message and exit.                                                                                 │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ validate              Validate a datapack against a schemapack.                                                                           │
│ check-schemapack      Check if the provided JSON/YAML document complies with the schemapack specs.                                        │
│ check-datapack        Check if the provided JSON/YAML document complies with the datapack specs.                                          │
│ condense-schemapack   Writes a version of the provided schemapack with embedded content schemas to                                        │
│                       stdout.                                                                                                             │
│ isolate-resource      Isolate a resource from the given datapack and write a datapack that is rooted to                                   │
│                       this resource to stdout.                                                                                            │
│ isolate-class         Isolate a class from the given schemapack and write a condensed (with content                                       │
│                       schemas being embedded) schemapack that is rooted to this class to stdout.                                          │
│ export-mermaid        Generate an entity relationship diagram based on the mermaid markup from the                                        │
│                       provided schemapack.                                                                                                │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Quick Start

This example shows how to validate a datapack.yaml file against a schemapack.yaml using the schemapack Python library. The schemapack defines the schema and validation rules, while the datapack contains the actual data to be validated. The steps below demonstrate how to load both files and run validation with SchemaPackValidator.

from pathlib import Path

from schemapack import SchemaPackValidator, load_datapack, load_schemapack

schemapack_path = Path("path/to/schemapack.yaml")
datapack_path = Path("path/to/datapack.yaml")

# load schemapack
schemapack = load_schemapack(schemapack_path)

# load datapack
datapack = load_datapack(datapack_path)

# validate datapack against schemapack
validator = SchemaPackValidator(schemapack=schemapack)
validator.validate(datapack=datapack)

Documentation

Development

This package is a member of the GHGA monorepo and is developed from the repository root rather than on its own. The repository ships a devcontainer with the whole toolchain: open it in VS Code and run Remote-Containers: Reopen in Container, or set the environment up directly with just sync.

The usual tasks, run from the repository root (see ADR-0034 for the full recipe list):

just sync                  # install every member plus the shared dev toolchain
just test libs/schemapack  # this member's test suite
just lint                  # ruff check + format check across the workspace

License

This repository is free to use and modify according to the Apache 2.0 License.

Metadata

Release files for schemapack 4.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for schemapack 4.4.2
File Size Uploaded Provenance Actions
schemapack-4.4.2.tar.gz 38.9 kB Without provenance Details for schemapack-4.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for schemapack 4.4.2
File Interpreter ABI Platform Actions
schemapack-4.4.2-py3-none-any.whl Python 3 none any Details for schemapack-4.4.2-py3-none-any.whl

Total release size: 113.4 kB

Release files / schemapack-4.4.2.tar.gz

Download URL schemapack-4.4.2.tar.gz
Size 38.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b81ce005d527773cf213e4e8debb331fb96317befba5dc441cdd1efa03ce48a5
BLAKE2b-256 checksum
How to use checksums
ccbd76937ce2cbb3503da8fcc5bd2b17b92cfdb32742740c43f2d928966772e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / schemapack-4.4.2-py3-none-any.whl

Download URL schemapack-4.4.2-py3-none-any.whl
Size 74.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bf06885396c0aac836329490bd28fbb4f4dcd9f9bb239479c76c3e83fdcd077
BLAKE2b-256 checksum
How to use checksums
9290e4f512e7b1a98662c3c2df6a947f864be75bc973cba3e15974683f5e9500
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for schemapack 4.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page