# Api

## timenet\_connectors.api

Producer-side shortcuts for curating and consuming a dataset from local code.

:func:`build` runs a connector through the engine into the shared local registry; :func:`load` does
that and reads the result back. Heavy dependencies (the writer/reader stacks) are imported lazily so
importing :mod:`timenet_connectors` stays cheap.

### build

```
build(
    dataset_id: str,
    *,
    out: str | Path | None = None,
    force: bool = False,
) -> Path
```

Curate a dataset into a local registry, resolving its connector by id.

The producer-side one-liner over the engine. An already-curated version is reused unless `force`
is set. The default output is the shared local registry
(:func:`timenet.registry.default_registry_path`), the very directory the SDK reads from, so a build
here is immediately loadable with `TimeNet().load(dataset_id)`.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `dataset_id` | `str` | The dataset id (`org/name`). | *required* |
| `out` | `str | Path | None` | Output registry directory; defaults to the shared local registry. | `None` |
| `force` | `bool` | Rebuild even if the version is already curated. | `False` |

Returns:

| Type | Description |
| --- | --- |
| `Path` | The committed version directory. |

### load

```
load(
    dataset_id: str, version: str | None = None
) -> TimeFDataset
```

Curate a dataset if needed, then load it into memory.

The demo/one-call sugar over :func:`build` plus :meth:`timenet.client.TimeNet.load`. For a clear
producer/consumer split, call :func:`build` and `TimeNet().load` yourself.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `dataset_id` | `str` | The dataset id (`org/name`). | *required* |
| `version` | `str | None` | The version string, or `None` for the latest. | `None` |

Returns:

| Type | Description |
| --- | --- |
| `TimeFDataset` | The loaded dataset. |
