Generated API reference
yak.App
Yak application container
Yak application container
provenance
c2e8cf7c309abe376f390072b94a9ecd3e633080App(name: Optional[str] = None, image: Union[str, Image, None] = None, secrets: Optional[List[Secret]] = None, environment: Optional[str] = None, workspace: Optional[str] = None)
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
namepositional-or-keyword |
Optional[str] |
None |
App name (optional) |
imagepositional-or-keyword |
Union[str, Image, None] |
None |
Default image for tasks. Can be:
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 |
workspacepositional-or-keyword |
Optional[str] |
None |
Workspace name (default: "default", or the explicit |
App.task#
Decorator to register a task with the app.
Decorator to register a task with the app.
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#
| Name | Type | Default | Description |
|---|---|---|---|
funcpositional-or-keyword |
Optional[Callable] |
None |
Python callable to declare as a Task |
memorypositional-or-keyword |
Optional[MemoryResource] |
None |
Memory request in MiB, or |
cpupositional-or-keyword |
Optional[CPUResource] |
None |
CPU request in physical-core equivalents, or |
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. |
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} |
mountspositional-or-keyword |
Optional[Dict[str, ObjectStorageMount]] |
None |
Optional ephemeral S3-compatible object-storage mounts |
ephemeral_diskspositional-or-keyword |
Optional[Dict[str, EphemeralDisk]] |
None |
Optional bounded invocation-local scratch filesystems |
kwargsvariadic-keyword |
Any |
— |
Reserved compatibility parameters. Arbitrary task |
Returns#
Overloads#
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#
| Name | Type | Default | Description |
|---|---|---|---|
memorykeyword-only |
Optional[MemoryResource] |
None |
Memory request in MiB, or |
cpukeyword-only |
Optional[CPUResource] |
None |
CPU request in physical-core equivalents, or |
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. |
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} |
mountskeyword-only |
Optional[Dict[str, ObjectStorageMount]] |
None |
Optional ephemeral S3-compatible object-storage mounts |
ephemeral_diskskeyword-only |
Optional[Dict[str, EphemeralDisk]] |
None |
Optional bounded invocation-local scratch filesystems |
kwargsvariadic-keyword |
Any |
— |
Reserved compatibility parameters. Arbitrary task |
Returns#
Callable[[Callable], Task]Decorated task or decorator
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#
| Name | Type | Default | Description |
|---|---|---|---|
funcpositional-or-keyword |
Callable |
— |
Python callable to declare as a Task |
memorypositional-or-keyword |
Optional[MemoryResource] |
None |
Memory request in MiB, or |
cpupositional-or-keyword |
Optional[CPUResource] |
None |
CPU request in physical-core equivalents, or |
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. |
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} |
mountspositional-or-keyword |
Optional[Dict[str, ObjectStorageMount]] |
None |
Optional ephemeral S3-compatible object-storage mounts |
ephemeral_diskspositional-or-keyword |
Optional[Dict[str, EphemeralDisk]] |
None |
Optional bounded invocation-local scratch filesystems |
kwargsvariadic-keyword |
Any |
— |
Reserved compatibility parameters. Arbitrary task |
Returns#
TaskDecorated task or decorator
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.
entrypoint(func: Optional[Callable] = None) -> Union[Callable[[Callable], Callable], Callable]
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
funcpositional-or-keyword |
Optional[Callable] |
None |
Python callable to mark as entrypoint |
Returns#
Union[Callable[[Callable], Callable], Callable]Decorated function or decorator
Overloads#
entrypoint() -> Callable[[Callable], Callable]
Returns#
Callable[[Callable], Callable]Decorated function or decorator
App.run#
Context manager to run the app.
Context manager to run the app.
run()
App.run_sync#
Synchronous context manager to run the app.
Synchronous context manager to run the app.
run_sync()
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.
deploy() -> Dict[str, Any]
Returns#
Dict[str, Any]App.volume#
Get a volume by name, scoped to the app's environment.
Get a volume by name, scoped to the app's environment.
volume(name: str) -> Volume
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
namepositional-or-keyword |
str |
— |
Name of the volume |
Returns#
VolumeVolume instance
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.
serve()
Related guides
- 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.