Truthlocks DVC integration
Build structured, hash-addressed evidence from DVC metadata for your application's audit workflow.
Package: dvc-maip · Python: 3.9+ · License: Apache-2.0
Developer documentation · Console
Install
python -m pip install dvc-maip
Use a virtual environment and lock compatible framework versions with your application. The local example below needs no hosted credentials and makes no external requests.
Quickstart: create local evidence
from dvc_maip import MAIPConfig, generate_pipeline_receipt, hash_receipt_payload
stage = {"cmd": "python train.py", "deps": [], "outs": [],
"params": [{"params.yaml": {"learning_rate": 0.01}}]}
receipt = generate_pipeline_receipt("train", stage, config=MAIPConfig(auto_receipt=False))
assert receipt.payload_hash == hash_receipt_payload(receipt)
print(receipt.model_dump_json(indent=2))
Connect real data
Pass the parsed lock data for one stage, not the entire dvc.lock document. The example constructs metadata without running DVC or training a model.
Available interfaces
generate_pipeline_receipt records a stage; generate_data_receipt records a supplied file path, MD5, size and push/pull/checkout operation. Hook and CLI modules require separate integration; installing this library alone does not instrument every DVC command.
Configuration
| Setting | Meaning |
|---|---|
auto_receipt=False |
Disable automatic hosted submission in integration hooks. |
agent_id |
Registered agent in the authenticated workspace, used for signing. |
tenant_id |
Workspace metadata; does not authorize API access. |
api_key, api_url |
Hosted transport configuration, separate from framework credentials. |
timeout |
HTTP timeout in seconds; default 30. |
verify_ssl |
TLS verification; keep enabled. |
Evidence and delivery guarantees
The local result is a Pydantic model with a payload_hash. Save it using
model_dump_json() and retain the metadata needed to reproduce it. Recomputing the
hash checks consistency of that local representation; it does not validate a server
signature, establish a trusted identity, or confirm transparency-log inclusion.
DVC content hashes are copied from your input. This does not independently verify that a remote transfer occurred.
Submit and verify hosted evidence (1.1.0+)
Register a machine identity in your workspace before submission. Set MAIP_AGENT_ID
to its identifier and MAIP_API_KEY to a workspace API key with access to machine
identities and receipts. Provider keys are separate. A tl_test_ key selects the
sandbox host unless MAIP_API_URL overrides it; production defaults to
https://api.truthlocks.com/v1. Do not use a tenant header as authentication.
This example submits the local receipt created above only when credentials are set:
import asyncio
import os
from maip_ai_connectors.client import MAIPClient
from maip_ai_connectors.config import MAIPConfig
async def submit_and_verify(local_receipt):
config = MAIPConfig(agent_id=os.environ["MAIP_AGENT_ID"],
api_key=os.environ["MAIP_API_KEY"])
async with MAIPClient(config) as client:
stored = await client.create_receipt(local_receipt)
check = await client.verify_receipt(stored.receipt_id)
if not check.valid or not check.signature_verified:
raise RuntimeError(check.reason or check.verdict)
print(stored.receipt_id, check.verdict)
if os.environ.get("MAIP_API_KEY") and os.environ.get("MAIP_AGENT_ID"):
asyncio.run(submit_and_verify(receipt))
The server stores integration metadata in a signed MAIP action receipt. Its
receipt_id differs from the local payload_hash. Verification checks the signature
and current lifecycle state; it does not establish transparency-log inclusion.
Old receipts whose signing key was lost return UNVERIFIABLE.
For automatic hooks, enable auto_receipt=True. In synchronous code delivery is
confirmed before the hook returns. In asynchronous code, call await wrapper.flush()
and await wrapper.aclose() before shutdown; inspect get_submitted_receipts() for
server responses. These lifecycle methods apply to AI wrappers/callbacks; data
clients use their async context manager or create_receipt_sync() instead.
Read retries are bounded; writes are never automatically replayed. After a timeout,
check the agent's receipts before retrying. Listing returns up to the latest 100
receipts for one agent, with integration filters applied to that page.
Troubleshooting
| Problem | Next step |
|---|---|
| Missing optional dependency | Install the framework/provider extra in the interpreter running your app. |
| Validation error | Supply the documented fields and types; do not substitute a whole response for one metadata object. |
| Hash changes | Compare serialized fields, including timestamps and identifiers. |
| Nothing appears in Console | Local builders do not submit records; configure a registered agent and await confirmed delivery. |
For support, share package and Python versions plus a sanitized example. Do not include keys, customer data or full authentication headers. No automatic compliance certification or fixed processing-latency guarantee is implied.
Metadata
Release files for dvc-maip 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dvc_maip-1.1.0.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dvc_maip-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.3 kB
Release files / dvc_maip-1.1.0.tar.gz
| Download URL | dvc_maip-1.1.0.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60a6662e756359098620ed5b90a52379f3901fd20252d6aca3010c165b7edcde
|
|
BLAKE2b-256 checksum How to use checksums |
34d25ce2c975b1f3fb888a7ab7805e3d06b691d491ccc5a843cb281e14b8fb92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / dvc_maip-1.1.0-py3-none-any.whl
| Download URL | dvc_maip-1.1.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6ba9918c3e562ef932607e7f0d04cd35b1551f16179ec333af745319b587ef1
|
|
BLAKE2b-256 checksum How to use checksums |
f6fe1cf01d06c0147068e667b2441042c3ce24c2e17941dcfe0a22316ef9e053
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|