simstack.tables package

Submodules

simstack.tables.model_table module

class simstack.tables.model_table.CreateModelTable(db: Database, write_schema: bool = False, project_root: Path | None = None)[source]

Bases: TableBuilderBase

Helper class to build the model table without passing around many parameters.

Usage:

creator = CreateModelTable(db) await creator.make_model_table()

async build(*args, **kwargs) None[source]

Build the table.

  • If dirs is None: use configured path_manager paths (existing behavior).

  • If dirs is a list: scan those directories for Python files and process them.

exclude entries can match:
  • path parts (e.g. “.venv”, “__pycache__”)

  • glob patterns (e.g. “*.generated.py”)

  • nested relative paths (e.g. “src/simstack/models”)

async clear_table() None[source]

an optional hook to clear the table before building

property logger: Logger
simstack.tables.model_table.create_model_table_main()[source]
async simstack.tables.model_table.make_model_table(db: Database, dirs: list[str] = None, drops: str = '', write_schema: bool = False, clear: bool = False, project_root: Path = None, ignore_entrypoints: bool = False)[source]

Rebuild the model table using the given database.

This is a thin wrapper around CreateModelTable for backward compatibility.

simstack.tables.node_children module

simstack.tables.node_children.normalize_text(s: str) str[source]
async simstack.tables.node_children.update_node_children(database, drops: str) None[source]
  1. Read all registered nodes from NodeModel.

  2. For each node, import its function and extract called functions.

  3. Keep only those calls that correspond to nodes in the table.

  4. Update the NodeModel.called_nodes of the original function with a list of function_mapping strings.

simstack.tables.node_table module

class simstack.tables.node_table.CreateNodeTable(db: Database, write_schema: bool = False, project_root: Path | None = None)[source]

Bases: TableBuilderBase

Helper class to build the node table without passing around many parameters.

Usage:

creator = CreateNodeTable(database) await creator.make_node_table()

async build(*args, **kwargs) None[source]

Build the table.

  • If dirs is None: use configured path_manager paths (existing behavior).

  • If dirs is a list: scan those directories for Python files and process them.

exclude entries can match:
  • path parts (e.g. “.venv”, “__pycache__”)

  • glob patterns (e.g. “*.generated.py”)

  • nested relative paths (e.g. “src/simstack/models”)

async clear_table() None[source]

an optional hook to clear the table before building

get_class_mapping(type: Type, drops: str = '') str[source]

Return the class mapping for a given type, optionally dropping a prefix.

property logger: Logger
async second_stage(drops: str) None[source]

an optional hook to run after all modules have been processed

simstack.tables.node_table.create_node_table_main() None[source]

CLI-style entry point to (re)build the node table.

Uses a dedicated event loop, matching the pattern used for model table creation.

simstack.tables.node_table.is_node_function(func: Callable[[...], Any]) bool[source]

Check if a function is marked as a node using the @node decorator.

async simstack.tables.node_table.make_node_table(db: Database, dirs: list[str] | None = None, drops: str | None = None, write_schema: bool = False, clear: bool = False, project_root: Path | None = None, ignore_entrypoints: bool = False) None[source]

Rebuild the node table using the given databse.

This is a thin wrapper around CreateNodeTable for backward compatibility.

simstack.tables.table_builder module

class simstack.tables.table_builder.TableBuilderBase(db: Database, write_schema: bool = False, project_root: Path | None = None)[source]

Bases: ABC

Shared pipeline for building “tables” by scanning:
  1. installed simstack modules (packages)

  2. configured project paths (python files)

Subclasses only implement _process_module(module, drops).

async build(*, dirs: list[Path] | None = None, drops: str = '', exclude: list[str] | None = None, clear: bool = False, ignore_entrypoints: bool = False) None[source]

Build the table.

  • If dirs is None: use configured path_manager paths (existing behavior).

  • If dirs is a list: scan those directories for Python files and process them.

exclude entries can match:
  • path parts (e.g. “.venv”, “__pycache__”)

  • glob patterns (e.g. “*.generated.py”)

  • nested relative paths (e.g. “src/simstack/models”)

async clear_table() None[source]

an optional hook to clear the table before building

classmethod cli_main(builder_cls: Type[TableBuilderBase], write_schema: bool = False) None[source]

Reusable CLI entry point.

Options:
--dir RELPATH

(repeatable) Directories (relative to CWD) to scan for *.py files. If omitted, defaults to scanning the current working directory.

--drops STRING

Drops prefix (string) applied while processing these CLI dirs.

-v/–verbose Increase logging verbosity.

abstract property logger: Logger
property project_root: Path
async second_stage(drops: str) None[source]

an optional hook to run after all modules have been processed

Module contents