latch_cli package#
Subpackages#
- latch_cli.auth package
- latch_cli.centromere package
- latch_cli.config package
- latch_cli.docker_utils package
- latch_cli.exceptions package
- latch_cli.services package
- Subpackages
- latch_cli.services.cp package
- Submodules
- latch_cli.services.cp.config module
- latch_cli.services.cp.download module
- latch_cli.services.cp.exceptions module
- latch_cli.services.cp.ldata_utils module
- latch_cli.services.cp.main module
- latch_cli.services.cp.path_utils module
- latch_cli.services.cp.progress module
- latch_cli.services.cp.remote_copy module
- latch_cli.services.cp.upload module
- latch_cli.services.cp.utils module
- Module contents
- latch_cli.services.deprecated package
- latch_cli.services.init package
- latch_cli.services.register package
- latch_cli.services.test_data package
- latch_cli.services.cp package
- Submodules
- latch_cli.services.execute module
- latch_cli.services.get module
- latch_cli.services.get_executions module
- latch_cli.services.get_params module
- latch_cli.services.launch module
- latch_cli.services.local_dev module
- latch_cli.services.login module
- latch_cli.services.ls module
- latch_cli.services.move module
- latch_cli.services.open_file module
- latch_cli.services.preview module
- latch_cli.services.workspace module
- Module contents
- Subpackages
Submodules#
latch_cli.click_utils module#
- class latch_cli.click_utils.EnumChoice(choices: Type[enum.Enum], case_sensitive: bool = True)[source]#
Bases:
click.types.Choice
- convert(value: Any, param: Optional[click.core.Parameter], ctx: Optional[click.core.Context]) Any [source]#
Convert the value to the correct type. This is not called if the value is
None
(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
param
andctx
arguments may beNone
in certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()
with a descriptive message.- Parameters
value – The value to convert.
param – The parameter that is using this type to convert its value. May be
None
.ctx – The current context that arrived at this value. May be
None
.
- class latch_cli.click_utils.ColoredHelpFormatter(indent_increment: int = 2, width: Optional[int] = None, max_width: Optional[int] = None)[source]#
Bases:
click.formatting.HelpFormatter
- write_usage(prog: str, args: str = '', prefix: Optional[str] = None) None [source]#
Writes a usage line into the buffer.
- Parameters
prog – the program name.
args – whitespace separated list of arguments.
prefix – The prefix for the first line. Defaults to
"Usage: "
.
- write_dl(rows: Sequence[Tuple[str, str]], col_max: int = 30, col_spacing: int = 2) None [source]#
Writes a definition list into the buffer. This is how options and commands are usually formatted.
- Parameters
rows – a list of two item tuples for the terms and values.
col_max – the maximum width of the first column.
col_spacing – the number of spaces between the first and second column.
- class latch_cli.click_utils.LatchCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[click.core.Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]#
Bases:
click.core.Command
latch_cli.constants module#
Package-wide constants.
- class latch_cli.constants.Units(value)[source]#
-
An enumeration.
- KiB = 1024#
- kB = 1000#
- MiB = 1048576#
- MB = 1000000#
- GiB = 1073741824#
- GB = 1000000000#
- TiB = 1099511627776#
- TB = 1000000000000#
- latch_cli.constants.units#
alias of
latch_cli.constants.Units
- class latch_cli.constants.LatchConstants(base_image: str = '812206152185.dkr.ecr.us-west-2.amazonaws.com/latch-base:5303-main', file_max_size: int = 4194304, file_chunk_size: int = 268435456, pkg_name: str = 'latch', pkg_ssh_key: str = '.latch/ssh_key', pkg_config: str = '.latch/config')[source]#
Bases:
object
- maximum_upload_parts = 10000#
- maximum_upload_size = 5497558138880#
- ignore_regex = re.compile('(\\.git|\\.latch_report\\.tar\\.gz|traceback\\.txt|metadata\\.json)$')#
- class latch_cli.constants.OAuth2Constants(client_id: str = 'jzFBOhIbfp4EPRYZ8wmx4YyvL27LFDeB', authz_server_host: str = 'https://latchai.us.auth0.com', redirect_url: str = 'http://127.0.0.1:5050/callback')[source]#
Bases:
object
- client_id: str = 'jzFBOhIbfp4EPRYZ8wmx4YyvL27LFDeB'#
Identifies the authentication server in 0Auth2.0 flow
latch_cli.main module#
Entrypoints to service functions through a latch_cli.
latch_cli.tinyrequests module#
- class latch_cli.tinyrequests.TinyResponse(resp: http.client.HTTPResponse, url: str, *, stream: bool = False)[source]#
Bases:
object
- property headers#
- property status_code#
- property content#
- property url#
- latch_cli.tinyrequests.request(method: str, url: str, *, headers: Dict[str, str] = {}, data: Optional[bytes] = None, json: Optional[Any] = None, stream: bool = False)[source]#
- latch_cli.tinyrequests.get(url: str, *, headers: Dict[str, str] = {}, data: Optional[bytes] = None, json: Optional[Any] = None, stream: bool = False)[source]#
latch_cli.tui module#
- latch_cli.tui.clear(k: int)[source]#
Clear k lines below the cursor, returning the cursor to its original position
- latch_cli.tui.draw_box(ul_corner_pos: Tuple[int, int], height: int, width: int, color: Optional[str] = None)[source]#
- latch_cli.tui.move_cursor(pos: Tuple[int, int])[source]#
Move the cursor to a given (x, y) coordinate
- latch_cli.tui.draw_vertical_line(height: int, up: bool = False, make_corner: bool = False, color: Optional[str] = None)[source]#
Draws a vertical line with given height, going upwards if up is True and downwards otherwise.
- latch_cli.tui.draw_horizontal_line(width: int, left: bool = False, make_corner: bool = False, color: Optional[str] = None)[source]#
Draws a horizontal line with given width, going to the left if left is True and to the right otherwise.
- latch_cli.tui.select_tui(title: str, options: List[str], clear_terminal: bool = True)[source]#
Renders a terminal UI that allows users to select one of the options listed in options
- Parameters
title – The title of the selection window.
options – A list of names for each of the options.
clear_terminal – Whether or not to clear the entire terminal window before displaying - default False
latch_cli.utils module#
Utility functions for services.
- latch_cli.utils.retrieve_or_login() str [source]#
Returns a valid JWT to access Latch, prompting a login flow if needed.
- Returns
A JWT
- latch_cli.utils.sub_from_jwt(token: str) str [source]#
Extract a user sub (UUID) from a JWT minted by auth0.
- Parameters
token – JWT
- Returns
The user sub contained within the JWT.
- latch_cli.utils.account_id_from_token(token: str) str [source]#
Exchanges a valid JWT for a Latch account ID.
Latch account IDs are needed for any user-specific request, eg. register workflows or copy files to Latch.
- Parameters
token – JWT
- Returns
A Latch account ID (UUID).
- latch_cli.utils.hash_directory(dir_path: pathlib.Path) str [source]#
- latch_cli.utils.generate_temporary_ssh_credentials(ssh_key_path: pathlib.Path) str [source]#
latch_cli.workflow_config module#
- class latch_cli.workflow_config.BaseImageOptions(value)[source]#
-
An enumeration.
- default = 'default'#
- cuda = 'cuda'#
- opencl = 'opencl'#
- class latch_cli.workflow_config.LatchWorkflowConfig(latch_version: str, base_image: str, date: str)[source]#
Bases:
object
Configuration for a Latch workflow.
- latch_cli.workflow_config.create_and_write_config(pkg_root: pathlib.Path, base_image_type: latch_cli.workflow_config.BaseImageOptions = BaseImageOptions.default)[source]#