Module
pixano.datasets.io.api
The shared Python entry points behind the CLI and the REST API (spec §3.1). ``analyze`` and ``import_dataset`` are the whole public surface: the CLI renders the returned :class:`ImportPlan` and calls ``import_dataset`` with a tqdm sink; the REST layer does the same with a job-store sink.
Functions
def
analyze
(source, spec, limits, importer)
→ ImportPlan Analyze a source without side effects and return its import plan.
| Parameter | Type | Default |
|---|---|---|
source | str | Path | — |
spec | ImportSpec | None | None |
limits | AnalyzeLimits | None | None |
importer | DatasetImporter | None | None |
def
export_dataset
(dataset, destination, format, media, options)
→ Path Export a dataset to a data format (spec §10).
``pixano_jsonl`` emits exactly the import grammar with explicit ids, so
import → export → import is id-equal. Other formats arrive with their
exporters (plan P3).
| Parameter | Type | Default |
|---|---|---|
dataset | 'Dataset | Path | str' | — |
destination | str | Path | — |
format | str | 'pixano_jsonl' |
media | str | 'files' |
options | dict[str, Any] | None | None |
def
import_dataset
(source, data_dir, spec, plan, info, importer, sinks, engine, job_id, resume_cursor)
→ ImportResult Import a source into the data directory's library (analyze → validate → ingest).
Args:
source: Source directory/file, or ``hub://org/repo``.
data_dir: The Pixano data directory (holds ``library/``).
spec: Declarative import spec; defaults apply when omitted.
plan: A previously computed plan; re-analyzed when omitted.
info: Target dataset schema; derived from the workspace preset when omitted.
importer: Explicit importer instance (advanced; bypasses the registry).
sinks: Progress sinks (e.g. a tqdm sink).
engine: Preconfigured engine (jobs wire checkpoints/cancellation through it).
job_id: External job id (names the staging dir so crashed builds resume).
resume_cursor: Last committed cursor; re-enters the importer past done work.
Returns:
The import result (dataset id/path, per-table row counts).
| Parameter | Type | Default |
|---|---|---|
source | str | Path | — |
data_dir | str | Path | — |
spec | ImportSpec | None | None |
plan | ImportPlan | None | None |
info | DatasetInfo | None | None |
importer | DatasetImporter | None | None |
sinks | Sequence[ProgressSink] | () |
engine | ImportEngine | None | None |
job_id | str | None | None |
resume_cursor | dict | None | None |