Skip to content

Parametrized models

Maturity labels

  • Now: Stable and supported in current releases.
  • Preview: Usable today, but behavior and APIs may evolve.
  • Planned: Not yet implemented.

Note

Status: Now

Common pattern: Dataset[Model[T]]

>>> from omnipy import Dataset, Model
>>> ds = Dataset[Model[int]]({'a': '1', 'b': 2.0})
>>> ds.json()

Reuse shape, vary inner type

>>> import omnipy as om
>>> om.Model[list[str]]([1, '2', 3])

Current limitations

  • Deeply nested generics can be hard to debug from traceback alone.
  • Prefer introducing named subclasses at major boundaries.