HubPublic

Python

Carry the same Hub workflow into notebooks and scripts

Goal: keep CLI and SDK behavior aligned so automation can search rawctx Hub, load typed semantic models from OSI or native MetricFlow packages, generate prompt context, and reuse the same search and download semantics as the web UI.

Notebook shell

Use the CLI when each cell should stay inspectable

Keep the same public-first flow as the web UI: search, inspect, snapshot-download, then decide whether to materialize typed objects or prompt context.

!rawctx search "stripe subscriptions" --sort recent --json
!rawctx info @pasar6987/stripe-subscriptions --json
!rawctx snapshot-download @pasar6987/stripe-subscriptions --json
!rawctx to-prompt @pasar6987/stripe-subscriptions --datasets subscriptions --max-tokens 2000
import rawctx

prompt = rawctx.to_prompt(
    "@pasar6987/stripe-subscriptions",
    datasets=["subscriptions"],
    registry="https://api.rawctx.dev",
)
print(prompt)

Python SDK

Top-level functions and async clients stay aligned

load() returns a normalized package object, to_prompt() compresses the same snapshot into LLM-ready context, and both sync and async clients preserve the same return shape.

import asyncio
import rawctx

packages = rawctx.search("stripe subscriptions", sort="recent", registry="https://api.rawctx.dev")
package = rawctx.info("@pasar6987/stripe-subscriptions", registry="https://api.rawctx.dev")
model = rawctx.load("@pasar6987/stripe-subscriptions", registry="https://api.rawctx.dev")
prompt = rawctx.to_prompt(
    "@pasar6987/stripe-subscriptions",
    datasets=["subscriptions", "invoices"],
    max_tokens=2000,
    registry="https://api.rawctx.dev",
)
snapshot_dir = rawctx.snapshot_download("@pasar6987/stripe-subscriptions", registry="https://api.rawctx.dev")
print(model.format_name)
print(model.datasets)

async def main():
    async with rawctx.AsyncRawctxClient(registry="https://api.rawctx.dev") as client:
        model = await client.load("@pasar6987/stripe-subscriptions")
        prompt = await client.to_prompt("@pasar6987/stripe-subscriptions", datasets=["subscriptions", "invoices"])
        return await client.search("stripe subscriptions", sort="recent"), model, prompt

asyncio.run(main())
Public functions
search()info()snapshot_download()download()load()to_prompt()semantic_diff()prompt_diff()diff_artifacts()

Use the top-level functions for straightforward scripts. Move to RawctxClient or AsyncRawctxClient when you want one shared registry, token, and timeout configuration.

Typed runtime object
packageversionsnapshot_dirformat_namedatasetsmeasuresmetricsdimensionsrelationshipsmodels

load() returns LoadedPackage, so notebooks and agents can reason over real semantic objects instead of reparsing YAML or README prose.

Hub payloads
itemsmetapackageversionsselected_versionmodel_paths

search() and info() return JSON-shaped dictionaries that mirror the review path on rawctx Hub, including package facts, version lists, and model-path discovery.

Next step

Use the reference when you need exact shapes and failure semantics

The guide keeps the lane simple. The reference page goes deeper on object fields, diff helper returns, and the exceptions you should catch in notebooks, services, and CI agents.