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.1.0.tar.gz (475.7 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.1.0-py3-none-any.whl (541.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hex_sl_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 475.7 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.1.0.tar.gz
Algorithm Hash digest
SHA256 a56afc01fe8372db487c694ea24f686f3f86cb3afd32dbb78b32e3767961e0c9
MD5 d4c87476c9558a3a134e4ffe876c3309
BLAKE2b-256 d8b0938348069d4c6abbae8f40ed5d50bfcfb3106736a41fe7adc4f81c1bbcf0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hex_sl_utils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 541.7 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49291dbee5deb5ee2b3996873dfa133a25cf56e9db4db945843e8a5e1d394cc4
MD5 9d62ea7375a0e377a1827a1799869684
BLAKE2b-256 73ea5f970d720998ebf09147b0f75e3e196efaf90c1197745eb217ccd5684180

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

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