Skip to content

_python

TasksPythonSettings

Bases: BaseModel

Configuration for the Python base interpreters to be used for task venvs.

For task collection to work, there must be one or more base Python interpreters available on your system.

Source code in fractal_server/tasks/config/_python.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class TasksPythonSettings(BaseModel):
    """
    Configuration for the Python base interpreters to be used for task venvs.

    For task collection to work, there must be one or more base Python
    interpreters available on your system.
    """

    default_version: NonEmptyStr
    """
    Default task-collection Python version (must be a key of `versions`).
    """
    versions: dict[
        Literal[
            "3.9",
            "3.10",
            "3.11",
            "3.12",
            "3.13",
            "3.14",
        ],
        AbsolutePathStr,
    ]
    """
    Dictionary mapping Python versions to the corresponding interpreters.
    """

    pip_cache_dir: AbsolutePathStr | None = None
    """
    Argument for `--cache-dir` option of `pip install`, if set.
    """

    @model_validator(mode="after")
    def _validate_versions(self) -> Self:
        if self.default_version not in self.versions.keys():
            raise ValueError(
                f"The default Python version ('{self.default_version}') is "
                f"not available versions in {list(self.versions.keys())}."
            )

        return self

default_version instance-attribute

Default task-collection Python version (must be a key of versions).

pip_cache_dir = None class-attribute instance-attribute

Argument for --cache-dir option of pip install, if set.

versions instance-attribute

Dictionary mapping Python versions to the corresponding interpreters.