Skip to content

tinker_cookbook.utils.code_state

tinker_cookbook.utils.code_state(modules)

Capture the current code state for one or more Python modules as a diff string.

Parameters:

  • modules (Sequence[str | ModuleType]) – Module import names (e.g. "tinker_cookbook.rl") or already-imported module objects.

Returns: str: Concatenated sections, one per repository, each beginning with a header of the form ### repo: <repo_root> @ <commit_hash> followed by the repo-wide diff. Modules not in a Git repository get a short note instead.