Skip to main content

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 ./release in your command line
  • Wait for the releases on GitHub, PyPi and PyPi (test)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datacontract_specification-1.2.1.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datacontract_specification-1.2.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file datacontract_specification-1.2.1.tar.gz.

File metadata

File hashes

Hashes for datacontract_specification-1.2.1.tar.gz
Algorithm Hash digest
SHA256 2154569e71550db0c07f944c178324c291736d3efd10b16ae4d7cf94e7de3aa8
MD5 91dd532df752d587bdc73981aea381fb
BLAKE2b-256 711b100c8fed66ffb797d6746e7c5f15b1c74a103625f49c1e440c4f2f5cd7e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for datacontract_specification-1.2.1.tar.gz:

Publisher: release.yaml on datacontract/datacontract-specification-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datacontract_specification-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for datacontract_specification-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2b4a80a604f3029efdf1ce51c3b204b8d36d8fefce2d13c3087250c6f4f1dc2
MD5 40973ad1b62a4cb10b45a872ce631a62
BLAKE2b-256 cfec03c1ec8480ea3c53e9f92d5f82bfa3875f071be6c7813cb11b0e2ac8b0c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for datacontract_specification-1.2.1-py3-none-any.whl:

Publisher: release.yaml on datacontract/datacontract-specification-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page