flytekit.clis.sdk_in_container.run
Directory
Classes
| Class | Description |
|---|---|
DynamicEntityLaunchCommand |
This is a dynamic command that is created for each launch plan. |
Entities |
NamedTuple to group all entities in a file. |
RemoteEntityGroup |
click multicommand that retrieves launchplans from a remote flyte instance and executes them. |
RunCommand |
A click command group for registering and executing flyte workflows & tasks in a file. |
RunLevelComputedParams |
This class is used to store the computed parameters that are used to run a workflow / task / launchplan. |
RunLevelParams |
This class is used to store the parameters that are used to run a workflow / task / launchplan. |
WorkflowCommand |
click multicommand at the python file layer, subcommands should be all the workflows in the file. |
YamlFileReadingCommand |
Methods
| Method | Description |
|---|---|
dump_flyte_remote_snippet() |
|
get_entities_in_file() |
Returns a list of flyte workflow names and list of Flyte tasks in a file. |
is_optional() |
Checks if the given type is Optional Type. |
load_naive_entity() |
Load the workflow of a script file. |
options_from_run_params() |
|
run_command() |
Returns a function that is used to implement WorkflowCommand and execute a flyte workflow. |
run_remote() |
Helper method that executes the given remote FlyteLaunchplan, FlyteWorkflow or FlyteTask. |
to_click_option() |
This handles converting workflow input types to supported click parameters with callbacks to initialize. |
Methods
dump_flyte_remote_snippet()
def dump_flyte_remote_snippet(
execution: flytekit.remote.executions.FlyteWorkflowExecution,
project: str,
domain: str,
)| Parameter | Type | Description |
|---|---|---|
execution |
flytekit.remote.executions.FlyteWorkflowExecution |
|
project |
str |
|
domain |
str |
get_entities_in_file()
def get_entities_in_file(
filename: pathlib.Path,
should_delete: bool,
) -> flytekit.clis.sdk_in_container.run.EntitiesReturns a list of flyte workflow names and list of Flyte tasks in a file.
| Parameter | Type | Description |
|---|---|---|
filename |
pathlib.Path |
|
should_delete |
bool |
is_optional()
def is_optional(
_type,
)Checks if the given type is Optional Type
| Parameter | Type | Description |
|---|---|---|
_type |
load_naive_entity()
def load_naive_entity(
module_name: str,
entity_name: str,
project_root: str,
) -> typing.Union[flytekit.core.workflow.WorkflowBase, flytekit.core.base_task.PythonTask]Load the workflow of a script file. N.B.: it assumes that the file is self-contained, in other words, there are no relative imports.
| Parameter | Type | Description |
|---|---|---|
module_name |
str |
|
entity_name |
str |
|
project_root |
str |
options_from_run_params()
def options_from_run_params(
run_level_params: flytekit.clis.sdk_in_container.run.RunLevelParams,
) -> flytekit.core.options.Options| Parameter | Type | Description |
|---|---|---|
run_level_params |
flytekit.clis.sdk_in_container.run.RunLevelParams |
run_command()
def run_command(
ctx: click.core.Context,
entity: typing.Union[flytekit.core.workflow.PythonFunctionWorkflow, flytekit.core.base_task.PythonTask, flytekit.core.launch_plan.LaunchPlan],
)Returns a function that is used to implement WorkflowCommand and execute a flyte workflow.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
entity |
typing.Union[flytekit.core.workflow.PythonFunctionWorkflow, flytekit.core.base_task.PythonTask, flytekit.core.launch_plan.LaunchPlan] |
run_remote()
def run_remote(
remote: flytekit.remote.remote.FlyteRemote,
entity: typing.Union[flytekit.remote.entities.FlyteWorkflow, flytekit.remote.entities.FlyteTask, flytekit.remote.entities.FlyteLaunchPlan],
project: str,
domain: str,
inputs: typing.Dict[str, typing.Any],
run_level_params: flytekit.clis.sdk_in_container.run.RunLevelParams,
type_hints: typing.Optional[typing.Dict[str, typing.Type]],
)Helper method that executes the given remote FlyteLaunchplan, FlyteWorkflow or FlyteTask
| Parameter | Type | Description |
|---|---|---|
remote |
flytekit.remote.remote.FlyteRemote |
|
entity |
typing.Union[flytekit.remote.entities.FlyteWorkflow, flytekit.remote.entities.FlyteTask, flytekit.remote.entities.FlyteLaunchPlan] |
|
project |
str |
|
domain |
str |
|
inputs |
typing.Dict[str, typing.Any] |
|
run_level_params |
flytekit.clis.sdk_in_container.run.RunLevelParams |
|
type_hints |
typing.Optional[typing.Dict[str, typing.Type]] |
to_click_option()
def to_click_option(
ctx: click.core.Context,
flyte_ctx: flytekit.core.context_manager.FlyteContext,
input_name: str,
literal_var: flytekit.models.interface.Variable,
python_type: typing.Type,
default_val: typing.Any,
required: bool,
) -> click.core.OptionThis handles converting workflow input types to supported click parameters with callbacks to initialize the input values to their expected types.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
flyte_ctx |
flytekit.core.context_manager.FlyteContext |
|
input_name |
str |
|
literal_var |
flytekit.models.interface.Variable |
|
python_type |
typing.Type |
|
default_val |
typing.Any |
|
required |
bool |
flytekit.clis.sdk_in_container.run.DynamicEntityLaunchCommand
This is a dynamic command that is created for each launch plan. This is used to execute a launch plan. It will fetch the launch plan from remote and create parameters from all the inputs of the launch plan.
Parameters
class DynamicEntityLaunchCommand(
name: str,
h: str,
entity_name: str,
launcher: str,
kwargs,
)Create Rich Command instance.
| Parameter | Type | Description |
|---|---|---|
name |
str |
|
h |
str |
|
entity_name |
str |
|
launcher |
str |
|
kwargs |
**kwargs |
Properties
| Property | Type | Description |
|---|---|---|
console |
None |
Rich Console. This is a separate instance from the help formatter that allows full control of the console configuration. See rich_config decorator for how to apply the settings. |
help_config |
None |
Rich Help Configuration. |
Methods
| Method | Description |
|---|---|
add_panel() |
Add a RichPanel to the RichCommand. |
collect_usage_pieces() |
Returns all the pieces that go into the usage line and returns. |
format_epilog() |
Writes the epilog into the formatter if it exists. |
format_help() |
Writes the help into the formatter if it exists. |
format_help_text() |
Writes the help text to the formatter if it exists. |
format_options() |
Writes all the options into the formatter if they exist. |
format_usage() |
Writes the usage line into the formatter. |
get_help() |
Formats the help into a string and returns it. |
get_help_option() |
Return the help option object. |
get_help_option_names() |
Returns the names for the help option. |
get_params() |
|
get_rich_table_row() |
Create a row for the rich table corresponding with this parameter. |
get_short_help_str() |
Gets short help for the command or makes it by shortening the. |
get_usage() |
Formats the usage line into a string and returns it. |
invoke() |
Default or None values should be ignored. |
main() |
This is the way to invoke a script with all the bells and. |
make_context() |
This function when given an info name and arguments will kick. |
make_parser() |
Creates the underlying option parser for this command. |
parse_args() |
Given a context and a list of arguments this creates the parser. |
shell_complete() |
Return a list of completions for the incomplete value. |
to_info_dict() |
Gather information that could be useful for a tool generating. |
add_panel()
def add_panel(
panel: 'RichPanel[Any, Any]',
)Add a RichPanel to the RichCommand.
| Parameter | Type | Description |
|---|---|---|
panel |
'RichPanel[Any, Any]' |
collect_usage_pieces()
def collect_usage_pieces(
ctx: click.core.Context,
) -> typing.List[str]Returns all the pieces that go into the usage line and returns it as a list of strings.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
format_epilog()
def format_epilog(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the epilog into the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help()
def format_help(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help into the formatter if it exists.
This is a low-level method called by :meth:get_help.
This calls the following methods:
- :meth:
format_usage - :meth:
format_help_text - :meth:
format_options - :meth:
format_epilog
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help_text()
def format_help_text(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help text to the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_options()
def format_options(
ctx: click.Context,
formatter: click.HelpFormatter,
)Writes all the options into the formatter if they exist.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
|
formatter |
click.HelpFormatter |
format_usage()
def format_usage(
ctx: click.core.Context,
formatter: click.formatting.HelpFormatter,
)Writes the usage line into the formatter.
This is a low-level method called by :meth:get_usage.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
formatter |
click.formatting.HelpFormatter |
get_help()
def get_help(
ctx: click.core.Context,
) -> strFormats the help into a string and returns it.
Calls :meth:format_help internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_help_option()
def get_help_option(
ctx: click.Context,
) -> Union[click.Option, None]Return the help option object.
Skipped if :attr:add_help_option is False.
.. versionchanged:: 8.1.8 The help option is now cached to avoid creating it multiple times.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
get_help_option_names()
def get_help_option_names(
ctx: click.core.Context,
) -> typing.List[str]Returns the names for the help option.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_params()
def get_params(
ctx: click.core.Context,
) -> typing.List[ForwardRef('click.Parameter')]| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_rich_table_row()
def get_rich_table_row(
ctx: 'RichContext',
formatter: 'RichHelpFormatter',
panel: Optional['RichCommandPanel'],
) -> 'RichPanelRow'Create a row for the rich table corresponding with this parameter.
| Parameter | Type | Description |
|---|---|---|
ctx |
'RichContext' |
|
formatter |
'RichHelpFormatter' |
|
panel |
Optional['RichCommandPanel'] |
get_short_help_str()
def get_short_help_str(
limit: int,
) -> strGets short help for the command or makes it by shortening the long help string.
| Parameter | Type | Description |
|---|---|---|
limit |
int |
get_usage()
def get_usage(
ctx: click.core.Context,
) -> strFormats the usage line into a string and returns it.
Calls :meth:format_usage internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
invoke()
def invoke(
ctx: click.core.Context,
) -> typing.AnyDefault or None values should be ignored. Only values that are provided by the user should be passed to the remote execution.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
main()
def main(
args: *args,
prog_name: Optional[str],
complete_var: Optional[str],
standalone_mode: bool,
windows_expand_args: bool,
extra: Any,
) -> AnyThis is the way to invoke a script with all the bells and
whistles as a command line application. This will always terminate
the application after a call. If this is not wanted, SystemExit
needs to be caught.
This method is also available by directly calling the instance of
a :class:Command.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
the arguments that should be used for parsing. If not provided, sys.argv[1:] is used. |
prog_name |
Optional[str] |
the program name that should be used. By default the program name is constructed by taking the file name from sys.argv[0]. |
complete_var |
Optional[str] |
the environment variable that controls the bash completion support. The default is "_<prog_name>_COMPLETE" with prog_name in uppercase. |
standalone_mode |
bool |
the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to False they will be propagated to the caller and the return value of this function is the return value of :meth:invoke. |
windows_expand_args |
bool |
Expand glob patterns, user dir, and env vars in command line args on Windows. |
extra |
Any |
extra keyword arguments are forwarded to the context constructor. See :class:Context for more information. .. versionchanged:: 8.0.1 Added the windows_expand_args parameter to allow disabling command line arg expansion on Windows. .. versionchanged:: 8.0 When taking arguments from sys.argv on Windows, glob patterns, user dir, and env vars are expanded. .. versionchanged:: 3.0 Added the standalone_mode parameter. |
make_context()
def make_context(
info_name: typing.Optional[str],
args: *args,
parent: typing.Optional[click.core.Context],
extra: typing.Any,
) -> click.core.ContextThis function when given an info name and arguments will kick
off the parsing and create a new :class:Context. It does not
invoke the actual command callback though.
To quickly customize the context class used without overriding
this method, set the :attr:context_class attribute.
| Parameter | Type | Description |
|---|---|---|
info_name |
typing.Optional[str] |
the info name for this invocation. Generally this is the most descriptive name for the script or command. For the toplevel script it’s usually the name of the script, for commands below it’s the name of the command. |
args |
*args |
the arguments to parse as list of strings. |
parent |
typing.Optional[click.core.Context] |
the parent context if available. |
extra |
typing.Any |
extra keyword arguments forwarded to the context constructor. .. versionchanged:: 8.0 Added the :attr:context_class attribute. |
make_parser()
def make_parser(
ctx: click.core.Context,
) -> click.parser.OptionParserCreates the underlying option parser for this command.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
parse_args()
def parse_args(
ctx: click.core.Context,
args: *args,
) -> typing.List[str]Given a context and a list of arguments this creates the parser
and parses the arguments, then modifies the context as necessary.
This is automatically invoked by :meth:make_context.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
args |
*args |
shell_complete()
def shell_complete(
ctx: click.core.Context,
incomplete: str,
) -> typing.List[ForwardRef('CompletionItem')]Return a list of completions for the incomplete value. Looks at the names of options and chained multi-commands.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
Invocation context for this command. |
incomplete |
str |
Value being completed. May be empty. .. versionadded:: 8.0 |
to_info_dict()
def to_info_dict(
ctx: click.Context,
) -> Dict[str, Any]Gather information that could be useful for a tool generating user-facing documentation. This traverses the entire structure below this command.
Use :meth:click.Context.to_info_dict to traverse the entire
CLI structure.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
A .. versionadded:: 8.0 |
flytekit.clis.sdk_in_container.run.Entities
NamedTuple to group all entities in a file
Methods
| Method | Description |
|---|---|
all() |
|
matching_lp() |
Returns the variable name of the launch plan in the file. |
all()
def all()matching_lp()
def matching_lp(
lp_name: str,
) -> typing.Optional[str]Returns the variable name of the launch plan in the file
| Parameter | Type | Description |
|---|---|---|
lp_name |
str |
flytekit.clis.sdk_in_container.run.RemoteEntityGroup
click multicommand that retrieves launchplans from a remote flyte instance and executes them.
Parameters
class RemoteEntityGroup(
command_name: str,
)Create RichGroup instance.
| Parameter | Type | Description |
|---|---|---|
command_name |
str |
Properties
| Property | Type | Description |
|---|---|---|
console |
None |
Rich Console. This is a separate instance from the help formatter that allows full control of the console configuration. See rich_config decorator for how to apply the settings. |
help_config |
None |
Rich Help Configuration. |
Methods
| Method | Description |
|---|---|
add_command() |
Register another :class:Command with this group. |
add_command_to_panel() |
|
add_panel() |
Add a RichPanel to the RichCommand. |
collect_usage_pieces() |
Returns all the pieces that go into the usage line and returns. |
command() |
A shortcut decorator for declaring and attaching a command to. |
format_commands() |
Extra format methods for multi methods that adds all the commands. |
format_epilog() |
Writes the epilog into the formatter if it exists. |
format_help() |
Writes the help into the formatter if it exists. |
format_help_text() |
Writes the help text to the formatter if it exists. |
format_options() |
Writes all the options into the formatter if they exist. |
format_usage() |
Writes the usage line into the formatter. |
get_command() |
Given a context and a command name, this returns a. |
get_help() |
Formats the help into a string and returns it. |
get_help_option() |
Return the help option object. |
get_help_option_names() |
Returns the names for the help option. |
get_params() |
|
get_rich_table_row() |
Create a row for the rich table corresponding with this parameter. |
get_short_help_str() |
Gets short help for the command or makes it by shortening the. |
get_usage() |
Formats the usage line into a string and returns it. |
group() |
A shortcut decorator for declaring and attaching a group to. |
invoke() |
Given a context, this invokes the attached callback (if it exists). |
list_commands() |
Returns a list of subcommand names in the order they should. |
main() |
This is the way to invoke a script with all the bells and. |
make_context() |
This function when given an info name and arguments will kick. |
make_parser() |
Creates the underlying option parser for this command. |
parse_args() |
Given a context and a list of arguments this creates the parser. |
resolve_command() |
|
result_callback() |
Adds a result callback to the command. |
shell_complete() |
Return a list of completions for the incomplete value. |
to_info_dict() |
Gather information that could be useful for a tool generating. |
add_command()
def add_command(
cmd: click.Command,
name: Optional[str],
aliases: Optional[Iterable[str]],
panel: Optional[Union[str, List[str]]],
)Register another :class:Command with this group. If the name
is not provided, the name of the command is used.
| Parameter | Type | Description |
|---|---|---|
cmd |
click.Command |
|
name |
Optional[str] |
|
aliases |
Optional[Iterable[str]] |
|
panel |
Optional[Union[str, List[str]]] |
add_command_to_panel()
def add_command_to_panel(
command: click.Command,
panel_name: Union[str, Iterable[str]],
)| Parameter | Type | Description |
|---|---|---|
command |
click.Command |
|
panel_name |
Union[str, Iterable[str]] |
add_panel()
def add_panel(
panel: 'RichPanel[Any, Any]',
)Add a RichPanel to the RichCommand.
| Parameter | Type | Description |
|---|---|---|
panel |
'RichPanel[Any, Any]' |
collect_usage_pieces()
def collect_usage_pieces(
ctx: click.core.Context,
) -> typing.List[str]Returns all the pieces that go into the usage line and returns it as a list of strings.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
command()
def command(
args: *args,
kwargs: **kwargs,
) -> Union[Callable[[Callable[..., Any]], RichCommand], RichCommand]A shortcut decorator for declaring and attaching a command to
the group. This takes the same arguments as :func:command and
immediately registers the created command with this group by
calling :meth:add_command.
To customize the command class used, set the
:attr:command_class attribute.
.. versionchanged:: 8.1 This decorator can be applied without parentheses.
.. versionchanged:: 8.0
Added the :attr:command_class attribute.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
|
kwargs |
**kwargs |
format_commands()
def format_commands(
ctx: click.Context,
formatter: click.HelpFormatter,
)Extra format methods for multi methods that adds all the commands after the options.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
|
formatter |
click.HelpFormatter |
format_epilog()
def format_epilog(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the epilog into the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help()
def format_help(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help into the formatter if it exists.
This is a low-level method called by :meth:get_help.
This calls the following methods:
- :meth:
format_usage - :meth:
format_help_text - :meth:
format_options - :meth:
format_epilog
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help_text()
def format_help_text(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help text to the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_options()
def format_options(
ctx: click.Context,
formatter: click.HelpFormatter,
)Writes all the options into the formatter if they exist.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
|
formatter |
click.HelpFormatter |
format_usage()
def format_usage(
ctx: click.core.Context,
formatter: click.formatting.HelpFormatter,
)Writes the usage line into the formatter.
This is a low-level method called by :meth:get_usage.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
formatter |
click.formatting.HelpFormatter |
get_command()
def get_command(
ctx,
name,
)Given a context and a command name, this returns a
:class:Command object if it exists or returns None.
| Parameter | Type | Description |
|---|---|---|
ctx |
||
name |
get_help()
def get_help(
ctx: click.core.Context,
) -> strFormats the help into a string and returns it.
Calls :meth:format_help internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_help_option()
def get_help_option(
ctx: click.Context,
) -> Union[click.Option, None]Return the help option object.
Skipped if :attr:add_help_option is False.
.. versionchanged:: 8.1.8 The help option is now cached to avoid creating it multiple times.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
get_help_option_names()
def get_help_option_names(
ctx: click.core.Context,
) -> typing.List[str]Returns the names for the help option.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_params()
def get_params(
ctx: click.core.Context,
) -> typing.List[ForwardRef('Parameter')]| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_rich_table_row()
def get_rich_table_row(
ctx: 'RichContext',
formatter: 'RichHelpFormatter',
panel: Optional['RichCommandPanel'],
) -> 'RichPanelRow'Create a row for the rich table corresponding with this parameter.
| Parameter | Type | Description |
|---|---|---|
ctx |
'RichContext' |
|
formatter |
'RichHelpFormatter' |
|
panel |
Optional['RichCommandPanel'] |
get_short_help_str()
def get_short_help_str(
limit: int,
) -> strGets short help for the command or makes it by shortening the long help string.
| Parameter | Type | Description |
|---|---|---|
limit |
int |
get_usage()
def get_usage(
ctx: click.core.Context,
) -> strFormats the usage line into a string and returns it.
Calls :meth:format_usage internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
group()
def group(
args: *args,
kwargs: **kwargs,
) -> Union[Callable[[Callable[..., Any]], 'RichGroup'], 'RichGroup']A shortcut decorator for declaring and attaching a group to
the group. This takes the same arguments as :func:group and
immediately registers the created group with this group by
calling :meth:add_command.
To customize the group class used, set the :attr:group_class
attribute.
.. versionchanged:: 8.1 This decorator can be applied without parentheses.
.. versionchanged:: 8.0
Added the :attr:group_class attribute.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
|
kwargs |
**kwargs |
invoke()
def invoke(
ctx: click.core.Context,
) -> typing.AnyGiven a context, this invokes the attached callback (if it exists) in the right way.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
list_commands()
def list_commands(
ctx,
)Returns a list of subcommand names in the order they should appear.
| Parameter | Type | Description |
|---|---|---|
ctx |
main()
def main(
args: *args,
prog_name: Optional[str],
complete_var: Optional[str],
standalone_mode: bool,
windows_expand_args: bool,
extra: Any,
) -> AnyThis is the way to invoke a script with all the bells and
whistles as a command line application. This will always terminate
the application after a call. If this is not wanted, SystemExit
needs to be caught.
This method is also available by directly calling the instance of
a :class:Command.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
the arguments that should be used for parsing. If not provided, sys.argv[1:] is used. |
prog_name |
Optional[str] |
the program name that should be used. By default the program name is constructed by taking the file name from sys.argv[0]. |
complete_var |
Optional[str] |
the environment variable that controls the bash completion support. The default is "_<prog_name>_COMPLETE" with prog_name in uppercase. |
standalone_mode |
bool |
the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to False they will be propagated to the caller and the return value of this function is the return value of :meth:invoke. |
windows_expand_args |
bool |
Expand glob patterns, user dir, and env vars in command line args on Windows. |
extra |
Any |
extra keyword arguments are forwarded to the context constructor. See :class:Context for more information. .. versionchanged:: 8.0.1 Added the windows_expand_args parameter to allow disabling command line arg expansion on Windows. .. versionchanged:: 8.0 When taking arguments from sys.argv on Windows, glob patterns, user dir, and env vars are expanded. .. versionchanged:: 3.0 Added the standalone_mode parameter. |
make_context()
def make_context(
info_name: typing.Optional[str],
args: *args,
parent: typing.Optional[click.core.Context],
extra: typing.Any,
) -> click.core.ContextThis function when given an info name and arguments will kick
off the parsing and create a new :class:Context. It does not
invoke the actual command callback though.
To quickly customize the context class used without overriding
this method, set the :attr:context_class attribute.
| Parameter | Type | Description |
|---|---|---|
info_name |
typing.Optional[str] |
the info name for this invocation. Generally this is the most descriptive name for the script or command. For the toplevel script it’s usually the name of the script, for commands below it’s the name of the command. |
args |
*args |
the arguments to parse as list of strings. |
parent |
typing.Optional[click.core.Context] |
the parent context if available. |
extra |
typing.Any |
extra keyword arguments forwarded to the context constructor. .. versionchanged:: 8.0 Added the :attr:context_class attribute. |
make_parser()
def make_parser(
ctx: click.core.Context,
) -> click.parser.OptionParserCreates the underlying option parser for this command.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
parse_args()
def parse_args(
ctx: click.core.Context,
args: *args,
) -> typing.List[str]Given a context and a list of arguments this creates the parser
and parses the arguments, then modifies the context as necessary.
This is automatically invoked by :meth:make_context.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
args |
*args |
resolve_command()
def resolve_command(
ctx: click.core.Context,
args: *args,
) -> typing.Tuple[typing.Optional[str], typing.Optional[click.core.Command], typing.List[str]]| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
args |
*args |
result_callback()
def result_callback(
replace: bool,
) -> typing.Callable[[~F], ~F]Adds a result callback to the command. By default if a
result callback is already registered this will chain them but
this can be disabled with the replace parameter. The result
callback is invoked with the return value of the subcommand
(or the list of return values from all subcommands if chaining
is enabled) as well as the parameters as they would be passed
to the main callback.
| Parameter | Type | Description |
|---|---|---|
replace |
bool |
if set to True an already existing result callback will be removed. .. versionchanged:: 8.0 Renamed from resultcallback. .. versionadded:: 3.0 |
shell_complete()
def shell_complete(
ctx: click.core.Context,
incomplete: str,
) -> typing.List[ForwardRef('CompletionItem')]Return a list of completions for the incomplete value. Looks at the names of options, subcommands, and chained multi-commands.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
Invocation context for this command. |
incomplete |
str |
Value being completed. May be empty. .. versionadded:: 8.0 |
to_info_dict()
def to_info_dict(
ctx: click.Context,
) -> Dict[str, Any]Gather information that could be useful for a tool generating user-facing documentation. This traverses the entire structure below this command.
Use :meth:click.Context.to_info_dict to traverse the entire
CLI structure.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
A .. versionadded:: 8.0 |
flytekit.clis.sdk_in_container.run.RunCommand
A click command group for registering and executing flyte workflows & tasks in a file.
Parameters
class RunCommand(
args,
kwargs,
)Create RichGroup instance.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
|
kwargs |
**kwargs |
Properties
| Property | Type | Description |
|---|---|---|
console |
None |
Rich Console. This is a separate instance from the help formatter that allows full control of the console configuration. See rich_config decorator for how to apply the settings. |
help_config |
None |
Rich Help Configuration. |
Methods
| Method | Description |
|---|---|
add_command() |
Register another :class:Command with this group. |
add_command_to_panel() |
|
add_panel() |
Add a RichPanel to the RichCommand. |
collect_usage_pieces() |
Returns all the pieces that go into the usage line and returns. |
command() |
A shortcut decorator for declaring and attaching a command to. |
format_commands() |
Extra format methods for multi methods that adds all the commands. |
format_epilog() |
Writes the epilog into the formatter if it exists. |
format_help() |
Writes the help into the formatter if it exists. |
format_help_text() |
Writes the help text to the formatter if it exists. |
format_options() |
Writes all the options into the formatter if they exist. |
format_usage() |
Writes the usage line into the formatter. |
get_command() |
Given a context and a command name, this returns a. |
get_help() |
Formats the help into a string and returns it. |
get_help_option() |
Return the help option object. |
get_help_option_names() |
Returns the names for the help option. |
get_params() |
|
get_rich_table_row() |
Create a row for the rich table corresponding with this parameter. |
get_short_help_str() |
Gets short help for the command or makes it by shortening the. |
get_usage() |
Formats the usage line into a string and returns it. |
group() |
A shortcut decorator for declaring and attaching a group to. |
invoke() |
Given a context, this invokes the attached callback (if it exists). |
list_commands() |
Returns a list of subcommand names in the order they should. |
main() |
This is the way to invoke a script with all the bells and. |
make_context() |
This function when given an info name and arguments will kick. |
make_parser() |
Creates the underlying option parser for this command. |
parse_args() |
Given a context and a list of arguments this creates the parser. |
resolve_command() |
|
result_callback() |
Adds a result callback to the command. |
shell_complete() |
Return a list of completions for the incomplete value. |
to_info_dict() |
Gather information that could be useful for a tool generating. |
add_command()
def add_command(
cmd: click.Command,
name: Optional[str],
aliases: Optional[Iterable[str]],
panel: Optional[Union[str, List[str]]],
)Register another :class:Command with this group. If the name
is not provided, the name of the command is used.
| Parameter | Type | Description |
|---|---|---|
cmd |
click.Command |
|
name |
Optional[str] |
|
aliases |
Optional[Iterable[str]] |
|
panel |
Optional[Union[str, List[str]]] |
add_command_to_panel()
def add_command_to_panel(
command: click.Command,
panel_name: Union[str, Iterable[str]],
)| Parameter | Type | Description |
|---|---|---|
command |
click.Command |
|
panel_name |
Union[str, Iterable[str]] |
add_panel()
def add_panel(
panel: 'RichPanel[Any, Any]',
)Add a RichPanel to the RichCommand.
| Parameter | Type | Description |
|---|---|---|
panel |
'RichPanel[Any, Any]' |
collect_usage_pieces()
def collect_usage_pieces(
ctx: click.core.Context,
) -> typing.List[str]Returns all the pieces that go into the usage line and returns it as a list of strings.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
command()
def command(
args: *args,
kwargs: **kwargs,
) -> Union[Callable[[Callable[..., Any]], RichCommand], RichCommand]A shortcut decorator for declaring and attaching a command to
the group. This takes the same arguments as :func:command and
immediately registers the created command with this group by
calling :meth:add_command.
To customize the command class used, set the
:attr:command_class attribute.
.. versionchanged:: 8.1 This decorator can be applied without parentheses.
.. versionchanged:: 8.0
Added the :attr:command_class attribute.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
|
kwargs |
**kwargs |
format_commands()
def format_commands(
ctx: click.Context,
formatter: click.HelpFormatter,
)Extra format methods for multi methods that adds all the commands after the options.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
|
formatter |
click.HelpFormatter |
format_epilog()
def format_epilog(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the epilog into the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help()
def format_help(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help into the formatter if it exists.
This is a low-level method called by :meth:get_help.
This calls the following methods:
- :meth:
format_usage - :meth:
format_help_text - :meth:
format_options - :meth:
format_epilog
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help_text()
def format_help_text(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help text to the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_options()
def format_options(
ctx: click.Context,
formatter: click.HelpFormatter,
)Writes all the options into the formatter if they exist.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
|
formatter |
click.HelpFormatter |
format_usage()
def format_usage(
ctx: click.core.Context,
formatter: click.formatting.HelpFormatter,
)Writes the usage line into the formatter.
This is a low-level method called by :meth:get_usage.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
formatter |
click.formatting.HelpFormatter |
get_command()
def get_command(
ctx,
filename,
)Given a context and a command name, this returns a
:class:Command object if it exists or returns None.
| Parameter | Type | Description |
|---|---|---|
ctx |
||
filename |
get_help()
def get_help(
ctx: click.core.Context,
) -> strFormats the help into a string and returns it.
Calls :meth:format_help internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_help_option()
def get_help_option(
ctx: click.Context,
) -> Union[click.Option, None]Return the help option object.
Skipped if :attr:add_help_option is False.
.. versionchanged:: 8.1.8 The help option is now cached to avoid creating it multiple times.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
get_help_option_names()
def get_help_option_names(
ctx: click.core.Context,
) -> typing.List[str]Returns the names for the help option.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_params()
def get_params(
ctx: click.core.Context,
) -> typing.List[ForwardRef('Parameter')]| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_rich_table_row()
def get_rich_table_row(
ctx: 'RichContext',
formatter: 'RichHelpFormatter',
panel: Optional['RichCommandPanel'],
) -> 'RichPanelRow'Create a row for the rich table corresponding with this parameter.
| Parameter | Type | Description |
|---|---|---|
ctx |
'RichContext' |
|
formatter |
'RichHelpFormatter' |
|
panel |
Optional['RichCommandPanel'] |
get_short_help_str()
def get_short_help_str(
limit: int,
) -> strGets short help for the command or makes it by shortening the long help string.
| Parameter | Type | Description |
|---|---|---|
limit |
int |
get_usage()
def get_usage(
ctx: click.core.Context,
) -> strFormats the usage line into a string and returns it.
Calls :meth:format_usage internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
group()
def group(
args: *args,
kwargs: **kwargs,
) -> Union[Callable[[Callable[..., Any]], 'RichGroup'], 'RichGroup']A shortcut decorator for declaring and attaching a group to
the group. This takes the same arguments as :func:group and
immediately registers the created group with this group by
calling :meth:add_command.
To customize the group class used, set the :attr:group_class
attribute.
.. versionchanged:: 8.1 This decorator can be applied without parentheses.
.. versionchanged:: 8.0
Added the :attr:group_class attribute.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
|
kwargs |
**kwargs |
invoke()
def invoke(
ctx: click.core.Context,
) -> typing.AnyGiven a context, this invokes the attached callback (if it exists) in the right way.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
list_commands()
def list_commands(
ctx,
add_remote: bool,
)Returns a list of subcommand names in the order they should appear.
| Parameter | Type | Description |
|---|---|---|
ctx |
||
add_remote |
bool |
main()
def main(
args: *args,
prog_name: Optional[str],
complete_var: Optional[str],
standalone_mode: bool,
windows_expand_args: bool,
extra: Any,
) -> AnyThis is the way to invoke a script with all the bells and
whistles as a command line application. This will always terminate
the application after a call. If this is not wanted, SystemExit
needs to be caught.
This method is also available by directly calling the instance of
a :class:Command.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
the arguments that should be used for parsing. If not provided, sys.argv[1:] is used. |
prog_name |
Optional[str] |
the program name that should be used. By default the program name is constructed by taking the file name from sys.argv[0]. |
complete_var |
Optional[str] |
the environment variable that controls the bash completion support. The default is "_<prog_name>_COMPLETE" with prog_name in uppercase. |
standalone_mode |
bool |
the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to False they will be propagated to the caller and the return value of this function is the return value of :meth:invoke. |
windows_expand_args |
bool |
Expand glob patterns, user dir, and env vars in command line args on Windows. |
extra |
Any |
extra keyword arguments are forwarded to the context constructor. See :class:Context for more information. .. versionchanged:: 8.0.1 Added the windows_expand_args parameter to allow disabling command line arg expansion on Windows. .. versionchanged:: 8.0 When taking arguments from sys.argv on Windows, glob patterns, user dir, and env vars are expanded. .. versionchanged:: 3.0 Added the standalone_mode parameter. |
make_context()
def make_context(
info_name: typing.Optional[str],
args: *args,
parent: typing.Optional[click.core.Context],
extra: typing.Any,
) -> click.core.ContextThis function when given an info name and arguments will kick
off the parsing and create a new :class:Context. It does not
invoke the actual command callback though.
To quickly customize the context class used without overriding
this method, set the :attr:context_class attribute.
| Parameter | Type | Description |
|---|---|---|
info_name |
typing.Optional[str] |
the info name for this invocation. Generally this is the most descriptive name for the script or command. For the toplevel script it’s usually the name of the script, for commands below it’s the name of the command. |
args |
*args |
the arguments to parse as list of strings. |
parent |
typing.Optional[click.core.Context] |
the parent context if available. |
extra |
typing.Any |
extra keyword arguments forwarded to the context constructor. .. versionchanged:: 8.0 Added the :attr:context_class attribute. |
make_parser()
def make_parser(
ctx: click.core.Context,
) -> click.parser.OptionParserCreates the underlying option parser for this command.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
parse_args()
def parse_args(
ctx: click.core.Context,
args: *args,
) -> typing.List[str]Given a context and a list of arguments this creates the parser
and parses the arguments, then modifies the context as necessary.
This is automatically invoked by :meth:make_context.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
args |
*args |
resolve_command()
def resolve_command(
ctx: click.core.Context,
args: *args,
) -> typing.Tuple[typing.Optional[str], typing.Optional[click.core.Command], typing.List[str]]| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
args |
*args |
result_callback()
def result_callback(
replace: bool,
) -> typing.Callable[[~F], ~F]Adds a result callback to the command. By default if a
result callback is already registered this will chain them but
this can be disabled with the replace parameter. The result
callback is invoked with the return value of the subcommand
(or the list of return values from all subcommands if chaining
is enabled) as well as the parameters as they would be passed
to the main callback.
| Parameter | Type | Description |
|---|---|---|
replace |
bool |
if set to True an already existing result callback will be removed. .. versionchanged:: 8.0 Renamed from resultcallback. .. versionadded:: 3.0 |
shell_complete()
def shell_complete(
ctx: click.core.Context,
incomplete: str,
) -> typing.List[ForwardRef('CompletionItem')]Return a list of completions for the incomplete value. Looks at the names of options, subcommands, and chained multi-commands.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
Invocation context for this command. |
incomplete |
str |
Value being completed. May be empty. .. versionadded:: 8.0 |
to_info_dict()
def to_info_dict(
ctx: click.Context,
) -> Dict[str, Any]Gather information that could be useful for a tool generating user-facing documentation. This traverses the entire structure below this command.
Use :meth:click.Context.to_info_dict to traverse the entire
CLI structure.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
A .. versionadded:: 8.0 |
flytekit.clis.sdk_in_container.run.RunLevelComputedParams
This class is used to store the computed parameters that are used to run a workflow / task / launchplan. Computed parameters are created during the execution
Parameters
class RunLevelComputedParams(
project_root: typing.Optional[str],
module: typing.Optional[str],
temp_file_name: typing.Optional[str],
)| Parameter | Type | Description |
|---|---|---|
project_root |
typing.Optional[str] |
|
module |
typing.Optional[str] |
|
temp_file_name |
typing.Optional[str] |
flytekit.clis.sdk_in_container.run.RunLevelParams
This class is used to store the parameters that are used to run a workflow / task / launchplan.
Parameters
class RunLevelParams(
config_file: typing.Optional[str],
verbose: bool,
pkgs: typing.List[str],
project: str,
domain: str,
destination_dir: str,
copy_all: bool,
copy: typing.Optional[flytekit.constants.CopyFileDetection],
image_config: flytekit.configuration.ImageConfig,
service_account: str,
wait_execution: bool,
poll_interval: int,
dump_snippet: bool,
overwrite_cache: bool,
interruptible: typing.Optional[bool],
envvars: typing.Dict[str, str],
resource_requests: typing.Optional[flytekit.core.resources.Resources],
resource_limits: typing.Optional[flytekit.core.resources.Resources],
tags: typing.List[str],
name: str,
labels: typing.Dict[str, str],
annotations: typing.Dict[str, str],
raw_output_data_prefix: str,
max_parallelism: int,
disable_notifications: bool,
remote: bool,
limit: int,
cluster_pool: str,
execution_cluster_label: str,
computed_params: flytekit.clis.sdk_in_container.run.RunLevelComputedParams,
_remote: typing.Optional[flytekit.remote.remote.FlyteRemote],
)| Parameter | Type | Description |
|---|---|---|
config_file |
typing.Optional[str] |
|
verbose |
bool |
|
pkgs |
typing.List[str] |
|
project |
str |
|
domain |
str |
|
destination_dir |
str |
|
copy_all |
bool |
|
copy |
typing.Optional[flytekit.constants.CopyFileDetection] |
|
image_config |
flytekit.configuration.ImageConfig |
|
service_account |
str |
|
wait_execution |
bool |
|
poll_interval |
int |
|
dump_snippet |
bool |
|
overwrite_cache |
bool |
|
interruptible |
typing.Optional[bool] |
|
envvars |
typing.Dict[str, str] |
|
resource_requests |
typing.Optional[flytekit.core.resources.Resources] |
|
resource_limits |
typing.Optional[flytekit.core.resources.Resources] |
|
tags |
typing.List[str] |
|
name |
str |
|
labels |
typing.Dict[str, str] |
|
annotations |
typing.Dict[str, str] |
|
raw_output_data_prefix |
str |
|
max_parallelism |
int |
|
disable_notifications |
bool |
|
remote |
bool |
|
limit |
int |
|
cluster_pool |
str |
|
execution_cluster_label |
str |
|
computed_params |
flytekit.clis.sdk_in_container.run.RunLevelComputedParams |
|
_remote |
typing.Optional[flytekit.remote.remote.FlyteRemote] |
Properties
| Property | Type | Description |
|---|---|---|
is_remote |
None |
Methods
| Method | Description |
|---|---|
from_dict() |
|
options() |
Return the set of base parameters added to every pyflyte run workflow subcommand. |
remote_instance() |
from_dict()
def from_dict(
d: typing.Dict[str, typing.Any],
) -> RunLevelParams| Parameter | Type | Description |
|---|---|---|
d |
typing.Dict[str, typing.Any] |
options()
def options()Return the set of base parameters added to every pyflyte run workflow subcommand.
remote_instance()
def remote_instance()flytekit.clis.sdk_in_container.run.WorkflowCommand
click multicommand at the python file layer, subcommands should be all the workflows in the file.
Parameters
class WorkflowCommand(
filename: str,
args,
kwargs,
)Create RichGroup instance.
| Parameter | Type | Description |
|---|---|---|
filename |
str |
|
args |
*args |
|
kwargs |
**kwargs |
Properties
| Property | Type | Description |
|---|---|---|
console |
None |
Rich Console. This is a separate instance from the help formatter that allows full control of the console configuration. See rich_config decorator for how to apply the settings. |
help_config |
None |
Rich Help Configuration. |
Methods
| Method | Description |
|---|---|
add_command() |
Register another :class:Command with this group. |
add_command_to_panel() |
|
add_panel() |
Add a RichPanel to the RichCommand. |
collect_usage_pieces() |
Returns all the pieces that go into the usage line and returns. |
command() |
A shortcut decorator for declaring and attaching a command to. |
format_commands() |
Extra format methods for multi methods that adds all the commands. |
format_epilog() |
Writes the epilog into the formatter if it exists. |
format_help() |
Writes the help into the formatter if it exists. |
format_help_text() |
Writes the help text to the formatter if it exists. |
format_options() |
Writes all the options into the formatter if they exist. |
format_usage() |
Writes the usage line into the formatter. |
get_command() |
This command uses the filename with which this command was created, and the string name of the entity passed. |
get_help() |
Formats the help into a string and returns it. |
get_help_option() |
Return the help option object. |
get_help_option_names() |
Returns the names for the help option. |
get_params() |
|
get_rich_table_row() |
Create a row for the rich table corresponding with this parameter. |
get_short_help_str() |
Gets short help for the command or makes it by shortening the. |
get_usage() |
Formats the usage line into a string and returns it. |
group() |
A shortcut decorator for declaring and attaching a group to. |
invoke() |
Given a context, this invokes the attached callback (if it exists). |
list_commands() |
Returns a list of subcommand names in the order they should. |
main() |
This is the way to invoke a script with all the bells and. |
make_context() |
This function when given an info name and arguments will kick. |
make_parser() |
Creates the underlying option parser for this command. |
parse_args() |
Given a context and a list of arguments this creates the parser. |
resolve_command() |
|
result_callback() |
Adds a result callback to the command. |
shell_complete() |
Return a list of completions for the incomplete value. |
to_info_dict() |
Gather information that could be useful for a tool generating. |
add_command()
def add_command(
cmd: click.Command,
name: Optional[str],
aliases: Optional[Iterable[str]],
panel: Optional[Union[str, List[str]]],
)Register another :class:Command with this group. If the name
is not provided, the name of the command is used.
| Parameter | Type | Description |
|---|---|---|
cmd |
click.Command |
|
name |
Optional[str] |
|
aliases |
Optional[Iterable[str]] |
|
panel |
Optional[Union[str, List[str]]] |
add_command_to_panel()
def add_command_to_panel(
command: click.Command,
panel_name: Union[str, Iterable[str]],
)| Parameter | Type | Description |
|---|---|---|
command |
click.Command |
|
panel_name |
Union[str, Iterable[str]] |
add_panel()
def add_panel(
panel: 'RichPanel[Any, Any]',
)Add a RichPanel to the RichCommand.
| Parameter | Type | Description |
|---|---|---|
panel |
'RichPanel[Any, Any]' |
collect_usage_pieces()
def collect_usage_pieces(
ctx: click.core.Context,
) -> typing.List[str]Returns all the pieces that go into the usage line and returns it as a list of strings.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
command()
def command(
args: *args,
kwargs: **kwargs,
) -> Union[Callable[[Callable[..., Any]], RichCommand], RichCommand]A shortcut decorator for declaring and attaching a command to
the group. This takes the same arguments as :func:command and
immediately registers the created command with this group by
calling :meth:add_command.
To customize the command class used, set the
:attr:command_class attribute.
.. versionchanged:: 8.1 This decorator can be applied without parentheses.
.. versionchanged:: 8.0
Added the :attr:command_class attribute.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
|
kwargs |
**kwargs |
format_commands()
def format_commands(
ctx: click.Context,
formatter: click.HelpFormatter,
)Extra format methods for multi methods that adds all the commands after the options.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
|
formatter |
click.HelpFormatter |
format_epilog()
def format_epilog(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the epilog into the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help()
def format_help(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help into the formatter if it exists.
This is a low-level method called by :meth:get_help.
This calls the following methods:
- :meth:
format_usage - :meth:
format_help_text - :meth:
format_options - :meth:
format_epilog
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help_text()
def format_help_text(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help text to the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_options()
def format_options(
ctx: click.Context,
formatter: click.HelpFormatter,
)Writes all the options into the formatter if they exist.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
|
formatter |
click.HelpFormatter |
format_usage()
def format_usage(
ctx: click.core.Context,
formatter: click.formatting.HelpFormatter,
)Writes the usage line into the formatter.
This is a low-level method called by :meth:get_usage.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
formatter |
click.formatting.HelpFormatter |
get_command()
def get_command(
ctx,
exe_entity,
)This command uses the filename with which this command was created, and the string name of the entity passed after the Python filename on the command line, to load the Python object, and then return the Command that click should run.
| Parameter | Type | Description |
|---|---|---|
ctx |
The click Context object. | |
exe_entity |
string of the flyte entity provided by the user. Should be the name of a workflow, or task function. |
get_help()
def get_help(
ctx: click.core.Context,
) -> strFormats the help into a string and returns it.
Calls :meth:format_help internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_help_option()
def get_help_option(
ctx: click.Context,
) -> Union[click.Option, None]Return the help option object.
Skipped if :attr:add_help_option is False.
.. versionchanged:: 8.1.8 The help option is now cached to avoid creating it multiple times.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
get_help_option_names()
def get_help_option_names(
ctx: click.core.Context,
) -> typing.List[str]Returns the names for the help option.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_params()
def get_params(
ctx: click.core.Context,
) -> typing.List[ForwardRef('Parameter')]| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_rich_table_row()
def get_rich_table_row(
ctx: 'RichContext',
formatter: 'RichHelpFormatter',
panel: Optional['RichCommandPanel'],
) -> 'RichPanelRow'Create a row for the rich table corresponding with this parameter.
| Parameter | Type | Description |
|---|---|---|
ctx |
'RichContext' |
|
formatter |
'RichHelpFormatter' |
|
panel |
Optional['RichCommandPanel'] |
get_short_help_str()
def get_short_help_str(
limit: int,
) -> strGets short help for the command or makes it by shortening the long help string.
| Parameter | Type | Description |
|---|---|---|
limit |
int |
get_usage()
def get_usage(
ctx: click.core.Context,
) -> strFormats the usage line into a string and returns it.
Calls :meth:format_usage internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
group()
def group(
args: *args,
kwargs: **kwargs,
) -> Union[Callable[[Callable[..., Any]], 'RichGroup'], 'RichGroup']A shortcut decorator for declaring and attaching a group to
the group. This takes the same arguments as :func:group and
immediately registers the created group with this group by
calling :meth:add_command.
To customize the group class used, set the :attr:group_class
attribute.
.. versionchanged:: 8.1 This decorator can be applied without parentheses.
.. versionchanged:: 8.0
Added the :attr:group_class attribute.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
|
kwargs |
**kwargs |
invoke()
def invoke(
ctx: click.core.Context,
) -> typing.AnyGiven a context, this invokes the attached callback (if it exists) in the right way.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
list_commands()
def list_commands(
ctx,
)Returns a list of subcommand names in the order they should appear.
| Parameter | Type | Description |
|---|---|---|
ctx |
main()
def main(
args: *args,
prog_name: Optional[str],
complete_var: Optional[str],
standalone_mode: bool,
windows_expand_args: bool,
extra: Any,
) -> AnyThis is the way to invoke a script with all the bells and
whistles as a command line application. This will always terminate
the application after a call. If this is not wanted, SystemExit
needs to be caught.
This method is also available by directly calling the instance of
a :class:Command.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
the arguments that should be used for parsing. If not provided, sys.argv[1:] is used. |
prog_name |
Optional[str] |
the program name that should be used. By default the program name is constructed by taking the file name from sys.argv[0]. |
complete_var |
Optional[str] |
the environment variable that controls the bash completion support. The default is "_<prog_name>_COMPLETE" with prog_name in uppercase. |
standalone_mode |
bool |
the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to False they will be propagated to the caller and the return value of this function is the return value of :meth:invoke. |
windows_expand_args |
bool |
Expand glob patterns, user dir, and env vars in command line args on Windows. |
extra |
Any |
extra keyword arguments are forwarded to the context constructor. See :class:Context for more information. .. versionchanged:: 8.0.1 Added the windows_expand_args parameter to allow disabling command line arg expansion on Windows. .. versionchanged:: 8.0 When taking arguments from sys.argv on Windows, glob patterns, user dir, and env vars are expanded. .. versionchanged:: 3.0 Added the standalone_mode parameter. |
make_context()
def make_context(
info_name: typing.Optional[str],
args: *args,
parent: typing.Optional[click.core.Context],
extra: typing.Any,
) -> click.core.ContextThis function when given an info name and arguments will kick
off the parsing and create a new :class:Context. It does not
invoke the actual command callback though.
To quickly customize the context class used without overriding
this method, set the :attr:context_class attribute.
| Parameter | Type | Description |
|---|---|---|
info_name |
typing.Optional[str] |
the info name for this invocation. Generally this is the most descriptive name for the script or command. For the toplevel script it’s usually the name of the script, for commands below it’s the name of the command. |
args |
*args |
the arguments to parse as list of strings. |
parent |
typing.Optional[click.core.Context] |
the parent context if available. |
extra |
typing.Any |
extra keyword arguments forwarded to the context constructor. .. versionchanged:: 8.0 Added the :attr:context_class attribute. |
make_parser()
def make_parser(
ctx: click.core.Context,
) -> click.parser.OptionParserCreates the underlying option parser for this command.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
parse_args()
def parse_args(
ctx: click.core.Context,
args: *args,
) -> typing.List[str]Given a context and a list of arguments this creates the parser
and parses the arguments, then modifies the context as necessary.
This is automatically invoked by :meth:make_context.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
args |
*args |
resolve_command()
def resolve_command(
ctx: click.core.Context,
args: *args,
) -> typing.Tuple[typing.Optional[str], typing.Optional[click.core.Command], typing.List[str]]| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
args |
*args |
result_callback()
def result_callback(
replace: bool,
) -> typing.Callable[[~F], ~F]Adds a result callback to the command. By default if a
result callback is already registered this will chain them but
this can be disabled with the replace parameter. The result
callback is invoked with the return value of the subcommand
(or the list of return values from all subcommands if chaining
is enabled) as well as the parameters as they would be passed
to the main callback.
| Parameter | Type | Description |
|---|---|---|
replace |
bool |
if set to True an already existing result callback will be removed. .. versionchanged:: 8.0 Renamed from resultcallback. .. versionadded:: 3.0 |
shell_complete()
def shell_complete(
ctx: click.core.Context,
incomplete: str,
) -> typing.List[ForwardRef('CompletionItem')]Return a list of completions for the incomplete value. Looks at the names of options, subcommands, and chained multi-commands.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
Invocation context for this command. |
incomplete |
str |
Value being completed. May be empty. .. versionadded:: 8.0 |
to_info_dict()
def to_info_dict(
ctx: click.Context,
) -> Dict[str, Any]Gather information that could be useful for a tool generating user-facing documentation. This traverses the entire structure below this command.
Use :meth:click.Context.to_info_dict to traverse the entire
CLI structure.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
A .. versionadded:: 8.0 |
flytekit.clis.sdk_in_container.run.YamlFileReadingCommand
Parameters
class YamlFileReadingCommand(
name: str,
params: typing.List[click.core.Option],
help: str,
callback: typing.Callable,
)Create Rich Command instance.
| Parameter | Type | Description |
|---|---|---|
name |
str |
|
params |
typing.List[click.core.Option] |
|
help |
str |
|
callback |
typing.Callable |
Properties
| Property | Type | Description |
|---|---|---|
console |
None |
Rich Console. This is a separate instance from the help formatter that allows full control of the console configuration. See rich_config decorator for how to apply the settings. |
help_config |
None |
Rich Help Configuration. |
Methods
| Method | Description |
|---|---|
add_panel() |
Add a RichPanel to the RichCommand. |
collect_usage_pieces() |
Returns all the pieces that go into the usage line and returns. |
format_epilog() |
Writes the epilog into the formatter if it exists. |
format_help() |
Writes the help into the formatter if it exists. |
format_help_text() |
Writes the help text to the formatter if it exists. |
format_options() |
Writes all the options into the formatter if they exist. |
format_usage() |
Writes the usage line into the formatter. |
get_help() |
Formats the help into a string and returns it. |
get_help_option() |
Return the help option object. |
get_help_option_names() |
Returns the names for the help option. |
get_params() |
|
get_rich_table_row() |
Create a row for the rich table corresponding with this parameter. |
get_short_help_str() |
Gets short help for the command or makes it by shortening the. |
get_usage() |
Formats the usage line into a string and returns it. |
invoke() |
Given a context, this invokes the attached callback (if it exists). |
main() |
This is the way to invoke a script with all the bells and. |
make_context() |
This function when given an info name and arguments will kick. |
make_parser() |
Creates the underlying option parser for this command. |
parse_args() |
Given a context and a list of arguments this creates the parser. |
shell_complete() |
Return a list of completions for the incomplete value. |
to_info_dict() |
Gather information that could be useful for a tool generating. |
add_panel()
def add_panel(
panel: 'RichPanel[Any, Any]',
)Add a RichPanel to the RichCommand.
| Parameter | Type | Description |
|---|---|---|
panel |
'RichPanel[Any, Any]' |
collect_usage_pieces()
def collect_usage_pieces(
ctx: click.core.Context,
) -> typing.List[str]Returns all the pieces that go into the usage line and returns it as a list of strings.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
format_epilog()
def format_epilog(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the epilog into the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help()
def format_help(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help into the formatter if it exists.
This is a low-level method called by :meth:get_help.
This calls the following methods:
- :meth:
format_usage - :meth:
format_help_text - :meth:
format_options - :meth:
format_epilog
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_help_text()
def format_help_text(
ctx: RichContext,
formatter: RichHelpFormatter,
)Writes the help text to the formatter if it exists.
| Parameter | Type | Description |
|---|---|---|
ctx |
RichContext |
|
formatter |
RichHelpFormatter |
format_options()
def format_options(
ctx: click.Context,
formatter: click.HelpFormatter,
)Writes all the options into the formatter if they exist.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
|
formatter |
click.HelpFormatter |
format_usage()
def format_usage(
ctx: click.core.Context,
formatter: click.formatting.HelpFormatter,
)Writes the usage line into the formatter.
This is a low-level method called by :meth:get_usage.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
formatter |
click.formatting.HelpFormatter |
get_help()
def get_help(
ctx: click.core.Context,
) -> strFormats the help into a string and returns it.
Calls :meth:format_help internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_help_option()
def get_help_option(
ctx: click.Context,
) -> Union[click.Option, None]Return the help option object.
Skipped if :attr:add_help_option is False.
.. versionchanged:: 8.1.8 The help option is now cached to avoid creating it multiple times.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
get_help_option_names()
def get_help_option_names(
ctx: click.core.Context,
) -> typing.List[str]Returns the names for the help option.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_params()
def get_params(
ctx: click.core.Context,
) -> typing.List[ForwardRef('Parameter')]| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
get_rich_table_row()
def get_rich_table_row(
ctx: 'RichContext',
formatter: 'RichHelpFormatter',
panel: Optional['RichCommandPanel'],
) -> 'RichPanelRow'Create a row for the rich table corresponding with this parameter.
| Parameter | Type | Description |
|---|---|---|
ctx |
'RichContext' |
|
formatter |
'RichHelpFormatter' |
|
panel |
Optional['RichCommandPanel'] |
get_short_help_str()
def get_short_help_str(
limit: int,
) -> strGets short help for the command or makes it by shortening the long help string.
| Parameter | Type | Description |
|---|---|---|
limit |
int |
get_usage()
def get_usage(
ctx: click.core.Context,
) -> strFormats the usage line into a string and returns it.
Calls :meth:format_usage internally.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
invoke()
def invoke(
ctx: click.core.Context,
) -> typing.AnyGiven a context, this invokes the attached callback (if it exists) in the right way.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
main()
def main(
args: *args,
prog_name: Optional[str],
complete_var: Optional[str],
standalone_mode: bool,
windows_expand_args: bool,
extra: Any,
) -> AnyThis is the way to invoke a script with all the bells and
whistles as a command line application. This will always terminate
the application after a call. If this is not wanted, SystemExit
needs to be caught.
This method is also available by directly calling the instance of
a :class:Command.
| Parameter | Type | Description |
|---|---|---|
args |
*args |
the arguments that should be used for parsing. If not provided, sys.argv[1:] is used. |
prog_name |
Optional[str] |
the program name that should be used. By default the program name is constructed by taking the file name from sys.argv[0]. |
complete_var |
Optional[str] |
the environment variable that controls the bash completion support. The default is "_<prog_name>_COMPLETE" with prog_name in uppercase. |
standalone_mode |
bool |
the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to False they will be propagated to the caller and the return value of this function is the return value of :meth:invoke. |
windows_expand_args |
bool |
Expand glob patterns, user dir, and env vars in command line args on Windows. |
extra |
Any |
extra keyword arguments are forwarded to the context constructor. See :class:Context for more information. .. versionchanged:: 8.0.1 Added the windows_expand_args parameter to allow disabling command line arg expansion on Windows. .. versionchanged:: 8.0 When taking arguments from sys.argv on Windows, glob patterns, user dir, and env vars are expanded. .. versionchanged:: 3.0 Added the standalone_mode parameter. |
make_context()
def make_context(
info_name: typing.Optional[str],
args: *args,
parent: typing.Optional[click.core.Context],
extra: typing.Any,
) -> click.core.ContextThis function when given an info name and arguments will kick
off the parsing and create a new :class:Context. It does not
invoke the actual command callback though.
To quickly customize the context class used without overriding
this method, set the :attr:context_class attribute.
| Parameter | Type | Description |
|---|---|---|
info_name |
typing.Optional[str] |
the info name for this invocation. Generally this is the most descriptive name for the script or command. For the toplevel script it’s usually the name of the script, for commands below it’s the name of the command. |
args |
*args |
the arguments to parse as list of strings. |
parent |
typing.Optional[click.core.Context] |
the parent context if available. |
extra |
typing.Any |
extra keyword arguments forwarded to the context constructor. .. versionchanged:: 8.0 Added the :attr:context_class attribute. |
make_parser()
def make_parser(
ctx: click.core.Context,
) -> click.parser.OptionParserCreates the underlying option parser for this command.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
parse_args()
def parse_args(
ctx: click.core.Context,
args: *args,
) -> typing.List[str]Given a context and a list of arguments this creates the parser
and parses the arguments, then modifies the context as necessary.
This is automatically invoked by :meth:make_context.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
|
args |
*args |
shell_complete()
def shell_complete(
ctx: click.core.Context,
incomplete: str,
) -> typing.List[ForwardRef('CompletionItem')]Return a list of completions for the incomplete value. Looks at the names of options and chained multi-commands.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.core.Context |
Invocation context for this command. |
incomplete |
str |
Value being completed. May be empty. .. versionadded:: 8.0 |
to_info_dict()
def to_info_dict(
ctx: click.Context,
) -> Dict[str, Any]Gather information that could be useful for a tool generating user-facing documentation. This traverses the entire structure below this command.
Use :meth:click.Context.to_info_dict to traverse the entire
CLI structure.
| Parameter | Type | Description |
|---|---|---|
ctx |
click.Context |
A .. versionadded:: 8.0 |