Skip to main content

Shared library for data interchange between Validibot and validator containers

Project description

validibot-shared

Shared Pydantic models for Validibot validator containers.

This library defines the data interchange types used between Validibot and its advanced validator services, ensuring type safety and contract consistency.

Installation

pip install validibot-shared

Or with uv:

uv add validibot-shared

Package Structure

validibot_shared/
├── validations/          # Base validation envelope schemas
│   └── envelopes.py     # Input/output envelopes for all validators
├── energyplus/          # EnergyPlus-specific models and envelopes
│   ├── models.py        # Simulation output models
│   └── envelopes.py     # Typed envelope subclasses
└── fmi/                 # FMI/FMU-specific models
    ├── models.py        # Probe result models
    └── envelopes.py     # FMI envelope subclasses

Core Concepts

Validation Envelopes

The library provides base envelope classes for validator communication:

  • ValidationInputEnvelope - Standard input format for validation jobs
  • ValidationOutputEnvelope - Standard output format with results
  • ValidationCallback - Callback payload for async job completion

Supporting classes include InputFileItem, ValidatorInfo, ExecutionContext, ValidationMessage, ValidationMetric, and ValidationArtifact.

Typed Subclassing Pattern

Domain-specific validators extend the base envelopes with typed fields:

from validibot_shared.energyplus import EnergyPlusInputEnvelope, EnergyPlusInputs

# The envelope has typed inputs instead of dict[str, Any]
envelope = EnergyPlusInputEnvelope(
    run_id="abc-123",
    inputs=EnergyPlusInputs(timestep_per_hour=4),
    # ... other fields
)

# IDE autocomplete and type checking work
timestep = envelope.inputs.timestep_per_hour

This provides:

  • Type safety - mypy/pyright catch errors at compile time
  • Runtime validation - Pydantic validates all data
  • IDE support - Full autocomplete for domain-specific fields

Usage Examples

Creating an Input Envelope

from validibot_shared.energyplus import EnergyPlusInputEnvelope, EnergyPlusInputs
from validibot_shared.validations.envelopes import (
    InputFileItem,
    ValidatorInfo,
    ExecutionContext,
)

envelope = EnergyPlusInputEnvelope(
    run_id="run-123",
    validator=ValidatorInfo(id="v1", type="energyplus", version="24.2.0"),
    input_files=[
        InputFileItem(
            name="model.idf",
            mime_type="application/vnd.energyplus.idf",
            role="primary-model",
            uri="gs://bucket/model.idf",
        ),
    ],
    inputs=EnergyPlusInputs(timestep_per_hour=4),
    context=ExecutionContext(
        callback_url="https://api.example.com/callback",
        execution_bundle_uri="gs://bucket/run-123/",
    ),
)

Deserializing Results

from validibot_shared.energyplus import EnergyPlusOutputEnvelope

# Parse JSON response from validator
envelope = EnergyPlusOutputEnvelope.model_validate_json(response_json)

# Access typed outputs
if envelope.outputs:
    print(f"EUI: {envelope.outputs.metrics.eui_kbtu_per_sqft}")

FMI Probe Results

from validibot_shared.fmi.models import FMIProbeResult, FMIVariableMeta

# Create a successful probe result
result = FMIProbeResult.success(
    variables=[
        FMIVariableMeta(name="temperature", causality="output", value_type="Real"),
    ],
    execution_seconds=0.5,
)

# Create a failure result
result = FMIProbeResult.failure(errors=["Invalid FMU: missing modelDescription.xml"])

Dependencies

  • pydantic>=2.8.0

License

MIT License - see LICENSE for details.

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

validibot_shared-0.1.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

validibot_shared-0.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file validibot_shared-0.1.0.tar.gz.

File metadata

  • Download URL: validibot_shared-0.1.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for validibot_shared-0.1.0.tar.gz
Algorithm Hash digest
SHA256 001989476823ed2d17d5428c846cfd181e714f8cdd6d84c969171ece2c073f13
MD5 0d95060d08982d07f057a38c02e492b4
BLAKE2b-256 0e2c03d6e5acea288c5353960d2b0d41d636424890ed47e3dd7625e5329dd7d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for validibot_shared-0.1.0.tar.gz:

Publisher: publish.yml on danielmcquillen/validibot-shared

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file validibot_shared-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for validibot_shared-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c847108ec4b7d719f4607a5c3d70d9fddf52782ba4d5cd431498907c776c1886
MD5 4aa716177cc499e3db0f1abb5842af3a
BLAKE2b-256 c1855d9cf205dba0799871b0423af91525bfb3cc01af647d32bb7c89ebb6d6e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for validibot_shared-0.1.0-py3-none-any.whl:

Publisher: publish.yml on danielmcquillen/validibot-shared

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page