Skip to main content

Velarium IR to .pyi stub generation (velotype backend)

This project has been archived.

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

Project description

velotype

Role in Velarium: IR → .pyi — render Velarium (ModelSpec) IR as minimal stub text, and expose the velotype CLI for quick IR export and stub generation from live classes.

PyPI velotype
Depends on velarium (required)
CLI velotype ir, velotype stub (also python -m velotype)

The IR types and builders live in velarium. velotype re-exports the same public IR symbols and builder entry points as velarium (including modelspec_from_pydantic_model and modelspec_from_attrs_class when extras are installed); prefer from velarium import … in new code when you only need IR. See docs/model-sources.md for optional dependencies.

Stub output: generate_pyi / render_typespec aim for valid, checker-friendly .pyi text. Advanced TypeKind values (protocol, nominal, paramspec, typevartuple, and bare typevar in fields) are rendered as typing.Any in stubs so generated files do not invent TypeVar/ParamSpec declarations; the JSON IR still carries name / qualname / module for tooling. See docs/supported-annotations.md § Stub generation.

Install

pip install velotype

From the monorepo root:

uv sync --group dev
# or
pip install -e packages/velarium -e "packages/velotype[dev]"

CLI

velotype ir myapp.models:User
velotype ir myapp.models:User -o user.ir.json
velotype stub myapp.models:User -o user.pyi

Library

from velarium import modelspec_from_dataclass, dumps_model_spec
from velotype import generate_pyi

spec = modelspec_from_dataclass(MyModel)
print(generate_pyi(spec))

Version

__version__ is in velotype/__init__.py (Hatch dynamic metadata in this package’s pyproject.toml).

See also

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

velotype-0.3.0.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

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

velotype-0.3.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file velotype-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for velotype-0.3.0.tar.gz
Algorithm Hash digest
SHA256 76c3352f765ab55893b6397fc916da7b06bd89b72e1b20deec9e779045416b1e
MD5 adafee27f907d84cb15712f562b0c88e
BLAKE2b-256 71ee94ef0b559628dc9d398e976daae8e26a93c3aa1571c783da188b9c91a95a

See more details on using hashes here.

File details

Details for the file velotype-0.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for velotype-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 988de59d126dc81333c1e4648cb494184bc812ab028aa18ae58566296e5c0d5e
MD5 1ba84a288c082374c497ac9f5335e61b
BLAKE2b-256 99926c6dffc3aff46f3af231e49eb84a3f33ddd5c3a38450f82aee714969da39

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