Shared data models and validation helpers for UnitySVC packages
Project description
unitysvc-core
Shared data models, JSON schemas, and validation helpers for the UnitySVC ecosystem. This package is audience-neutral: it contains only the foundational types and helpers that are consumed by the UnitySVC backend, the customer SDK, the admin CLI, and the seller SDK.
It intentionally does not include any CLI, HTTP client, or audience-specific helpers. Those live in the corresponding packages:
unitysvc-sellers— seller SDK +usvc_sellerCLI, catalog builders (populate_from_iterator,render_template_file,convert_convenience_fields_to_documents, etc.)unitysvc— customer SDK +usvcCLIunitysvc-admin— admin CLI
What's inside
src/unitysvc_core/
├── models/
│ ├── base.py # All enums (status, type, currency, rate-limit, etc.)
│ ├── pricing.py # PriceStr, UsageData, all *PriceData classes,
│ │ # Pricing union, validate_pricing, cost calculation
│ ├── documents.py # DocumentData
│ ├── service.py # RateLimit, ServiceConstraints, AccessInterfaceData,
│ │ # UpstreamAccessConfigData
│ ├── validators.py # validate_name, validate_service_options,
│ │ # suggest_valid_name, SUPPORTED_SERVICE_OPTIONS
│ ├── provider_v1.py # Provider file schema + ProviderData
│ ├── offering_v1.py # Offering file schema + ServiceOfferingData
│ ├── listing_v1.py # Listing file schema + ServiceListingData
│ ├── promotion_v1.py # Promotion file schema + PromotionData
│ └── service_group_v1.py
├── schema/ # Generated JSON schemas
├── validator.py # DataValidator — per-file schema validation,
│ # union-field reference checks, API-key secret
│ # scanning, Jinja2 syntax validation, etc.
└── utils.py # Content hashing, mime/extension helpers,
# data file loaders (JSON/TOML + overrides),
# schema-based file discovery
What's deliberately NOT here
- CLI code —
typer,rich, no entry points - HTTP clients — no
httpx, no API wrappers - Seller catalog builders —
populate_from_iterator,render_template_file,convert_convenience_fields_to_documents,execute_script_contentlive inunitysvc-sellers - Seller-catalog-layout validation —
validate_provider_status,validate_all_service_directories,resolve_provider_name,resolve_service_name_for_listinglive inunitysvc-sellers
Installation
pip install unitysvc-core
Dependencies: pydantic, email-validator, jsonschema, jinja2,
json5, tomli-w. No typer, no rich, no httpx.
Usage
from pathlib import Path
import unitysvc_core
from unitysvc_core.models import ProviderV1, OfferingV1, ListingV1
from unitysvc_core.models.pricing import UsageData, validate_pricing
from unitysvc_core.validator import DataValidator
# Validate a single catalog directory
validator = DataValidator(
data_dir=Path("./catalog"),
schema_dir=Path(unitysvc_core.__file__).parent / "schema",
)
results = validator.validate_all()
# Typed pricing + cost calculation
pricing = validate_pricing({
"type": "one_million_tokens",
"input": "0.50",
"output": "1.50",
})
cost = pricing.calculate_cost(UsageData(input_tokens=1_000, output_tokens=500))
History
This package was split out of unitysvc-services (see
unitysvc/unitysvc-services#99).
The seller CLI, catalog builders, and seller-catalog-layout validators
moved to unitysvc-sellers.
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unitysvc_core-0.1.4.tar.gz.
File metadata
- Download URL: unitysvc_core-0.1.4.tar.gz
- Upload date:
- Size: 83.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8960a61f7a3224bf3dae7836314dc2aa73a76f534f247a62b694c28a2e46d875
|
|
| MD5 |
603a93d5020d1ab4f9ac3684990c3fa1
|
|
| BLAKE2b-256 |
49c3e9956a7465e22afc593d76de68b00d5d6640cf8def2010a150c856b009ee
|
Provenance
The following attestation bundles were made for unitysvc_core-0.1.4.tar.gz:
Publisher:
publish.yml on unitysvc/unitysvc-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unitysvc_core-0.1.4.tar.gz -
Subject digest:
8960a61f7a3224bf3dae7836314dc2aa73a76f534f247a62b694c28a2e46d875 - Sigstore transparency entry: 1357253251
- Sigstore integration time:
-
Permalink:
unitysvc/unitysvc-core@ca204298c8e3c740fc231d5e547c2c8f572dba9b -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/unitysvc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca204298c8e3c740fc231d5e547c2c8f572dba9b -
Trigger Event:
release
-
Statement type:
File details
Details for the file unitysvc_core-0.1.4-py3-none-any.whl.
File metadata
- Download URL: unitysvc_core-0.1.4-py3-none-any.whl
- Upload date:
- Size: 81.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ff2d5a75c9f3580fbd0f7486086875ceb92c8e2df01a4d76399fb3e68b44edc
|
|
| MD5 |
188715494fe43895384d29c633ed6087
|
|
| BLAKE2b-256 |
e90d06e9d699421644b10e37276df88d21838434bcb49f51c960766b32f08528
|
Provenance
The following attestation bundles were made for unitysvc_core-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on unitysvc/unitysvc-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unitysvc_core-0.1.4-py3-none-any.whl -
Subject digest:
9ff2d5a75c9f3580fbd0f7486086875ceb92c8e2df01a4d76399fb3e68b44edc - Sigstore transparency entry: 1357253256
- Sigstore integration time:
-
Permalink:
unitysvc/unitysvc-core@ca204298c8e3c740fc231d5e547c2c8f572dba9b -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/unitysvc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca204298c8e3c740fc231d5e547c2c8f572dba9b -
Trigger Event:
release
-
Statement type: