### Set up local environment with just setup and devbox shell Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/spec-schema/CONTRIBUTING.md Run from the repository root to prepare the local environment. `setup` synchronizes the Python workspace and installs the locked pnpm workspace dependencies. The Devbox configuration pins uv, Python, Node.js, and pnpm. ```shell just setup devbox shell ``` -------------------------------- ### Set up the local environment Source: https://github.com/hex-inc/hex-sl-utils/blob/main/CONTRIBUTING.md Run to authorize the environment and install dependencies. Re-run direnv allow after .envrc changes, and just setup when dependency lockfiles change. ```bash direnv allow just setup ``` -------------------------------- ### Install project dependencies with uv Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/CONTRIBUTING.md Run this command after checking out the Apache Ossie repository to install the project dependencies. Requires Python 3.11 or newer, which can be installed through uv. ```bash uv sync ``` -------------------------------- ### Install ossie-preview converter suite on macOS/Linux Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/ossie-hex/README.md Installs the ossie-preview converter suite on macOS and Linux. Requires uv to be installed first. The command downloads and runs the install.sh script from the hex-sl-utils repository. ```sh curl -LsSf \ https://raw.githubusercontent.com/hex-inc/hex-sl-utils/main/scripts/ossie-hex/install.sh | sh ``` -------------------------------- ### Install hex-sl-utils with uv or pip Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/hex-sl-utils/README.md Install the package using either uv or pip. Python 3.9 or newer is required. ```bash uv add hex-sl-utils # or python -m pip install hex-sl-utils ``` -------------------------------- ### Workspace setup and Ossie converter commands Source: https://github.com/hex-inc/hex-sl-utils/blob/main/CONTRIBUTING.md Configuration and commands for managing a uv workspace: add a workspace source for hex-sl-utils, specify Python versions for smoke tests, update dependencies, and run converter recipes via Just. ```toml [tool.uv.sources] hex-sl-utils = { workspace = true } ``` ```toml [tool.smoke-test] python-versions = ["3.9", "3.14"] ``` ```bash uv lock --upgrade ``` ```bash just ossie check just ossie test just ossie snapshot-review just ossie test-python-matrix just ossie build build-inspect build-install ``` ```toml [tool.uv.sources] hex-sl-utils = { workspace = true } ``` ```toml [tool.smoke-test] python-versions = ["3.9", "3.14"] ``` ```bash uv lock --upgrade ``` ```bash just ossie check just ossie test just ossie snapshot-review just ossie test-python-matrix just ossie build build-inspect build-install ``` -------------------------------- ### Run the complete CI workflow Source: https://github.com/hex-inc/hex-sl-utils/blob/main/CONTRIBUTING.md Runs the complete local CI workflow after setup. ```bash just ci ``` -------------------------------- ### Build and verify schema artifacts with Just recipes Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/spec-schema/CONTRIBUTING.md Run from the repository root. `build:schema` builds the Python distributions, then runs generate_schema.py, which generates JSON Schema from the Pydantic Resource model, installs locked pnpm dependencies, runs the workspace build script, and validates generated TypeScript declarations for self-references. `verify:schema` runs check_generated_schema.py, regenerates artifacts, and fails if the result differs from committed files; CI runs this guard on every pull request. ```shell just build-schema ``` ```shell just verify-schema ``` -------------------------------- ### ossie-hex export example with snowflake dialect Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/README.md Example invocation of the export command using a specific input file, output directory, and the snowflake dialect. ```bash ossie-hex export -i ossie.yaml -o hex/ --dialect snowflake ``` -------------------------------- ### Uninstall converter suite Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/ossie-hex/README.md Uninstalls the complete converter suite using the installer script. Requires curl and sh. ```sh curl -LsSf \ https://raw.githubusercontent.com/hex-inc/hex-sl-utils/main/scripts/ossie-hex/install.sh | sh -s -- uninstall ``` -------------------------------- ### Get resource JSON schema with resource_json_schema Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/hex-sl-utils/README.md Read the generated JSON Schema artifact included in the distribution without relying on a checkout path. ```python from hex_sl_utils.schema import resource_json_schema schema = resource_json_schema() ``` -------------------------------- ### Build source distribution and wheel with just build Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/CONTRIBUTING.md Builds the source distribution(s) and wheel(s) from the project directory. Artifacts are written to the dist/ directory. ```bash just build ``` -------------------------------- ### Run the vendoring script Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/vendoring/README.md Builds the vendored library after updating the version constant. Run from the repository root. ```bash just build-vendoring ``` -------------------------------- ### Load project from file contents with load_project_files Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/hex-sl-utils/README.md Load project from in-memory file contents using the equivalent load_project_files entry point. ```python 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", ) ``` -------------------------------- ### Run local database tests with just commands Source: https://github.com/hex-inc/hex-sl-utils/blob/main/CONTRIBUTING.md Run local database integration tests from the repository root. Use the --dialect option to target a specific dialect like duckdb. Manual start/stop commands manage Docker Compose services, and the smoke command verifies database connectivity and query execution. ```bash # all dialects just test-database-local # specific dialect(s) just test-database-local --dialect duckdb # manually start/stop local services just database-local-up just database-local-down # smoke test database connection / query execution just database-local-smoke ``` -------------------------------- ### Inspect build artifacts with just build-inspect Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/CONTRIBUTING.md Inspects metadata and contents of built artifacts before publishing. Run after `just build` from the same directory. ```bash just build-inspect ``` -------------------------------- ### Verify schema artifacts with just verify-schema Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/spec-schema/README.md Run from the repository root to regenerate the artifacts and check that the checked-in copies are current. ```text just verify-schema ``` -------------------------------- ### Common Just commands Source: https://github.com/hex-inc/hex-sl-utils/blob/main/CONTRIBUTING.md Lists the common Just recipes for routine development tasks. Run from the repository root. Add a recipe when a command is useful across the workspace. ```bash just check # lint, format-check, and type-check just format # apply automatic formatting and fixes just test # run all tests just test-cov # run tests and write coverage reports just build # build every publishable package, artifact just smoke-test # test package distributions in isolation just verify # check generated artifacts are up to date just ci # run (almost) all of the above ``` -------------------------------- ### Scoped Devbox commands for hex-sl-utils Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/hex-sl-utils/CONTRIBUTING.md Run these commands from the repository root when working only on hex-sl-utils. They cover linting, formatting, type checking, testing, and building the package. ```bash uv run --locked ruff check packages/hex-sl-utils uv run --locked ruff format packages/hex-sl-utils uv run --locked pyright packages/hex-sl-utils uv run --locked --package hex-sl-utils pytest packages/hex-sl-utils/tests uv build --package hex-sl-utils --no-sources ``` -------------------------------- ### Load project from directory with load_project Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/hex-sl-utils/README.md Load all .yml and .yaml resources beneath a project directory. The returned object exposes problems and project models. ```python 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) ``` -------------------------------- ### Run cloud database tests with just commands Source: https://github.com/hex-inc/hex-sl-utils/blob/main/CONTRIBUTING.md Run credentialed cloud database tests for BigQuery, Redshift, or Snowflake. Missing credentials for a requested cloud dialect cause the test to fail. Configure credentials in your shell, CI secret store, or a gitignored .env file. ```bash # all dialects just test-database-cloud # specific dialect(s) just test-database-cloud --dialect bigquery ``` -------------------------------- ### Run verification commands with just Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/CONTRIBUTING.md Runs lint/format checks, applies automatic fixes, and executes the test suite. Use `just test tests/.py` to run a single file or `just test tests/.py::` to run a single test. ```bash # lint and formatting checks just check # apply automatic fixes for lint and formatting issues just format # run complete test suite just test # run a single file or test just test tests/.py just test tests/.py:: ``` -------------------------------- ### Reproduce CI tool version matrix locally with just test-matrix Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/CONTRIBUTING.md Runs the same tool version matrix used by the CI workflow locally. Use it to verify your changes against the full range of supported tool versions before pushing. ```bash just test-matrix ``` -------------------------------- ### Update snapshots with just snapshot-review and just snapshot-fix Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/CONTRIBUTING.md Use these commands to update test snapshots. `just snapshot-review` updates snapshots interactively and is only available for inline-snapshot; `just snapshot-fix` updates snapshots non-interactively. Snapshot differences fail `just test` by default. ```bash # Update snapshots interactively (only available for inline-snapshot) just snapshot-review # Update snapshots non-interactively just snapshot-fix ``` -------------------------------- ### ossie-hex export command with options Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/README.md Shows the general syntax for the 'ossie-hex export' command. The -i option is required, -o defaults to the current working directory, -d defaults to ANSI_SQL, and -v can be repeated for more verbose problem output. ```bash ossie-hex export -i -o \ [--dialect ] [-v] ``` -------------------------------- ### Python API convert_ossie_to_hex usage Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/README.md Shows how to call the convert_ossie_to_hex function from the ossie_hex module. The input parameter is required; output defaults to no files written, and dialect defaults to ANSI_SQL with fallback to the first available variant. Returns a tuple of hex_project and problems. ```python from ossie_hex import convert_ossie_to_hex hex_project, problems = convert_ossie_to_hex( input="ossie.yaml", output="hex/", dialect="snowflake", ) ``` -------------------------------- ### Create and push release tag for a package Source: https://github.com/hex-inc/hex-sl-utils/blob/main/CONTRIBUTING.md After merging the release pull request, create an annotated tag at the merge commit and push it. The tag must exactly match the distribution name and version, e.g., hex-sl-utils-v0.1.0. If multiple packages are released, create and push one tag per package. ```bash git tag -a hex-sl-utils-vX.Y.Z -m "hex-sl-utils X.Y.Z" git push origin hex-sl-utils-vX.Y.Z ``` -------------------------------- ### Run test commands for validation Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/ossie-hex/README.md Run the test suite and artifact smoke tests to validate changes. The commands are `just test-scripts`, `just test-workspace`, `just test-ossie`, and the artifact smoke tests. ```text just test-scripts ``` ```text just test-workspace ``` ```text just test-ossie ``` -------------------------------- ### Generate schema artifacts with just build-schema Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/spec-schema/README.md Run from the repository root to generate the JSON Schema and TypeScript declarations beneath packages/hex-sl-utils/src/hex_sl_utils/schema_files. ```text just build-schema ``` -------------------------------- ### Import Vendor to Ossie with ossie-preview Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/ossie-hex/README.md Commands to convert vendor models to Ossie YAML. Each vendor uses a different subcommand and input format; all output to model.ossie.yaml. Snowflake has no exporter yet. ```sh # Databricks Metric View → Ossie ossie-preview databricks import \ -i metric_view.yaml \ -o model.ossie.yaml # dbt # first, generate the semantic manifest. then ossie-preview dbt msi-to-ossie \ -i target/semantic_manifest.json \ -o model.ossie.yaml # Honeydew ossie-preview honeydew honeydew-to-ossie \ -i honeydew-workspace/ \ -o model.ossie.yaml # Nvidia GSF ossie-preview nvidia import \ -i model.gsf.yaml \ -o model.ossie.yaml # Omni ossie-preview omni import \ -i omni-model/ \ -o model.ossie.yaml # Orionbelt ossie-preview orionbelt obml-to-ossie \ -i model.obml.yaml \ -o model.ossie.yaml # Snowflake does not provide an exporter yet. # Wisdom ossie-preview wisdom wisdom-to-ossie \ -i domain-export.json \ -o model.ossie.yaml ``` -------------------------------- ### Regenerate timezone mapping with just build-timezones Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/timezones/README.md Run from the repository root to regenerate the IANA-to-Windows timezone mapping from the pinned Unicode CLDR source. Requires network access to the pinned CLDR source. ```bash just build-timezones ``` -------------------------------- ### Verify timezone mapping with just verify-timezones Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/timezones/README.md Run from the repository root to check that the committed mapping artifact matches the pinned Unicode CLDR source. Requires network access to the pinned CLDR source. ```bash just verify-timezones ``` -------------------------------- ### Update version constant in scripts/vendoring/vendor_.py Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/vendoring/README.md Set the _VERSION constant to the new version before running the vendoring script. The placeholder shows the exact format to change, e.g. "vX.Y.Z". ```python _VERSION = "vX.Y.Z" # Change this to the new version ``` -------------------------------- ### ossie-hex export Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/README.md Command-line command to convert one Ossie semantic model document into one Hex semantic project. ```APIDOC ## [CLI] ossie-hex export ### Description Convert one Ossie semantic model document into one Hex semantic project. ### Method CLI ### Endpoint ossie-hex export ### Parameters #### Options - `-i, --input ` — Required. Ossie YAML file to export. - `-o, --output ` — Optional. Directory where Hex YAML files are written. If omitted, the current working directory is used. - `-d, --dialect ` — Optional. Ossie dialect to pick from Ossie expressions. If omitted, `ANSI_SQL` is used. - `-v, --verbose` — Optional. Show a grouped problem summary. Repeat the flag (`-vv`) to show every occurrence with its conversion phase and cause path. ### Request Example ```bash ossie-hex export -i ossie.yaml -o hex/ --dialect snowflake ``` ### Response #### Success Response No structured response body. The command writes Hex YAML files to the output directory. #### Response Example No response body. ``` -------------------------------- ### Export Ossie to Hex with ossie-preview Source: https://github.com/hex-inc/hex-sl-utils/blob/main/scripts/ossie-hex/README.md Exports an Ossie YAML model to Hex output directory. Use after importing a vendor model. ```sh ossie-preview hex export \ -i model.ossie.yaml \ -o hex-output/ ``` -------------------------------- ### convert_ossie_to_hex Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/ossie-hex/README.md Python function to convert one Ossie semantic model document into one Hex semantic project. ```APIDOC ## [Python] convert_ossie_to_hex ### Description Convert one Ossie semantic model document into one Hex semantic project. ### Method Python function ### Endpoint convert_ossie_to_hex ### Parameters #### Arguments - `input` — Required. Ossie YAML file to export. - `output` — Optional. Directory where Hex YAML files are written. If omitted, no files are written. - `dialect` — Optional. Ossie dialect to pick from Ossie expressions. If omitted, `ANSI_SQL` is preferred, falling back to the first available variant. ### Request Example ```python from ossie_hex import convert_ossie_to_hex hex_project, problems = convert_ossie_to_hex( input="ossie.yaml", output="hex/", dialect="snowflake", ) ``` ### Response #### Success Response Returns a tuple of: - `hex_project`: A Hex semantic project, or `None` if conversion could not produce a project. - `problems`: A list of problems encountered. #### Response Example ```python (hex_project, problems) ``` ``` -------------------------------- ### Update inline snapshots with pytest --inline-snapshot=fix Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/hex-sl-utils/tests/calc/compiler/snapshot/expressions/README.md Run this command to update inline snapshots after modifying a calc case or compiler output. It uses devbox and uv with locked dependencies, runs only non-database tests, and applies the --inline-snapshot=fix flag. ```sh # update inline snapshots after changing a calc case or compiler output devbox run -- uv run --locked --all-packages pytest \ packages/hex-sl-utils/tests/calc/compiler/snapshot/expressions \ -m 'not database' \ --inline-snapshot=fix ``` -------------------------------- ### Validate a model with Model.model_validate Source: https://github.com/hex-inc/hex-sl-utils/blob/main/packages/hex-sl-utils/README.md Validate a model dictionary directly using the Pydantic model from hex_sl_utils.spec.types. ```python from hex_sl_utils.spec.types import Model model = Model.model_validate( { "id": "orders", "base_sql_table": "analytics.orders", } ) ```