tanat.core package#

Submodules#

tanat.core.context module#

Workspace context.

tanat.core.context.get_workspace()[source]#

Get the active workspace instance, creating it if it doesn’t exist.

tanat.core.context.set_active_ws_instance(instance)[source]#

Set the active workspace instance.

tanat.core.format module#

Helpers for output format validation and DataFrame conversions.

tanat.core.format.resolve_fmt(fmt: str, allowed: tuple[str, ...], default: str) str[source]#

Validate and normalize the output format.

Parameters:
  • fmt – Requested output format.

  • allowed – Allowed format values.

  • default – Default format used when fmt is None.

Returns:

The validated output format.

Raises:

ValueError – If fmt is not one of allowed.

tanat.core.format.to_pandas(df: DataFrame, use_arrow: bool = True) DataFrame[source]#

Convert a Polars DataFrame to pandas.

Parameters:
  • df – Input Polars DataFrame.

  • use_arrow – Whether to preserve Arrow extension arrays in pandas.

Returns:

The converted pandas DataFrame.

tanat.core.path module#

Path resolution utilities

tanat.core.path.resolve_path(path_or_name: str | Path) Path[source]#

Resolve a path or workspace name to an absolute Path object.

tanat.core.registry module#

Factory registry.

tanat.core.registry.build_pool(container_type, store_instance)[source]#

Retrieves the factory function and creates the Pool.

tanat.core.registry.register_factory(container_type, factory_func)[source]#

Registers a factory function for a specific container type.

tanat.core.validation module#

Lightweight type guards used across the library.

These helpers exist to break import cycles.

The check relies on a duck-typing marker (e.g. :pyattr:`Criterion.__criterion__`) so this module has zero dependency on the validated types.

tanat.core.validation.ensure_criterion(obj) None[source]#

Raise TypeError if obj is not a Criterion instance.

Uses the :pyattr:`Criterion.__criterion__` marker for an import-cycle-safe duck-typing check, so internal callers (pools, sequences, trajectories) do not need to import Criterion at module load time.

tanat.core.workspace module#

Workspace class.

class tanat.core.workspace.Workspace(root_path: str)[source]#

Bases: object

Workspace class to manage directory for data storage.

__init__(root_path: str)[source]#
clear()[source]#

Clears the workspace by removing all files and directories.

clear_tmp()[source]#

Remove all virtual (tmp) contexts from every store.

Use this to reclaim disk space after crashes or interrupted sessions that left orphan virtual contexts behind.

Warning

Only call when no Pool is actively using virtual features.

get_store_path(store_name: str) Path[source]#

Returns the full path for a given store name.

list_stores() list[str][source]#

Lists all store names in the workspace.

Module contents#

Package stub.