Skip to content

ty.toml — Type Checker Configuration

Purpose

ty.toml configures the ty static type checker for the commodity_hindcast package. All four rules are set to "warn" (rather than "error") to suppress false positives that arise from pydantic-settings patterns used throughout the package.

Top-level fields

Field Value Meaning
rules.unknown-argument "warn" Suppresses errors for **kwargs in pydantic-settings __init__; runtime accepts _cli_parse_args and similar injected arguments
rules.unresolved-import "warn" Suppresses errors for optional dependencies (primarily torch) that are not always installed in every environment
rules.unsupported-operator "warn" Suppresses errors for Path \| None / str \| None union operators used pervasively in config fields; pydantic model validators guarantee non-None at runtime
rules.invalid-assignment "warn" Suppresses errors for Path = None default assignments; valid when pydantic model_validator reconstructs the field

Context

All rules are downgraded to warnings rather than errors. This is a deliberate trade-off: the package relies on pydantic-settings patterns (dynamic **kwargs, Path | None fields with None defaults that are resolved by validators) that ty cannot prove correct statically. Setting these to "warn" preserves visibility in CI output without failing type-check runs on known-good code.

The unresolved-import warning for torch reflects the optional deep-learning dependency path in the regression module — torch is not listed in the core package requirements.

Cross-references