Before you run#
Use an installed, authenticated Yak CLI with access to the invite-only preview. Read Images for the full setup and current behavior.
Python example
Package dependencies and local files into a Task’s image.
Use an installed, authenticated Yak CLI with access to the invite-only preview. Read Images for the full setup and current behavior.
import asyncio
import yak
image = yak.Image.python_3_11().pip_install("requests==2.31.0")
app = yak.App(
name="custom-image",
image=image,
)
@app.task()
def package_version() -> str:
import requests
return requests.__version__
@app.entrypoint()
async def main() -> None:
version = await package_version.remote.aio()
print(version)
if __name__ == "__main__":
asyncio.run(main())
Save the source as custom_image.py, then run:
$ yak run custom_image.py