msmu.pv.to_script
Generate editable Python calls with source/output hash checks.
If filename is supplied, write UTF-8 Python source (overwriting an existing
file) and return None. Otherwise return the source text.
Accepts the same file-backed histories and options as replay(). The generated script
requires msmu, checks the recorded environment at execution, and leaves its
final MuData in mdata. Scripts enable hashing even when verification is disabled.
Generation neither reads inputs nor executes calls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
history
|
MuData | dict
|
required | |
filename
|
str | Path | None
|
Optional output path; an existing file is overwritten. |
None
|
sources
|
dict | None
|
Mapping from recorded file paths/URLs to replacements, as in |
None
|
verify
|
bool
|
Include input/output hash verification. Requires recorded hashes when |
True
|
Returns:
| Type | Description |
|---|---|
str | None
|
Python source string when |
Notes
Export does not execute the workflow or modify the supplied history.
Decoded histories have no current MuData to compare. A failed validation
leaves the destination file unchanged.
Examples:
import msmu as mm
script = mm.pv.to_script(mdata)