Image,
along with the Python version it runs. LazyCloud builds the image in the cloud,
so nothing installs on your machine.
Install remote dependencies
uv run lazycloud run audio:ffmpeg_version prints the ffmpeg version from the
cloud container, and your machine never needs ffmpeg.
.add_python_packages(["httpx"]) adds a Python package.
Image() alone is the managed Python 3.12 image, and Python 3.10 through 3.14,
or a patch release such as 3.12.11, are available. Images are cached by
content, so an unchanged image never rebuilds.
Create an image from a project
A factory builds from the project’s own dependency files:pyproject.toml, lockfile, and
.python-version, plus any local path dependencies inside it. It installs
dependencies only. Your own code reaches the container through source sync, so
editing it never rebuilds the image, and code under src/ still imports.
uv
pyproject.toml and uv.lock, and installs exactly what’s locked.
Dependency groups, including dev, install only when groups names them.
Poetry
pyproject.toml and poetry.lock, and installs the locked main
dependencies plus the selected groups and extras.
Standard pyproject.toml
[project] metadata and [dependency-groups] and resolves
versions at build time, with no lockfile. from_uv and from_poetry are the
locked options.
Micromamba
environment.yml
Python selection
An explicitpython_version overrides the project’s interpreter pin:
.python-version, or Micromamba’s python= entry,
decides, with 3.12 as the fallback. An unsupported pin fails.
Factories return an ordinary image that extends like any other:
base_image, base_image_creds, and architecture:
Constructor
Builder methods
Each returns the image, so they chain.add_python_packages(packages)installs packages. Pass a list of specs or a path to arequirements.txt.add_commands(commands)runs shell commands during the build.add_local_path(pattern="*")includes matching local files in the build context.add_micromamba_packages(packages, channels=[...])adds packages to an image created withfrom_micromamba().with_envs(env_vars, clear=False)sets environment variables from a mapping,"KEY=value"strings, or a sequence of them.with_secrets(secrets)makes workspace secrets available during the build.with_docker()installs Docker so containers using the image can run their own daemon.build_with_gpu(hint)runs the build on a GPU worker of the given model.
Start from an existing image
Image.from_id(image_id) reuses a sandbox filesystem snapshot, given the ID
the snapshot returned.
Private registries
credentials names environment variables that LazyCloud reads on your machine
when the image builds, so values stay out of code:
{"GITHUB_USERNAME": "acme-bot", "GITHUB_TOKEN": os.environ["CI_GHCR_TOKEN"]}.
A listed variable that isn’t set stops the build before it starts. The names
are fixed per registry, and any other name is ignored:
GOOGLE_APPLICATION_CREDENTIALS can be a file path or the JSON itself. The
constructor and project factories take the same value as base_image_creds.