Skip to main content

dagnam-contracts

The canonical component/parameter validation contract for Dagnam.AI — the generated component schema plus a dependency-free interpreter of it.

An architecture is validated in three places: the platform backend when a project is saved, the dagnam SDK before a job is submitted, and the Studio as nodes are dragged onto the canvas. All three must reach identical verdicts — a parameter the Studio accepts and the backend rejects is a bug the user experiences as the product lying to them. This package is the one definition they all read.

import dagnam_contracts as contracts

errors = contracts.validate_params(
    "convolution-layer", {"filters": -999}, node_id="conv_1"
)
for e in errors:
    print(e.message)
# convolution-layer: filters must be at least 1, got -999
# convolution-layer: missing required parameter 'kernelSize'

Zero dependencies, by design

This package installs nothing else. That is a constraint rather than a coincidence: the dagnam SDK ships with only requests and numpy, so a contract package it depends on must add nothing.

It is why the Pydantic registry that authors the schema stays out of the distribution — the wheel carries generated JSON and a plain-Python interpreter of it, and the typed authoring format lives in the repository instead.

Dataset hygiene and prompt rendering (Python-only)

Since 0.2.0 the Python package also ships the dataset-hygiene primitives the platform and the dagnam SDK share — so a redaction, a dedup pass or a contamination check reaches the same verdict wherever it runs — and the one function that renders a chat request as classifier input text, so the text a classifier saw in training is byte-for-byte the text it sees when served. Results are frozen dataclasses; everything is standard library only.

from dagnam_contracts import (
    apply_pii_policy, compute_exact_duplicates, compute_near_duplicates,
    compute_split_overlap, render_chat_prompt, scan_rows,
)

report = scan_rows(rows)                      # counts_by_code, issues, pass_list, disclaimer
rows, changed, removed = apply_pii_policy(rows, {"PII_EMAIL": "redact"})
compute_exact_duplicates(rows).duplicate_indices
compute_near_duplicates(rows, threshold=0.9).pairs
compute_split_overlap({"train": train_rows, "test": test_rows}).has_contamination
render_chat_prompt([{"role": "user", "content": "hi"}], system="Label it.")
# '<|system|>\nLabel it.\n<|user|>\nhi\n'

The PII scan is best-effort by contract: its result names the classes it looked for (pass_list) and carries a disclaimer, and nothing here ever reports data as "clean". These modules are Python-only; @dagnam/contracts (npm) carries the schema interpreter alone.

Versioning

dagnam-contracts and @dagnam/contracts (npm) are published together at the same version and carry a byte-identical schema, so a version number describes one contract across both ecosystems. Breaking schema changes take a major bump, and each consumer upgrades deliberately.

License

Apache-2.0. Source: https://github.com/Dagnam-AI/dag-contracts

Metadata

Release files for dagnam-contracts 0.2.0

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

Source distribution (sdist)

Source distribution for dagnam-contracts 0.2.0
File Size Uploaded Provenance
dagnam_contracts-0.2.0.tar.gz 64.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dagnam-contracts 0.2.0
File Interpreter ABI Platform
dagnam_contracts-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 94.2 kB

Release files / dagnam_contracts-0.2.0.tar.gz

Download URL dagnam_contracts-0.2.0.tar.gz
Size 64.4 kB
Tags Source
SHA-256 checksum
How to use checksums
99ea719404982905c926e0192a5e2a5848204539baca1e7c53ee179ec664c7fb
BLAKE2b-256 checksum
How to use checksums
36c52a7fe5d6583d00c2bb25ba9d6a5d6864570635d3409e177ece7d3ed38f2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 6, 2026.

Transparency log

Release files / dagnam_contracts-0.2.0-py3-none-any.whl

Download URL dagnam_contracts-0.2.0-py3-none-any.whl
Size 29.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06176eade7948e3924c54863d0076179ff50c9db7651c19c894173706b6c9d8d
BLAKE2b-256 checksum
How to use checksums
81bdf1b0174d71bd07e0b039efaae76a935bf96a1d5031162b1456e97c47d659
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 6, 2026.

Transparency log

Security for dagnam-contracts 0.2.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dagnam_contracts-0.2.0.tar.gz

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 6, 2026.

Transparency log

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.

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