The Pydantic Model of the Data Contract Specification
Project description
Data Contract Specification (Python)
The pip module datacontract-specification to read and write YAML files using the Data Contract Specification. The pip module was extracted from the Data Contract CLI, which is its primary user.
The version number of the pip module corresponds to the version of the Data Contract Specification it supports.
Version Mapping
| Data Contract Specification Version | Pip Module Version |
|---|---|
| 1.2.0 | >=1.2.0 |
| 1.1.0 | >=1.1.0 |
Note: We mirror major and minor version from the Data Contract Specification to the pip module, but not the patch version!
Installation
pip install datacontract-specification
Usage
from datacontract_specification.model import DataContractSpecification
# Load a data contract specification from a file
data_contract = DataContractSpecification.from_file('path/to/your/data_contract.yaml')
# Print the data contract specification as a YAML string
print(data_contract.to_yaml())
from datacontract_specification.model import DataContractSpecification
# Load a data contract specification from a string
data_contract_str = """
dataContractSpecification: 1.2.0
id: urn:datacontract:checkout:orders-latest
info:
title: Orders Latest
version: 2.0.0
description: |
Successful customer orders in the webshop.
All orders since 2020-01-01.
Orders with their line items are in their current state (no history included).
owner: Checkout Team
status: active
contact:
name: John Doe (Data Product Owner)
url: https://teams.microsoft.com/l/channel/example/checkout
"""
data_contract = DataContractSpecification.from_string(data_contract_str)
# Print the data contract specification as a YAML string
print(data_contract.to_yaml())
Development
uv sync --all-extras
Release
- Change version number in
pyproject.toml - Run
./releasein your command line - Wait for the releases on GitHub, PyPi and PyPi (test)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datacontract_specification-1.2.2.tar.gz.
File metadata
- Download URL: datacontract_specification-1.2.2.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b64c7df37f195df210107b9f46083634ac9767fef0ac453718ea7070ed9aa724
|
|
| MD5 |
6c7a20c6871c91e4a7e1eefb09fb67e9
|
|
| BLAKE2b-256 |
991990399b587a4d7328295ef4a2b10f4dc2800d8bcf04324a3ff1721aaab4b0
|
Provenance
The following attestation bundles were made for datacontract_specification-1.2.2.tar.gz:
Publisher:
release.yaml on datacontract/datacontract-specification-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datacontract_specification-1.2.2.tar.gz -
Subject digest:
b64c7df37f195df210107b9f46083634ac9767fef0ac453718ea7070ed9aa724 - Sigstore transparency entry: 560003470
- Sigstore integration time:
-
Permalink:
datacontract/datacontract-specification-python@b0b8089bd4ba3b8db58ccdbd31bd197a22df7b78 -
Branch / Tag:
refs/tags/v1.2.2 - Owner: https://github.com/datacontract
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@b0b8089bd4ba3b8db58ccdbd31bd197a22df7b78 -
Trigger Event:
push
-
Statement type:
File details
Details for the file datacontract_specification-1.2.2-py3-none-any.whl.
File metadata
- Download URL: datacontract_specification-1.2.2-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4be11e39da0f25b012871450b8190dcfb374372005d6cadc1b53fd7d8671511d
|
|
| MD5 |
3c67d58584a02d9cb41585972bc50ffc
|
|
| BLAKE2b-256 |
8bc4cd4344da7c89454c56ba6ddac3842c2524a75a599a965245a8089e2ce172
|
Provenance
The following attestation bundles were made for datacontract_specification-1.2.2-py3-none-any.whl:
Publisher:
release.yaml on datacontract/datacontract-specification-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datacontract_specification-1.2.2-py3-none-any.whl -
Subject digest:
4be11e39da0f25b012871450b8190dcfb374372005d6cadc1b53fd7d8671511d - Sigstore transparency entry: 560003510
- Sigstore integration time:
-
Permalink:
datacontract/datacontract-specification-python@b0b8089bd4ba3b8db58ccdbd31bd197a22df7b78 -
Branch / Tag:
refs/tags/v1.2.2 - Owner: https://github.com/datacontract
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@b0b8089bd4ba3b8db58ccdbd31bd197a22df7b78 -
Trigger Event:
push
-
Statement type: