Quickstart — Offline (Fixture)
Run the full login → init → generate loop against a local fixture file without a live server.
The offline mode lets you iterate on bindings and test your ingest code without connecting to a server. A JSON fixture file stands in for the live schema endpoint.
The fixture file used in this guide is tests/fixtures/schema.sample.json from the python-sdk-spec/ directory. It contains a sample organization schema with two projects and several node types.
Steps
Log in against the fixture
optixlog login \
--fixture tests/fixtures/schema.sample.json \
--api-key sk-opt-test \
--base-url http://xThis writes a credential profile that stores sk-opt-test as the key and http://x as the base URL. The --fixture flag tells the login command to read identity from the fixture rather than calling a real server.
Initialize the project config
optixlog init \
--fixture tests/fixtures/schema.sample.json \
--all \
--output optixlog_gen.py--all selects every project in the fixture. This writes optixlog.toml in your current directory. Running init again without --force is idempotent — it will not overwrite an existing config.
Generate typed bindings
optixlog generate --fixture tests/fixtures/schema.sample.jsonThis reads optixlog.toml, fetches schemas from the fixture, and writes optixlog_gen.py. The output is byte-deterministic — the same input always produces identical bytes, so it is safe to commit and diff.
Use the generated client
from optixlog_gen import OptixClient, Projects, SimulationNode
client = OptixClient() # picks up credentials from optixlog login
result = client.project(Projects.GRATING_COUPLER_LAB).ingest(
data=SimulationNode(config={}, solver="fdtd"),
prompt="Simulated a grating coupler.",
)
print(result.node_id, result.created)Offline vs live
In offline mode, ingest calls are routed through the fixture and do not hit a real server. Switch to the live quickstart when you are ready to write real data.
What the fixture contains
The sample fixture defines an organization with:
- Two projects:
GRATING_COUPLER_LAB(proj_grating_7f3a) andMODULATOR_PROGRAM(proj_modulator_22b1). - Three node types:
SimulationNode,MeasurementNode,LayoutNode. - A many-to-many node-to-project mapping (e.g.
SimulationNodeappears in both projects;LayoutNodeonly inMODULATOR_PROGRAM).