Skip to content

Dependencies for tests not compiled from pyproject.toml in test stage jobs

Description

When running the test jobs, the package requirements are generated using the following command:

uv pip compile --quiet --prerelease=allow --output-file=requirements.txt "$requirements_file" (Source)

However, this leads to only the base package dependecies being installed:

# file: pyproject.toml
...
[project]
dependencies = [
    "pydantic-settings~=2.8.1",  # will be installed
    "pandas~=2.2.3",  # will be installed
    "scikit-learn~=1.6.1",  # will be installed
]
...
[project.optional-dependencies]
tests = [
    "pytest~=8.3.5",  # will NOT be installed
    "matplotlib~=3.10.1",  # will NOT be installed
    "imageio~=2.37.0"  # will NOT be installed
]

Possible Fix

Add the --extra "tests" option (see here), i.e., change the following

uv pip compile --quiet --prerelease=allow --output-file=requirements.txt "$requirements_file" (Source)

to

uv pip compile --quiet --prerelease=allow --extra "tests" --output-file=requirements.txt "$requirements_file"

Alternatively, consider adding customization of the CLI options to the uv run call via a stage input.