stepup.core.script¶
Driver function to facilitate writing scripts that adhere to StepUp’s script protocol.
Warning
The script interface for calling user Python scripts from plan.py has been deprecated
in favor of the new Call interface.
You are encouraged to migrate your plan.py files to the new API.
See the migration guide for a step-by-step walkthrough.
driver(obj=None)
¶
Implement script protocol.
The most common usage is to call driver() from a script
that defines an info() and a run() function, e.g.:
#!/usr/bin/env python3
from stepup.core.script import driver
def info():
return {"inp": ["input.txt"], "out": ["output.txt"]}
def run(inp: str, out: str):
with open(inp) as fh:
text = fh.read()
with open(out, "w") as fh:
fh.write(text.upper())
if __name__ == "__main__":
driver()
Parameters:
-
obj(Any, default:None) –When not provided, the namespace of the module from which
driveris called will be searched for names likeinfoandrunto implement the script protocol. When an object is given as a parameter, its attributes are searched instead.