Search documentation

Type to search the documentation.

Generated API reference

classyak.App

yak.App

Yak application container

Yak application container

Python SDK reference · Yak 0.1.19release v0.1.19
provenancec2e8cf7c309abe376f390072b94a9ecd3e633080
Signature
python
App(name: Optional[str] = None, image: Union[str, Image, None] = None, secrets: Optional[List[Secret]] = None, environment: Optional[str] = None, workspace: Optional[str] = None)

Parameters#

NameTypeDefaultDescription
namepositional-or-keyword Optional[str] None

App name (optional)

imagepositional-or-keyword Union[str, Image, None] None

Default image for tasks. Can be:

  • None: Use default "python:3.11"
  • str: Image reference (e.g., "python:3.11-slim")
  • Image: Custom Image builder, or an existing registry image

created with Image.from_registry(...)

secretspositional-or-keyword Optional[List[Secret]] None

App-level secrets that apply to all tasks

environmentpositional-or-keyword Optional[str] None

Environment name (default: "development", or the
explicit CLI target from YAK_ENVIRONMENT)

workspacepositional-or-keyword Optional[str] None

Workspace name (default: "default", or the explicit
CLI target from YAK_WORKSPACE)

method

App.task#

Decorator to register a task with the app.

Decorator to register a task with the app.

Signature
python
task(func: Optional[Callable] = None, memory: Optional[MemoryResource] = None, cpu: Optional[CPUResource] = None, tmp_size: int = 256, image: Union[str, Image, None] = None, secrets: Optional[List[Secret]] = None, schedule: Union[Period, Cron, None] = None, volumes: Optional[Dict[str, Union[Volume, VolumeMount]]] = None, mounts: Optional[Dict[str, ObjectStorageMount]] = None, ephemeral_disks: Optional[Dict[str, EphemeralDisk]] = None, **kwargs: Any) -> Union[Callable[[Callable], Task], Task]

Parameters#

NameTypeDefaultDescription
funcpositional-or-keyword Optional[Callable] None

Python callable to declare as a Task

memorypositional-or-keyword Optional[MemoryResource] None

Memory request in MiB, or (request, hard_limit).
Omitted values are resolved by the control plane.

cpupositional-or-keyword Optional[CPUResource] None

CPU request in physical-core equivalents, or
(request, hard_limit). Values use 0.001-core precision.
Omitted values are resolved by the control plane.

tmp_sizepositional-or-keyword int 256

/tmp tmpfs size in MB (default: 256MB)

imagepositional-or-keyword Union[str, Image, None] None

Optional registry reference or custom Image for this task.
Overrides app image during ordinary Task registration.

secretspositional-or-keyword Optional[List[Secret]] None

Optional task-level secrets. Override app-level secrets.

schedulepositional-or-keyword Union[Period, Cron, None] None

Optional schedule (Period or Cron) for automatic execution.

volumespositional-or-keyword Optional[Dict[str, Union[Volume, VolumeMount]]] None

Optional volume mounts {mount_path: Volume or VolumeMount}
(e.g., {"/data": vol.mount(read_only=True)})

mountspositional-or-keyword Optional[Dict[str, ObjectStorageMount]] None

Optional ephemeral S3-compatible object-storage mounts
{mount_path: ObjectStorageMount}; unsupported by persistent deploy.

ephemeral_diskspositional-or-keyword Optional[Dict[str, EphemeralDisk]] None

Optional bounded invocation-local scratch filesystems
{mount_path: EphemeralDisk}; unsupported by persistent deploy.

kwargsvariadic-keyword Any —

Reserved compatibility parameters. Arbitrary task
options are currently ignored and are not a supported
extension surface.

Returns#

Union[Callable[[Callable], Task], Task]

Decorated task or decorator

Overloads#

Signature
overload
task(*, memory: Optional[MemoryResource] = None, cpu: Optional[CPUResource] = None, tmp_size: int = 256, image: Union[str, Image, None] = None, secrets: Optional[List[Secret]] = None, schedule: Union[Period, Cron, None] = None, volumes: Optional[Dict[str, Union[Volume, VolumeMount]]] = None, mounts: Optional[Dict[str, ObjectStorageMount]] = None, ephemeral_disks: Optional[Dict[str, EphemeralDisk]] = None, **kwargs: Any) -> Callable[[Callable], Task]

Parameters#

NameTypeDefaultDescription
memorykeyword-only Optional[MemoryResource] None

Memory request in MiB, or (request, hard_limit).
Omitted values are resolved by the control plane.

cpukeyword-only Optional[CPUResource] None

CPU request in physical-core equivalents, or
(request, hard_limit). Values use 0.001-core precision.
Omitted values are resolved by the control plane.

tmp_sizekeyword-only int 256

/tmp tmpfs size in MB (default: 256MB)

imagekeyword-only Union[str, Image, None] None

Optional registry reference or custom Image for this task.
Overrides app image during ordinary Task registration.

secretskeyword-only Optional[List[Secret]] None

Optional task-level secrets. Override app-level secrets.

schedulekeyword-only Union[Period, Cron, None] None

Optional schedule (Period or Cron) for automatic execution.

volumeskeyword-only Optional[Dict[str, Union[Volume, VolumeMount]]] None

Optional volume mounts {mount_path: Volume or VolumeMount}
(e.g., {"/data": vol.mount(read_only=True)})

mountskeyword-only Optional[Dict[str, ObjectStorageMount]] None

