Client
timenet.client ¶source
The :class:TimeNet class is the SDK's single entry point for using TimeNet from code.
This class wraps a :class:~timenet.registry.BaseRegistry (the catalog) and a local storage path
(the download cache). It exposes these methods: list, get, search, download, and
load. Against a local registry, load builds a dataset the registry does not have when an
installed package registers a connector for its id; against a remote registry it never runs connector
code.
TimeNet ¶source
Browse a registry and fetch datasets to local storage.
download ¶source
download(
dataset_id: str,
version: str | None = None,
*,
force: bool = False,
progress_cb: ProgressCallback | None = None,
) -> Path
Fetch a dataset version's files into local storage. Return its directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_id
|
str
|
The dataset id. |
required |
version
|
str | None
|
The version string, or |
None
|
force
|
bool
|
Download again, even if an up-to-date copy already exists. |
False
|
progress_cb
|
ProgressCallback | None
|
Called with each file's byte count as it lands, for a progress display. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The local |
list ¶source
Return the metadata of every dataset in the registry.
Returns:
| Name | Type | Description |
|---|---|---|
One |
_Metadatas
|
class: |
load ¶source
load(
dataset_id: str,
version: str | None = None,
*,
auto_build: bool = True,
) -> TimeFDataset
Read the dataset into memory through the registry's storage handle.
Series values stay lazy per-series once the handle is open. A local or S3 registry reads them in
place; a remote registry materializes the version to local storage first (see
:meth:~timenet.registry.BaseRegistry.open_version), so a remote load fetches the whole version.
Against a local registry, a dataset the registry does not have is built first, if some
installed package registers a connector for its id. Set auto_build false to fail fast
instead of starting a download and a build. A remote registry raises as before.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_id
|
str
|
The dataset id. |
required |
version
|
str | None
|
The version string, or |
None
|
auto_build
|
bool
|
Build a missing local dataset from its connector. Set false to raise instead. |
True
|
Returns:
| Type | Description |
|---|---|
TimeFDataset
|
The dataset with lazy, per-series loaders that use the registry handle. |
Raises:
| Type | Description |
|---|---|
TimeNetDatasetNotFoundError
|
If the version is absent and nothing builds it, or the connector declares a different version than the one asked for. |
TimeNetBuildError
|
If the build runs but fails. |
load_torch ¶source
Download the dataset if needed, then return it as a read-only PyTorch Dataset.
This method needs the torch extra (pip install 'timenet[torch]'). The code
imports the torch view lazily, so base users do not need torch installed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_id
|
str
|
The dataset id. |
required |
version
|
str | None
|
The version string, or |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
TimeFTorchDataset
|
class: |
search ¶source
search(
*,
query: _OrList[str] = None,
domain: _OrList[Domain] = None,
task: _OrList[type[Task]] = None,
license: _OrList[License] = None,
time_series_spec: _OrList[str] = None,
dataset_id: _OrList[str] = None,
tag: _OrList[str] = None,
limit: int = 100,
) -> _Metadatas
Search the registry. This method mirrors :meth:~timenet.registry.BaseRegistry.search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
_OrList[str]
|
Free text terms for the name, description, and tags. |
None
|
domain
|
_OrList[Domain]
|
Keep datasets that share any of these domains. |
None
|
task
|
_OrList[type[Task]]
|
Keep datasets whose schema includes any of these task classes. |
None
|
license
|
_OrList[License]
|
Keep datasets with any of these licenses. |
None
|
time_series_spec
|
_OrList[str]
|
Keep datasets that declare all of these |
None
|
dataset_id
|
_OrList[str]
|
Keep only these ids. |
None
|
tag
|
_OrList[str]
|
Keep datasets that declare all of these tags. |
None
|
limit
|
int
|
The maximum number of results. |
100
|
Returns:
| Type | Description |
|---|---|
_Metadatas
|
The matching dataset metadata. |