Skip to content

Image

Represents a container image for a job.

The image is defined based on Python dependencies and two build scripts expressed as Dockerfile commands.

Parameters:

  • python_version

    (str, default: 'auto' ) –

    Python version string or "auto".

  • python_requirements

    (str | list[str], default: '' ) –

    Requirements spec, file path, list, or "auto".

  • build_script_pre

    (str, default: '' ) –

    Pre-build Dockerfile commands or file path.

  • build_script_post

    (str, default: '' ) –

    Post-build Dockerfile commands or file path.

  • branch_name

    (str | None, default: None ) –

    Git branch name for the repo, if applicable.

  • commit_hash

    (str | None, default: None ) –

    Git commit hash for the repo, if applicable.

  • path_to_repo

    (str | None, default: None ) –

    Path to the repository root, if applicable.

  • path_to_module

    (str | None, default: None ) –

    Path to the Python module, if applicable.

Attributes:

  • python_version (str) –

    Resolved Python version string.

  • python_requirements (str) –

    Requirements string (newline-delimited).

  • build_script_pre (str) –

    Pre-build Dockerfile commands.

  • build_script_post (str) –

    Post-build Dockerfile commands.

  • branch_name (str | None) –

    Git branch name.

  • commit_hash (str | None) –

    Git commit hash.

  • path_to_repo (str | None) –

    Path to the repository root.

  • path_to_module (str | None) –

    Path to the Python module.

  • build_stdout (str | None) –

    Stdout captured from the last build, if any.

  • build_stderr (str | None) –

    Stderr captured from the last build, if any.

  • name (str | None) –

    Built image name, if any.

  • last_build_succeeded (bool | None) –

    Whether the last build succeeded.

  • bundle_name (str | None) –

    Bundle name, if any.

  • registry (str | None) –

    Registry URL or name, if any.

  • run_after_build (bool | None) –

    Whether to run after build.

  • tag (str | None) –

    Image tag, if any.

Parameters:

  • python_version

    (str, default: 'auto' ) –

    Python version for the container (e.g. "3.12"). Use "auto" to match the current interpreter version.

  • python_requirements

    (str | list[str], default: '' ) –

    Python dependencies. Accepts a pip-freeze string, a list of package specifiers, a path to a requirements.txt file, or "auto" to run pip freeze.

  • build_script_pre

    (str, default: '' ) –

    Dockerfile commands to execute before installing Python requirements. Can be a string or a file path.

  • build_script_post

    (str, default: '' ) –

    Dockerfile commands to execute after installing Python requirements. Can be a string or a file path.

  • branch_name

    (str | None, default: None ) –

    Git branch name (populated automatically during build).

  • commit_hash

    (str | None, default: None ) –

    Git commit hash (populated automatically during build).

  • path_to_repo

    (str | None, default: None ) –

    Absolute path to the source repository root.

  • path_to_module

    (str | None, default: None ) –

    Relative path from the repository root to the Python module containing the entrypoint.

from_dict

Create an Image instance from a dictionary representation.

to_dict

Convert the Image instance to a dictionary representation.

to_json

Convert the Image instance to a JSON string representation.

update

Update one or more Image attributes.

Parameters:

  • **kwargs

    (Any, default: {} ) –

    Attribute names and their new values.

Raises:

  • TypeError

    If a string-only attribute receives a non-string value.

  • AttributeError

    If an attribute name does not exist on the Image.