Skip to main content

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)

Metadata

Release files for datacontract-specification 1.2.3

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

Source distribution (sdist)

Source distribution for datacontract-specification 1.2.3
File Size Uploaded
datacontract_specification-1.2.3.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for datacontract-specification 1.2.3
File Interpreter ABI Platform
datacontract_specification-1.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 31.4 kB

Release files / datacontract_specification-1.2.3.tar.gz

Download URL datacontract_specification-1.2.3.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5fc612255667581321b480e3f646c76ece618632a4aca4cd6ea5f647d98cbb61
BLAKE2b-256 checksum
How to use checksums
d3a53ee2bc8671b08e0c350091308386d2171bb03f8255647466ddcfab8717ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release files / datacontract_specification-1.2.3-py3-none-any.whl

Download URL datacontract_specification-1.2.3-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d5a998a33be33ca95a20e3681a693b4d720baf0b956ff8970f3e85a77d6f35a
BLAKE2b-256 checksum
How to use checksums
670eec63c117fbdb5ecfd6625e7527a267b85eaf26b4227e94a144509859a3dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.3 This release

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

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