Public API (v0.1)¶
This page defines Consist's public API for the 0.1.x series. Items listed as
Advanced are still public but are primarily targeted at advanced users and may be
more verbose, lower-level, or easier to misuse.
For tiered guidance:
- API Essentials for onboarding and preferred execution patterns
- API Advanced for manual lifecycle, decorators, and lower-level APIs
When to use each run entry point¶
| Entry point | Use when | Notes |
|---|---|---|
Tracker.run |
You want explicit tracker ownership for one cache-aware function | Preferred single-step entry point |
Tracker.trace |
You need inline execution with explicit tracker control | Block executes every time |
consist.scenario |
You need multi-step workflows with shared scenario context | Returns ScenarioContext |
ScenarioContext.run |
You are inside a scenario and want cache-aware steps | Step-level equivalent of Tracker.run; also accepts binding=BindingResult(...) for orchestrator-resolved inputs |
ScenarioContext.map_runs |
You are inside a scenario and want one child run per sweep row | Process-backed fan-out for independent parameter sweeps |
ScenarioContext.trace |
You are inside a scenario and need inline step execution | Step-level equivalent of Tracker.trace |
consist.run |
You need the legacy context-resolving convenience wrapper | Deprecated compatibility wrapper around Tracker.run |
consist.trace |
You need the legacy context-resolving tracing wrapper | Deprecated compatibility wrapper around Tracker.trace |
consist.start_run |
You need the legacy context-resolving lifecycle wrapper | Deprecated compatibility wrapper around Tracker.start_run |
Relationship: consist.scenario, consist.run, and Tracker.run¶
Tracker.run(...)is the explicit class method for a single cache-aware step.consist.scenario(...)creates a scenario context; inside it, callsc.run(...)for cache-aware steps orsc.trace(...)for inline blocks that execute each time. If an external planner has already resolved the step bindings, passbinding=BindingResult(...)tosc.run(...)instead of unpacking primitive input kwargs. That is the preferred scenario-level envelope for complex or externally orchestrated workflows.consist.run(...)resolves the active/default tracker and then callsTracker.run(...), but it is now a deprecated compatibility wrapper.
Top-level API policy¶
Consist keeps top-level consist.* helpers when they add one of two things:
- Ambient run-scoped behavior: helpers that attach metadata, artifacts, or
side effects to an already-active run without forcing tracker plumbing
through nested workflow code. Examples include
consist.log_artifact(...),consist.log_artifacts(...),consist.log_input(...),consist.log_output(...),consist.ingest(...),consist.log_meta(...), andconsist.capture_outputs(...). - Pure/context utilities: helpers that do not create tracker-owned
execution state, such as
consist.ref(...),consist.refs(...),consist.output_path(...), andconsist.output_dir(...).
Consist deprecates top-level helpers when they are only duplicate tracker-owning execution entry points:
consist.run(...)consist.trace(...)consist.start_run(...)
consist.scenario(...) remains a deliberate exception. It is still a top-level
workflow entry point, but it carries meaningful API-level behavior beyond
simple forwarding, including the enabled=False noop branch and the scenario
ergonomics used throughout examples and multi-step workflows.
Run/trace identity kwargs (public surface)¶
Run/trace APIs share these public identity kwargs:
adapter=...identity_inputs=[...]
This applies to:
consist.run(...)/consist.trace(...)Tracker.run(...)/Tracker.trace(...)ScenarioContext.run(...)/ScenarioContext.trace(...)
config_plan= and hash_inputs= are not accepted on these run/trace surfaces.
Passing them raises TypeError (unexpected keyword argument ...).
For signature debugging, use run.identity_summary.
Minimal runnable comparison¶
from pathlib import Path
import consist
from consist import Tracker
tracker = Tracker(run_dir="./runs", db_path="./provenance.duckdb")
def write_result() -> Path:
out = consist.output_path("result", ext="txt")
out.write_text("ok\n")
return out
# Preferred class API: explicit tracker ownership.
one = tracker.run(fn=write_result, outputs=["result"])
# Scenario API: grouped multi-step workflows.
with tracker.scenario("baseline") as sc:
step = sc.run(fn=write_result, name="step_result", outputs=["result"])
Stable (intended for external users)¶
consist.Trackerconsist.Runconsist.Artifactconsist.ArchivedOutputsconsist.ArchivedRunOutputFilesReportconsist.ArchivedRunOutputFileconsist.HydratedRunOutputconsist.HydratedRunOutputsResultconsist.MaterializedArtifactconsist.ArtifactRecoveryCopyRegistrationconsist.RunOutputRecoveryCopiesRegistrationconsist.MaterializationResultconsist.StagedInputconsist.StagedInputsResultconsist.RunSetconsist.AlignedPairconsist.AdmissionReport(policy-neutral evidence returned by prior-run artifact admission)consist.AdmissionReference(caller-proven runtime host/consumer path evidence for admission)consist.check_artifact_identity(compare one resolved file with an exact input from a completed run)consist.check_admission_reference(compare a runtime-resolved input without recreating consumer path logic)consist.ArtifactSpec/consist.OutputArtifactSpec(rich declared-output metadata forTracker.run(output_paths=...))consist.FilenamePattern,consist.IntCapture, andconsist.EnumCapture(capture-aware output-set declarations forOutputSet(include=...); the capture set is intentionally narrow in v1, and future typed captures can be added by design if there is demand)consist.CacheOptions,consist.OutputPolicyOptions,consist.ExecutionOptionsconsist.BindingResult(execution envelope for orchestrator-resolved scenario inputs)consist.StepIdentity(Scenario-owned resolved name, model, and strict callable contract for preflighted advanced bindings)consist.ResolvedBindingBuilder/consist.ResolvedBinding(advanced immutable execution contract for a previously verified artifact selection;bind_tracked_artifact(...)derives the trusted identity and locator from a Consist artifact; ordinary workflows should continue to use Coupler refs orBindingResult)consist.H5ChildSpec(typed child-artifact customization for HDF5 containers)consist.GtfsCanonicalizationResultandconsist.GtfsFeedSnapshot(GTFS selected-service identity results)consist.canonicalize_gtfs_bundleandconsist.discover_gtfs_members(pure GTFS helpers for dependency-light inspection and identity calculation)- GTFS schema models such as
consist.GtfsRoutes,consist.GtfsTrips, andconsist.GtfsStopTimes
Scenario / workflow helpers¶
consist.scenarioconsist.single_step_scenarioconsist.define_stepconsist.use_trackerconsist.output_dirconsist.output_pathTracker.runTracker.traceconsist.run(deprecated compatibility wrapper)consist.trace(deprecated compatibility wrapper)consist.start_run(deprecated compatibility wrapper)ScenarioContext(returned byconsist.scenario(...))run_id,config,inputs,add_input,declare_outputs,require_outputs,collect_by_keys,run,map_runs,tracerun(..., binding=BindingResult(...))for resolved orchestrator plans orbinding=ResolvedBinding(...)for verified execution-exact plansmap_runs(...)for independent process-backed sweep rowsRunContext(injected viaexecution_options=ExecutionOptions(inject_context=True))run_dir,output_dir,output_path,inputs,load,log_artifact,log_artifacts,log_input,log_output,log_meta,capture_outputsCoupler(available atscenario.coupler)
Scenario defaults like name_template and cache_epoch are configured via consist.scenario(...) and flow into ScenarioContext.run(...).
Parallel orchestration models¶
These models are returned by, or support, ScenarioContext.map_runs(...):
consist.BatchResult: aggregate result for a sweep/batch.consist.RunSpecResult: per-spec result, includingpersisted_run_idwhen a run record exists.consist.BatchRunSpec: serializable description of one child run.consist.ExecutionAttempt: status details for one backend attempt.consist.ExecutionSpecandconsist.PythonCallableTarget: lower-level execution request objects used by the process backend.
Utilities and Introspection¶
StepContract(Resolved declarative metadata for a decorated step)resolve_step_contract(Resolve one decorated step without executing it)collect_step_contracts(Resolve a sequence of decorated steps with shared context)collect_step_schema(Extract outputs for Coupler schemas)ArtifactKeyRegistry(Manage consistent artifact keys)
Artifact logging and loading¶
consist.log_artifactconsist.log_artifactsconsist.log_inputconsist.log_outputconsist.ingestconsist.log_dataframeconsist.canonicalize_gtfsconsist.loadconsist.capture_outputsconsist.get_artifactconsist.hydrate_run_outputs(recommended historical output recovery API)consist.hydrate_run_outputs_to_destinations(historical recovery to exact caller-chosen paths)consist.materialize_run_outputs(aggregate compatibility wrapper)consist.materialize_artifact(single-artifact recovery)consist.stage_artifact(low-level canonical input staging)consist.stage_inputs(low-level canonical input staging)consist.set_artifact_recovery_rootsconsist.archive_artifactconsist.archive_run_outputsconsist.archive_current_run_outputsconsist.archive_run_output_filesconsist.register_artifact_facet_parserconsist.cached_outputconsist.cached_artifactsconsist.log_metaconsist.current_runconsist.current_consistTracker.define_step(...)(explicit tracker form)Tracker.materialize(...)
Querying and views¶
consist.viewconsist.register_viewsconsist.find_runconsist.find_runsconsist.find_latest_runconsist.find_matching_runconsist.find_matching_runsconsist.run_setTracker.run_set(...)RunSetandAlignedPairTracker.find_latest_run(...)Tracker.find_matching_run(...)Tracker.find_matching_runs(...)Tracker.diff_runs(...)Tracker.get_child_artifacts(...)/Tracker.get_parent_artifact(...)Tracker.get_run_inputs(...)/Tracker.get_run_outputs(...)Tracker.get_run_config(...)Tracker.print_lineage(...)consist.run_queryconsist.db_sessionconsist.pivot_facets- Indexing helpers:
consist.index_by_field,consist.index_by_facet, plusRunFieldIndex/FacetIndex - Views registry:
tracker.views(ViewRegistry) - Matrix utilities:
Tracker.load_matrix(...),MatrixViewFactory - Schema export:
Tracker.export_schema_sqlmodel(...)
Run lookup helpers treat stage and phase as first-class run dimensions, so
you can filter historical runs with consist.find_runs(...),
consist.find_latest_run(...), or Tracker.find_latest_run(...) without
treating those values as opaque metadata.
Use find_matching_run(...) when restart or reuse code needs the latest run
matching a semantic target with optional cache_epoch= and run_scope=.
Tracker methods¶
This section groups commonly documented public Tracker methods. If you're new
to Consist, start with the Core and Logging/Loading groups and reach for
Advanced only as needed.
Core lifecycle¶
begin_run,start_run,run,trace,scenario,end_rundefine_step,last_run,is_cached,cached_artifacts,cached_outputsuspend_cache_options,restore_cache_options,capture_outputs,log_meta
Logging and loading¶
log_artifact,log_artifacts,log_input,log_output,log_dataframeload,materialize,ingest
Querying and history¶
find_runs,run_set,find_run,find_latest_run,find_matching_run,find_matching_runs,get_latest_run_idfind_artifacts,get_artifact,get_child_artifacts,get_parent_artifact,get_artifacts_for_runfind_artifacts_by_params,get_artifact_kv,register_artifact_facet_parserget_run,get_run_config,get_run_inputs,get_run_outputshydrate_run_outputs,hydrate_run_outputs_to_destinations,materialize_run_outputs,materialize_artifactstage_artifact,stage_inputsset_artifact_recovery_roots,register_artifact_recovery_copy,register_run_output_recovery_copies,archive_artifact,archive_run_outputs,archive_current_run_outputs,archive_run_output_filesget_artifact_lineage,print_lineage,historydiff_runs,get_config_facet,get_config_facets,get_run_config_kvget_config_values,get_config_value,find_runs_by_facet_kv
Views and matrices¶
view,create_view,load_matrix,export_schema_sqlmodelnetcdf_metadata,openmatrix_metadata,spatial_metadata
Config canonicalization¶
canonicalize_config,canonicalize_gtfs,prepare_config,apply_config_plan,identity_from_config_plan
Format-specific logging¶
log_h5_container,log_h5_table,log_netcdf_file,log_openmatrix_file
log_h5_container(...) now supports child_specs={...} and
child_selection="all" | "include_only" so callers can either customize
discovered child artifacts or log only a selected subset of HDF5 dataset paths.
It also accepts parent recovery policy kwargs such as
container_recovery_unit="parent_file" and
child_recovery_policy="descriptive_only" so downstream recovery tools can
distinguish parent-file recovery from descriptive child-table artifacts.
log_h5_table(...) accepts the same child-level semantic metadata surface as
normal artifact logging: description, facet, facet_schema_version, and
facet_index.
Advanced (power-user / lower-level)¶
These methods are still public, but are more low-level or easier to misuse.
engine,set_run_subdir_fn,run_artifact_dir,resolve_urirun_query,get_run_record,resolve_historical_path,load_input_bundleget_artifact_by_uri,get_run_artifact,load_run_output,find_matching_runon_run_start,on_run_complete,on_run_failed
Stable, but optional extras¶
These APIs are part of the public surface, but require extra dependencies.
- Ingestion helpers:
consist.ingest(install withconsist[ingest]) - Ibis query bridge:
consist.ibis_connection,consist.ibis_view,consist.ibis_grouped_view(install withconsist[ibis]) consist.integrations.containers(container execution + caching; requires Docker or Singularity)consist.integrations.dlt_loader(low-level ingestion integration; requiresconsist[ingest])