latch package#

Submodules#

latch.account module#

class latch.account.Account(id: str)[source]#

Bases: object

User or team workspace. Can be used to fetch related resources.

current() is the typical way of getting an Account.

If the current request signer (CLI user or execution context) lacks permissions to fetch some information, the corresponding operations will act as if the information does not exist. Update operations will usually produce errors.

id: str#

Unique identifier.

classmethod current() typing_extensions.Self[source]#

Get current account.

In an execution context, this is the workspace in which the execution was run.

In the CLI context (when running latch commands) this is the current setting of latch workspace, which defaults to the user’s personal workspace.

Returns

Current account.

load() None[source]#

(Re-)populate this account instance’s cache.

Future calls to most getters will return immediately without making a network request.

Always makes a network request.

list_registry_projects(*, load_if_missing: Literal[True] = 'True') List[latch.registry.project.Project][source]#
list_registry_projects(*, load_if_missing: bool) Optional[List[latch.registry.project.Project]]

List Registry projects owned by this workspace.

Parameters

load_if_missing – If true, load() the project list if not in cache. If false, return None if not in cache.

Returns

Projects owned by this workspace.

update(*, reload_on_commit: bool = True) Iterator[latch.account.AccountUpdate][source]#

Start an update transaction.

The transaction will commit when the context manager closes unless an error occurs.

No changes will occur until the transaction commits.

The transaction can be cancelled by running AccountUpdate.clear() before closing the context manager.

Parameters

reload_on_commit – If true, load() this account after the transaction commits.

Returns

Context manager for the new transaction.

class latch.account.AccountUpdate(account: latch.account.Account)[source]#

Bases: object

account: latch.account.Account#
upsert_registry_project(display_name: str)[source]#

Upsert a registry project.

Not idempotent. Two calls with the same args will create two projects.

Parameters

display_name – Display name of the new project.

delete_registry_project(id: str)[source]#

Delete a registry project.

Parameters

id – The ID of the target project.

commit() None[source]#

Commit this account update transaction.

May be called multiple times.

All pending updates are committed with one network request.

Atomic. The entire transaction either commits or fails with an exception.

clear()[source]#

Remove pending updates.

May be called to cancel any pending updates that have not been committed.

Module contents#

The Latch SDK

A commandline toolchain to define and register serverless workflows with the Latch platform.