Metadata-Version: 2.4
Name: keble-data-infra-contract
Version: 0.1.0
Summary: Framework-free raw commerce contracts shared by Keble data providers and the raw API.
Author-email: zhenhao-ma <bob0103779@gmail.com>
Requires-Python: <3.14,>=3.13
Requires-Dist: keble-helpers<2,>=1.50.0
Requires-Dist: pydantic<3,>=2.10
Description-Content-Type: text/markdown

# keble-data-infra-contract

Install the provider-neutral public contract with
`pip install "keble-data-infra-contract>=0.1.0,<1"`.

Framework-free, provider-neutral raw-commerce contracts. This distribution owns
validated request/response models, provider protocols, operation keys, manifests,
and typed domain errors. It intentionally has no FastAPI, database, HTTP client,
provider, platform, or idea dependency.

The distribution declares only registry-resolvable runtime dependencies. Do not
add workspace-relative `tool.uv.sources` here: downstream Git/subdirectory installs
must build this contract without inheriting paths outside the repository checkout.

Provider packages own implementations and native DTOs. The raw API consumes
provider manifests and constructs HTTP paths from their typed operation keys.

```bash
uv run --package keble-data-infra-contract pytest -q keble-data-infra-contract/tests
uv run --package keble-data-infra-contract npx --yes pyright keble-data-infra-contract
uv build --package keble-data-infra-contract
```

Contract values inherit `ContractModel`, which accepts snake-case Python names
and camel-case wire aliases, rejects undeclared fields, and is frozen. Persisted
Mongo shapes do not belong here; provider/API packages own `SchemaBase` /
`MongoObjectBase` aggregates when durability is required.
`ContractModel` and the deliberately producer-tolerant Job/Result projection
both configure Pydantic through `keble-helpers.PydanticModelConfig`; a local
`ConfigDict` convention would split alias and validation ownership again.

`Money`, `Currency`, and `AmazonMarketplace` are imported from
`keble-helpers`. Provider-native response details remain inside the provider
package instead of crossing this boundary through an untyped extension bag.

Video enrichment uses the same framework-free boundary: immutable asset,
submission, job, completion-event, result, and normalized-projection models plus
one `VideoEnrichmentGateway` Protocol. HTTP submission and Mongo correlation
remain implementations owned by `keble-data-infra-api`.

Authorized provider transcripts use one canonical `VideoTranscript`/
`VideoTranscriptSegment` shape across submission, authoritative result reads, and
the local projection. Reuse evidence binds the normalized transcript checksum to
the data-infra source reference and media SHA-256; a title/description such as
`ShortVideo.caption` is not a spoken transcript and cannot bypass ASR.
