Skip to main content

Velarium IR (ModelSpec): normalization, JSON codec, Python→IR extraction

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

velarium

PyPI version Python versions License: MIT

Role in Velarium: core ModelSpec IR — normalized types (TypeSpec, TypeKind, …), ModelSpec, JSON codec, union normalization, and builders that turn dataclasses, TypedDict, Pydantic BaseModel, and attrs classes into IR (see model-sources.md).

PyPI pypi.org/project/velarium
Repository github.com/eddiethedean/velarium
Python 3.10+
Import import velarium / from velarium.ir import ModelSpec, TypeSpec
Dependencies typing_extensions only; optional velarium[pydantic], velarium[attrs], or velarium[sources]

Downstream packages (e.g. velotype on PyPI) consume this IR to emit .pyi stubs and other artifacts. The IR contract is in docs/modelspec-ir.md; how Python annotations map to the IR is in docs/supported-annotations.md; stub consumer guarantees are summarized in docs/stub-compatibility.md; builders and optional extras are in docs/model-sources.md. Ecosystem context is in docs/valarium.md and docs/design.md.

Public API (high level)

Area Modules / entry points
IR types velarium.irModelSpec, TypeSpec, TypeKind, …
JSON velarium.json_codecdumps_model_spec, loads_model_spec, dict helpers; optional VELARIUM_JSON_MAX_DEPTH / VELARIUM_JSON_MAX_BYTES (see security.md)
Normalization velarium.normalizenormalize_typespec, unions, optional handling; optional VELARIUM_NORMALIZE_BACKEND=native (falls back to Python; see performance.md)
Annotations velarium.annotationstype_to_typespec, annotation_to_typespec
Builders velarium.modelspec_buildmodelspec_from_dataclass, modelspec_from_typed_dict, typespec_from_object; velarium.modelspec_pydantic / modelspec_from_pydantic_model (extra); velarium.modelspec_attrs / modelspec_from_attrs_class (extra)
Resolution velarium.typing_resolveget_resolved_hints, module_globals_for_class, evaluate_forward_ref (used by builders; re-export not required for typical use)

Install

pip install velarium
# Optional: Pydantic v2 / attrs builders
pip install velarium[pydantic]   # or velarium[attrs] / velarium[sources]

From the monorepo root (with uv):

uv sync --group dev

Version

__version__ lives in velarium/__init__.py (Hatch reads it from that package’s pyproject.toml).

See also

License

MIT — see LICENSE.

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

velarium-0.7.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

velarium-0.7.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file velarium-0.7.0.tar.gz.

File metadata

  • Download URL: velarium-0.7.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for velarium-0.7.0.tar.gz
Algorithm Hash digest
SHA256 892ccb89372a7babf4ccad2af68c0683234d4f8f69d49d09673ad8f34d591989
MD5 b775a1dbe5744c2cc6e3acba0fea347d
BLAKE2b-256 839b20de2becd665844720741ad30a717461c9c27a0398d03bff4366f090f2fa

See more details on using hashes here.

File details

Details for the file velarium-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: velarium-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for velarium-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e53a9501de77738af59da877bfc6b3a0c3ead6978c6803fbbab1434193e2bdd8
MD5 8b6d7ac93b1ede4f42edb0a0b8dc0780
BLAKE2b-256 9e745dafcb9d93d7333bd21f7a7586126a65fd6b7b20fff1fb03af9b03987f9d

See more details on using hashes here.

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