Skip to main content

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_seller CLI, catalog builders (populate_from_iterator, render_template_file, convert_convenience_fields_to_documents, etc.)
  • unitysvc — customer SDK + usvc CLI
  • unitysvc-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 (run scripts/generate_schemas.py; CI enforces sync)
├── 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_content live in unitysvc-sellers
  • Seller-catalog-layout validation — validate_provider_status, validate_all_service_directories, resolve_provider_name, resolve_service_name_for_listing live in unitysvc-sellers

Installation

pip install unitysvc-core

Dependencies: pydantic, email-validator, jsonschema, jinja2, 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

Required enrollment parameter usage

The shared validator rejects required user parameters that no channel, interface, or document consumes. File validation checks a listing against its paired offering when present; backend ingest calls the same validate_required_parameter_usage helper with the complete listing and offering. Schema declarations alone are not consumers. Jinja attribute access, string-key lookups, and params.get("name") are inspected; dynamic access and whole-map iteration conservatively consume all parameters. Deprecated content can still be retired.

This validates usage, not channel attribution: a document reference counts as a consumer without proving that the intended paid channel takes enrollment.

Metadata

Release files for unitysvc-core 0.2.34

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

Source distribution (sdist)

Source distribution for unitysvc-core 0.2.34
File Size Uploaded Provenance
unitysvc_core-0.2.34.tar.gz 141.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for unitysvc-core 0.2.34
File Interpreter ABI Platform
unitysvc_core-0.2.34-py3-none-any.whl Python 3 none any Details

Total release size: 254.8 kB

Release files / unitysvc_core-0.2.34.tar.gz

Download URL unitysvc_core-0.2.34.tar.gz
Size 141.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9f30bf708f04b727e899ad0a678d0c0514e9c66781f94977fd04beb9f889d137
BLAKE2b-256 checksum
How to use checksums
dadcaf68f539a68b29d01962432763c374b4273d123e61d25fb9389e9e26645a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 18, 2026.

Transparency log

Release files / unitysvc_core-0.2.34-py3-none-any.whl

Download URL unitysvc_core-0.2.34-py3-none-any.whl
Size 113.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c04ebc69a1d903ee30fe1b211d2b9688489b724793f55f7475dfab6317b2728
BLAKE2b-256 checksum
How to use checksums
3815ec2378a98848b7d79730014c229505e2a2fb55b7513aa2a8170d0c899864
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 18, 2026.

Transparency log

Security for unitysvc-core 0.2.34

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 unitysvc_core-0.2.34.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 Oct 18, 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.

Release history Release notifications | RSS feed

This release

0.2.34 This release

2 release files Full provenance

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