Skip to content

Quick Start

Quick Start

What this page is: Copy-pasteable Python snippets for the two most common COGANT API entry points: a manual Session and an orchestrated PipelineRunner.

Prerequisites: Installation and the API overview.

Reading time: ~5 minutes

Next steps: Session API · PipelineRunner API · Bundle API

# doctest: +SKIP  # example requires runtime context or external resources
from cogant import Session, PipelineRunner, Bundle
from cogant.api.pipeline import PipelineConfig

# Method 1: Simple Session
session = Session.from_target("./my_repo")
session.extract_static()
session.build_graph()
session.translate_to_gnn()
session.export_all("output/")

# Method 2: Orchestrated Pipeline
runner = PipelineRunner()
config = PipelineConfig(output_dir="output/")
bundle = runner.run("./my_repo", config)

# Access results
print(bundle.repo_summary())
bundle.save_json("output/bundle.json")  # same artifact as `cogant translate --output output/`
bundle.render_site("html_site/")

Examples

The two snippets above are run end-to-end against real targets in: