rawctx CLI scaffold
Project description
rawctx CLI
Python CLI and SDK for rawctx Hub.
Guides:
../docs/guides/package-workflow.md../docs/guides/metricflow-native-workflow.md
Commands
User:
rawctx login [--registry URL] [--id-token JWT] [--token-name NAME] [--expires-in-days N] [--no-browser] [--json]rawctx logout [--local-only] [--json]rawctx search [QUERY] [--format F] [--source-format F] [--origin all|native|indexed] [--domain D] [--source S] [--tags CSV] [--sort recent|name] [--page N] [--size N] [--json] [--offline] [--registry URL]rawctx info PACKAGE_REF [--json] [--offline] [--registry URL]rawctx download PACKAGE_REF MODEL_PATH [--local-dir DIR] [--stdout] [--offline] [--force] [--json] [--registry URL]rawctx snapshot-download PACKAGE_REF [--local-dir DIR] [--offline] [--force] [--json] [--registry URL]rawctx validate [TARGET] [--format auto|manifest|osi] [--show-dataset-measures] [--json]rawctx pack [TARGET_DIR] [--output-dir DIR] [--json]rawctx convert --from metricflow --to osi INPUT_PATH --output DIR [--package-name @scope/name] [--package-version X.Y.Z] [--overwrite] [--json]rawctx publish [TARGET_DIR] [--registry URL]rawctx publish --from-dbt DBT_PROJECT_DIR [--native] [--emit-package DIR] [--package-name @scope/name] [--package-version X.Y.Z] [--registry URL]
Maintainer:
rawctx claim PACKAGE_REF [--json] [--registry URL]
Ops:
rawctx index dbt --seed-file PATH [--only owner/name] [--limit N] [--dry-run] [--json] [--registry URL]rawctx index git --repo owner/name --source-ref REF --package-version X.Y.Z [--package-name NAME] [--scope SCOPE] [--model-glob GLOB ...] [--dry-run] [--json] [--registry URL]
Supported Package Lanes
rawctx currently supports two published package formats:
format=osi: packaged OSI YAML filesformat=metricflow: native MetricFlow/dbt snapshot packages
Both lanes support:
rawctx inforawctx snapshot-downloadrawctx.load()rawctx.to_prompt()
download PACKAGE_REF MODEL_PATH also works for both lanes, but only for files listed in manifest.models.
Notebook / Code
Search uses the public Hub index first so CLI and SDK results match the logged-out web experience. If a search returns no public matches and you have a token configured, rawctx retries with authenticated search.
Notebook shell style:
!rawctx search "semantic model" --sort recent --json
!rawctx info @scope/name --json
!rawctx snapshot-download @scope/name --json
!rawctx download @scope/name models/customers.yml --json
!rawctx validate ./my-package --json
Python API:
import rawctx
result = rawctx.search("semantic model", registry="https://api.rawctx.dev", sort="recent")
pkg = rawctx.info("@scope/name", registry="https://api.rawctx.dev")
model = rawctx.load("@scope/name", registry="https://api.rawctx.dev")
prompt = rawctx.to_prompt(
"@scope/name",
datasets=["customers", "order_item"],
max_tokens=2000,
registry="https://api.rawctx.dev",
)
print(model.format_name) # "osi" or "metricflow"
print(model.datasets) # normalized dataset names
print(model.measures) # [Measure(name="...", ...)]
print(model.dimensions) # [Dimension(name="...", ...)]
print(model.relationships) # [Relationship(name="...", ...)]
print(prompt)
print(pkg["model_paths"])
snapshot_dir = rawctx.snapshot_download("@scope/name", registry="https://api.rawctx.dev")
model_path = rawctx.download("@scope/name", "models/customers.yml", registry="https://api.rawctx.dev")
validation = rawctx.validate("./my-package")
Async Python API:
import asyncio
import rawctx
async def main():
async with rawctx.AsyncRawctxClient(registry="https://api.rawctx.dev") as client:
result = await client.search("semantic model", sort="recent")
model = await client.load("@scope/name")
prompt = await client.to_prompt("@scope/name", datasets=["customers", "order_item"])
snapshot_dir = await client.snapshot_download("@scope/name")
return result, model, prompt, snapshot_dir
asyncio.run(main())
Download Behavior
downloadfetches one file listed inmanifest.modelssnapshot-downloadmaterializes the full extracted package tree- for native MetricFlow packages,
snapshot-downloadis the primary handoff because it restores the full dbt-style snapshot load()andto_prompt()normalize both OSI and native MetricFlow packages into the same typed Python structures- when using
snapshot-download --local-dir, prefer a new or empty directory.--forceonly replaces an existing rawctx snapshot directory and refuses to wipe the current working directory or unrelated folders indexedpackages remain preview-only and cannot be downloaded directly
Validate / Pack / Publish
validate, pack, and publish all start from a local package directory.
validate: checks the manifest and validates the package according tomanifest.formatpack: builds a deterministic local.rawctx.tar.gzpublish: validates again, rebuilds a temporary archive, calculates the checksum, uploads bytes, and completes the version
Package directories are no longer OSI-only.
OSI package example:
my-osi-package/
rawctx.yaml
README.md
models/
sales_summary.osi.yaml
customers.osi.yaml
Native MetricFlow package example:
my-metricflow-package/
rawctx.yaml
README.md
dbt_project.yml
models/
customers.yml
orders.yml
Native MetricFlow manifest example:
name: "@demo/jaffle-metrics"
version: "1.0.0"
format: "metricflow"
source_format: "metricflow"
description: "Native MetricFlow package"
models:
- models/customers.yml
- models/orders.yml
include:
- dbt_project.yml
repository: "https://github.com/dbt-labs/jaffle-sl-template"
Notes:
formatsupportsosiandmetricflowmodelsmust stay relative and must resolve inside the package directoryincludeis optional and is mainly useful for native packages that need extra project files such asdbt_project.yml- standalone file validation is still limited to manifest files and OSI files, so
rawctx validate models/customers.ymlis not a native MetricFlow file validator by itself
Convert Workflow
Inspect-first OSI flow:
rawctx convert --from metricflow --to osi ./my-dbt-project --output ./dist/pkg
rawctx validate ./dist/pkg --json
rawctx pack ./dist/pkg --output-dir ./dist --json
Publish Directly From dbt
Convert to OSI and publish:
rawctx login
rawctx publish --from-dbt ./my-dbt-project --emit-package ./dist/pkg
Publish a native MetricFlow package:
rawctx login
rawctx publish --from-dbt ./my-dbt-project --native --emit-package ./dist/native-pkg
rawctx publish --from-dbt ./my-dbt-project --native --package-name @your-scope/jaffle-shop --package-version 1.2.3
Use --emit-package when you want the generated package directory to remain on disk after the publish run.
Auth Flow (Auto + Fallback)
- Run
rawctx login. - CLI opens or prints the OAuth URL from
POST /api/auth/loginand falls back to the legacy GitHub endpoint if needed. - Complete login in the browser.
- CLI automatically polls OAuth session status and captures
id_tokenwhen the registry supports it. - CLI calls
POST /api/auth/tokenand stores the API token in~/.rawctx/config.yaml.
Manual fallback:
rawctx login --id-token '<JWT>'
Config and Environment
Config file (default): ~/.rawctx/config.yaml
registry: "https://api.rawctx.dev"
auth:
token: "rxctx_..."
token_id: "uuid"
token_name: "rawctx-cli"
issued_at: "2026-02-28T00:00:00+00:00"
profile:
username: "owner"
Environment overrides:
RAWCTX_CONFIG(config path)RAWCTX_REGISTRY(registry URL)RAWCTX_TOKEN(auth token)
Priority: CLI option > env var > config > default.
Offline Mode
--offline is supported for:
searchinfodownloadsnapshot-download
Cache paths:
- index:
~/.rawctx/cache/packages.json - archives:
~/.rawctx/cache/archives/@scope/name/<version>.rawctx.tar.gz - snapshots:
~/.rawctx/packages/@scope/name/<version>/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rawctx-0.3.11.tar.gz.
File metadata
- Download URL: rawctx-0.3.11.tar.gz
- Upload date:
- Size: 100.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c634899f34d5c5f089b7fa4ed43f44984fd923afdd0c3bd4d15e0acbae330928
|
|
| MD5 |
b431e82d1b2798ce82dd69bbcb760d8d
|
|
| BLAKE2b-256 |
c0defa6e2a73b6bd1527611bf3b02aea5410667ef248a7949127fe6a1bf78f7f
|
File details
Details for the file rawctx-0.3.11-py3-none-any.whl.
File metadata
- Download URL: rawctx-0.3.11-py3-none-any.whl
- Upload date:
- Size: 88.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e42d27f5c26bb0cc84424f502b669fa9a7d985a70a76bd10574cd2dd8d91a5d
|
|
| MD5 |
ac2d89bf7cea410a596f2e96bbb7e49a
|
|
| BLAKE2b-256 |
eb5953d9df53815926f0f56e42b81998a2adeda85583964e65c899f6a7f1dad4
|