Skip to main content

hex-sl-utils

Typed models and loaders for Hex semantic-layer resources.

This package is in its initial development phase and is not yet published. Its APIs may change until the first stable release.

Features

  • Pydantic models for semantic-layer projects, models, views, dimensions, measures, and relations.
  • Project loading from YAML files with structured validation problems.
  • Support for multiple SQL dialects.
  • Generated JSON Schema and TypeScript declarations.

Installation

Once the package is published, install it with:

uv add hex-sl-utils

# or
python -m pip install hex-sl-utils

Python 3.9 or newer is required.

Usage

Load all .yml and .yaml resources beneath a project directory:

from hex_sl_utils.spec.load import load_project

loaded = load_project(
    project_dir="path/to/project",
    project_name="My project",
    dialect_name="duckdb",
)

for problem in loaded.problems:
    print(problem.to_str())

for model in loaded.project.models:
    print(model.id)

Converters and other callers that already hold file contents in memory can use the equivalent load_project_files entry point:

from hex_sl_utils.spec.load import load_project_files

loaded = load_project_files(
    files={"orders.yml": "id: orders\nbase_sql_table: analytics.orders\n"},
    project_name="My project",
    dialect_name="duckdb",
)

Models are also available directly from hex_sl_utils.spec.types for validation and generation:

from hex_sl_utils.spec.types import Model

model = Model.model_validate(
    {
        "id": "orders",
        "base_sql_table": "analytics.orders",
    }
)

The generated schema artifacts are included in the distribution and can be read without relying on a checkout path:

from hex_sl_utils.schema import resource_json_schema

schema = resource_json_schema()

Repository development instructions are in the workspace CONTRIBUTING.md.

Licensed under the Apache License 2.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hex_sl_utils-0.2.0.tar.gz (619.1 kB view details)

Uploaded Source

Built Distribution

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

hex_sl_utils-0.2.0-py3-none-any.whl (728.6 kB view details)

Uploaded Python 3

File details

Details for the file hex_sl_utils-0.2.0.tar.gz.

File metadata

  • Download URL: hex_sl_utils-0.2.0.tar.gz
  • Upload date:
  • Size: 619.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hex_sl_utils-0.2.0.tar.gz
Algorithm Hash digest
SHA256 71f893043ee2712afd48380fa03b3bc1256f281151c21a9e06e7198a46f3b840
MD5 3422dd12807aa7073546ffb23bc56eb1
BLAKE2b-256 caf4d68e0ca33d0c9a3efa12cf22b01e6e6ea26374d110d5eb32294d73a69fd3

See more details on using hashes here.

File details

Details for the file hex_sl_utils-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: hex_sl_utils-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 728.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hex_sl_utils-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 918ac734f3a3bf092d56facb97258f919cab45dd1d728e4be81db0457c603a6a
MD5 28cad52dc06d5ba1ace9244c9cbdad0e
BLAKE2b-256 9a552299c14c3c41f5356bd0de37c37583e64fca47fde33f98d39559247ba2e1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page