""" export_coco.py — CLI entrypoint for the COCO JSON export stage. Usage: uv run python scripts/export_coco.py uv run python scripts/export_coco.py --labeled-dir data/labeled --output data/labeled/coco_export.json """ from __future__ import annotations import logging from pathlib import Path import click from dotenv import load_dotenv load_dotenv() from autolabel.export import run_export from autolabel.config import settings from autolabel.utils import setup_logging @click.command() @click.option( "--labeled-dir", default=str(settings.labeled_dir), show_default=True, type=click.Path(exists=True, file_okay=False, path_type=Path), help="Directory containing accepted-annotation JSON files.", ) @click.option( "--output", default=str(settings.labeled_dir / "coco_export.json"), show_default=True, type=click.Path(path_type=Path), help="Output path for the COCO JSON file.", ) @click.option("--verbose", "-v", is_flag=True, default=False, help="Debug logging.") def main(labeled_dir: Path, output: Path, verbose: bool) -> None: """Export accepted annotations from LABELED_DIR to COCO JSON format.""" setup_logging(logging.DEBUG if verbose else logging.INFO) run_export(labeled_dir=labeled_dir, output_path=output, cfg=settings) if __name__ == "__main__": main()