flytekit.image_spec.ImageSpec¶
- class flytekit.image_spec.ImageSpec(name='flytekit', python_version=None, builder=None, source_root=None, env=None, registry=None, packages=None, conda_packages=None, conda_channels=None, requirements=None, apt_packages=None, cuda=None, cudnn=None, base_image=None, platform='linux/amd64', pip_index=None, pip_extra_index_url=None, registry_config=None, entrypoint=None, commands=None, tag_format=None)[source]¶
This class is used to specify the docker image that will be used to run the task.
- Parameters:
name (str) – name of the image.
python_version (str) – python version of the image. Use default python in the base image if None.
builder (str | None) – Type of plugin to build the image. Use envd by default.
source_root (str | None) – source root of the image.
env (Dict[str, str] | None) – environment variables of the image.
registry (str | None) – registry of the image.
packages (List[str] | None) – list of python packages to install.
conda_packages (List[str] | None) – list of conda packages to install.
requirements (str | None) – path to the requirements.txt file.
apt_packages (List[str] | None) – list of apt packages to install.
cuda (str | None) – version of cuda to install.
cudnn (str | None) – version of cudnn to install.
base_image (str | ImageSpec | None) – base image of the image.
platform (str) – Specify the target platforms for the build output (for example, windows/amd64 or linux/amd64,darwin/arm64
pip_index (str | None) – Specify the custom pip index url
pip_extra_index_url (List[str] | None) – Specify one or more pip index urls as a list
registry_config (str | None) – Specify the path to a JSON registry config file
entrypoint (List[str] | None) – List of strings to overwrite the entrypoint of the base image with, set to [] to remove the entrypoint.
commands (List[str] | None) – Command to run during the building process
tag_format (str | None) – Custom string format for image tag. The ImageSpec hash passed in as spec_hash. For example, to add a “dev” suffix to the image tag, set tag_format=”{spec_hash}-dev”
Methods
- exist()[source]¶
Check if the image exists in the registry. Return True if the image exists in the registry, False otherwise. Return None if failed to check if the image exists due to the permission issue or other reasons.
- Return type:
bool | None
- with_apt_packages(apt_packages)[source]¶
Builder that returns a new image spec with additional list of apt packages that will be executed during the building process.
- with_commands(commands)[source]¶
Builder that returns a new image spec with an additional list of commands that will be executed during the building process.
- with_packages(packages)[source]¶
Builder that returns a new image speck with additional python packages that will be installed during the building process.
Attributes
- name: str = 'flytekit'
- platform: str = 'linux/amd64'
- python_version: str = None