Skip to main content
Every OuterProduct Call runs inside a container. An op.Image describes that container’s operating system, Python runtime and dependencies, and local files. Images are:
  • Lazy: OuterProduct prepares them when they are first used by a Call.
  • Immutable: methods such as with_uv_pip_install() return a new Image instead of modifying the existing one.
image is a required keyword argument in client.run(). Omitting it raises a Python TypeError.

Start from a container image

Create an Image from any compatible container registry reference. The base image supplies the operating system and Python interpreter.
You can also use an image from another registry:
Registry references should not include an https:// prefix.

Install Python packages

Use with_uv_pip_install() to add packages to the environment:
For a GPU workload, you can begin with a CUDA-enabled PyTorch image and add the libraries your application needs.

Add local files and directories

An Image can include files from your local project. Use add_local_file() for an individual file and add_local_dir() for a directory:
The first argument is the local path. The second is the absolute path where the file or directory will appear inside the container. OuterProduct uploads local files when the Image is used and mounts them over the container image. It uploads an Image’s local files together, skipping the upload when none have changed; changing them does not rebuild the Image’s dependency layers. When multiple additions write to the same path, the later addition takes precedence. Local files added to an Image are part of the execution environment. For data that must persist across Calls or Runs, use a mounted Volume instead.

Run with an Image

Pass the Image to client.run():
Each Call can use a different Image, allowing one application to combine functions with different dependencies and runtime environments.
If a nested Call uses an Image with local files, assign that Image to a variable outside any function, in the same file as the function you pass to client.run(). OuterProduct uploads the local files of those Images from your machine when the Run starts; Images created inside a function can’t find their local files once they’re running remotely.