runtime.exec¶
Contains all of the middlewares used during execution of a command
ApplyParseResultMiddleware
¶
Bases: ParamProcessor
Update the parameter values with the values found from parsing the input
Context Dependencies¶
arc.parse.result
arc.args.tree
arc.config
arc.args.origins
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
CompileParamsMiddleware
¶
Bases: MiddlewareBase
Compile the parameter tree into dictionary that can be used to call the command callback.
Context Dependencies¶
arc.args.tree
Context Additions¶
arc.args
- Dictionary to pass into command callback
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
ConvertValuesMiddleware
¶
Bases: ParamProcessor
Performs type conversion on retrieved parameter values
Context Dependencies¶
arc.args.tree
arc.config
arc.args.origins
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
DefaultValueMiddleware
¶
Bases: ParamProcessor
Retrieves parameter values from the defaults for each parameter
Context Dependencies¶
arc.args.tree
arc.config
arc.args.origins
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
DependancyInjectorMiddleware
¶
Bases: ParamProcessor
Performs dependcy injection for relavent parameters
Context Dependencies¶
arc.args.tree
arc.config
arc.args.origins
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
ExecMiddleware
¶
Bases: DefaultMiddlewareNamespace
Container for all default execution middlewares
Use it to reference a default exec middleware when adding your own custom middlewares
import arc
@arc.command
def command():
arc.print("hello there")
@command.use(after=arc.ExecMiddleware.ConverValues)
def after_convert(ctx: arc.Context):
# Runs after type conversion occurs
...
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
ExitStackMiddleware
¶
Bases: MiddlewareBase
Utility middleware that adds an instance of contextlib.ExitStack
to the context.
This can be used to open resources (like IO objects) that need to be closed when the program is exiting.
Context Dependencies¶
None
Context Additions¶
arc.exitstack
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
GetEnvValueMiddleware
¶
Bases: ParamProcessor
Retrieves parameter values from enviroment variables
Context Dependencies¶
arc.args.tree
arc.config
arc.args.origins
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
GetPromptValueMiddleware
¶
Bases: ParamProcessor
Retrieves parameter values from user input
Context Dependencies¶
arc.args.tree
arc.config
arc.args.origins
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
GetterValueMiddleware
¶
Bases: ParamProcessor
Retrieves parameter values from the parameter getter function
Context Dependencies¶
arc.args.tree
arc.config
arc.args.origins
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
MissingParamsCheckerMiddleware
¶
Bases: MiddlewareBase
Checks to ensure that all params have been given a value
Context Dependencies¶
arc.args.tree
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
OpenResourceMiddleware
¶
Bases: MiddlewareBase
Opens any parameter that is a context manager
Context Dependencies¶
arc.args
arc.exitstack
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
RunTypeMiddlewareMiddleware
¶
Bases: ParamProcessor
Execute the registered type middleware for each parameter
Context Dependencies¶
arc.args.tree
arc.config
arc.args.origins
Context Additions¶
None
Source code in /home/runner/work/arc/arc/arc/runtime/exec.py
SetupParamMiddleware
¶
Bases: MiddlewareBase
Performs parameter setup for the given command
Context Dependencies¶
arc.command
Context Additions¶
arc.args.tree
- Tree representing the command's parameters and their realized values
arc.args.origins
- Dictionary that stores where each parameter value comes from. See Context.get_origin()