Optional ephemeral S3-compatible object-storage mounts
{mount_path: ObjectStorageMount}; unsupported by persistent deploy.

ephemeral_diskskeyword-only Optional[Dict[str, EphemeralDisk]] None

Optional bounded invocation-local scratch filesystems
{mount_path: EphemeralDisk}; unsupported by persistent deploy.

kwargsvariadic-keyword Any —

Reserved compatibility parameters. Arbitrary task
options are currently ignored and are not a supported
extension surface.

Returns#

Callable[[Callable], Task]

Decorated task or decorator

Signature
overload
task(func: Callable, memory: Optional[MemoryResource] = None, cpu: Optional[CPUResource] = None, tmp_size: int = 256, image: Union[str, Image, None] = None, secrets: Optional[List[Secret]] = None, schedule: Union[Period, Cron, None] = None, volumes: Optional[Dict[str, Union[Volume, VolumeMount]]] = None, mounts: Optional[Dict[str, ObjectStorageMount]] = None, ephemeral_disks: Optional[Dict[str, EphemeralDisk]] = None, **kwargs: Any) -> Task

Parameters#

NameTypeDefaultDescription
funcpositional-or-keyword Callable —

Python callable to declare as a Task

memorypositional-or-keyword Optional[MemoryResource] None

Memory request in MiB, or (request, hard_limit).
Omitted values are resolved by the control plane.

cpupositional-or-keyword Optional[CPUResource] None

CPU request in physical-core equivalents, or
(request, hard_limit). Values use 0.001-core precision.
Omitted values are resolved by the control plane.

tmp_sizepositional-or-keyword int 256

/tmp tmpfs size in MB (default: 256MB)

imagepositional-or-keyword Union[str, Image, None] None

Optional registry reference or custom Image for this task.
Overrides app image during ordinary Task registration.

secretspositional-or-keyword Optional[List[Secret]] None

Optional task-level secrets. Override app-level secrets.

schedulepositional-or-keyword Union[Period, Cron, None] None

Optional schedule (Period or Cron) for automatic execution.

volumespositional-or-keyword Optional[Dict[str, Union[Volume, VolumeMount]]] None

Optional volume mounts {mount_path: Volume or VolumeMount}
(e.g., {"/data": vol.mount(read_only=True)})

mountspositional-or-keyword Optional[Dict[str, ObjectStorageMount]] None

Optional ephemeral S3-compatible object-storage mounts
{mount_path: ObjectStorageMount}; unsupported by persistent deploy.

ephemeral_diskspositional-or-keyword Optional[Dict[str, EphemeralDisk]] None

Optional bounded invocation-local scratch filesystems
{mount_path: EphemeralDisk}; unsupported by persistent deploy.

kwargsvariadic-keyword Any —

Reserved compatibility parameters. Arbitrary task
options are currently ignored and are not a supported
extension surface.

Returns#

Task

Decorated task or decorator

method

App.entrypoint#

Decorator to mark a function as the entrypoint.

Decorator to mark a function as the entrypoint.

Automatically executes the decorated function when the script is run as __main__,
unless there's already an explicit if __name__ == "__main__": block.

Signature
python
entrypoint(func: Optional[Callable] = None) -> Union[Callable[[Callable], Callable], Callable]

Parameters#

NameTypeDefaultDescription
funcpositional-or-keyword Optional[Callable] None

Python callable to mark as entrypoint

Returns#

Union[Callable[[Callable], Callable], Callable]

Decorated function or decorator

Overloads#

Signature
overload
entrypoint() -> Callable[[Callable], Callable]

Returns#

Callable[[Callable], Callable]

Decorated function or decorator

Signature
overload
entrypoint(func: Callable) -> Callable

Parameters#

NameTypeDefaultDescription
funcpositional-or-keyword Callable —

Python callable to mark as entrypoint

Returns#

Callable

Decorated function or decorator

method

App.run#

Context manager to run the app.

Context manager to run the app.

Signature
python
run()
method

App.run_sync#

Synchronous context manager to run the app.

Synchronous context manager to run the app.

Signature
python
run_sync()
method

App.deploy#

Deploy the app persistently with declared web endpoints.

Deploy the app persistently with declared web endpoints.

This method:
Deploy the app to the Yak platform.

Persistent deployment currently excludes schedule registration.
Schedules have a separate lifecycle authority and are not silently
attached after traffic activation.

Signature
python
deploy() -> Dict[str, Any]

Returns#

Dict[str, Any]
No description supplied.
method

App.volume#

Get a volume by name, scoped to the app's environment.

Get a volume by name, scoped to the app's environment.

Signature
python
volume(name: str) -> Volume

Parameters#

NameTypeDefaultDescription
namepositional-or-keyword str —

Name of the volume

Returns#

Volume

Volume instance

method

App.serve#

Serve web endpoints ephemerally.

Serve web endpoints ephemerally.

This method is used by yak serve to keep the container running.
Endpoint registration is handled by the CLI before the container starts.
This method simply waits indefinitely until interrupted (e.g., CTRL+C).
It does not create a durable deployment, watch files, promise hot reload,
or provide draining/gradual traffic semantics.

Signature
python
serve()

Related guides

Apps, Tasks & Entrypoints
BoundaryPreview limitations
  • This page is generated from the pinned release schema; update the site pin when a new release should be documented.
  • Lifecycle, persistence and operational context belong in the linked handwritten guides.