Models and exceptions#

Task definitions and the errors they can raise.

Task model dataclasses for conda-tasks.

class conda_tasks.models.Task(name: str, cmd: str | list[str] | None = None, args: list[TaskArg] = <factory>, depends_on: list[TaskDependency] = <factory>, cwd: str | None = None, env: dict[str, str]=<factory>, description: str | None = None, inputs: list[str] = <factory>, outputs: list[str] = <factory>, clean_env: bool = False, default_environment: str | None = None, platforms: dict[str, ~conda_tasks.models.TaskOverride] | None=None)[source]#

A single task definition with all its configuration.

args: list[TaskArg]#
clean_env: bool = False#
cmd: str | list[str] | None = None#
cwd: str | None = None#
default_environment: str | None = None#
depends_on: list[TaskDependency]#
description: str | None = None#
env: dict[str, str]#
inputs: list[str]#
property is_alias: bool#

True when the task is just a dependency grouping with no command.

property is_hidden: bool#

Hidden tasks (prefixed with _) are omitted from listings.

name: str#
outputs: list[str]#
platforms: dict[str, TaskOverride] | None = None#
resolve_for_platform(subdir: str) Task[source]#

Return a copy of this task with platform overrides merged in.

subdir is a conda platform string such as linux-64 or osx-arm64. If there is no matching override the task is returned unchanged.

class conda_tasks.models.TaskArg(name: str, default: str | None = None)[source]#

A named argument that can be passed to a task.

default: str | None = None#
name: str#
class conda_tasks.models.TaskDependency(task: str, args: list[str | dict[str, str]]=<factory>, environment: str | None = None)[source]#

A reference to another task that must run first.

args: list[str | dict[str, str]]#
environment: str | None = None#
task: str#
class conda_tasks.models.TaskOverride(cmd: str | list[str] | None = None, args: list[TaskArg] | None = None, depends_on: list[TaskDependency] | None = None, cwd: str | None = None, env: dict[str, str] | None = None, inputs: list[str] | None = None, outputs: list[str] | None = None, clean_env: bool | None = None)[source]#

Per-platform override for any task field.

Non-None fields replace the base task’s values when the override is merged into a Task via Task.resolve_for_platform.

args: list[TaskArg] | None = None#
clean_env: bool | None = None#
cmd: str | list[str] | None = None#
cwd: str | None = None#
depends_on: list[TaskDependency] | None = None#
env: dict[str, str] | None = None#
inputs: list[str] | None = None#
outputs: list[str] | None = None#

Custom exceptions for conda-tasks.

exception conda_tasks.exceptions.CondaTasksError(message: str | None, caused_by: Any = None, **kwargs)[source]#

Bases: CondaError

Base exception for all conda-tasks errors.

exception conda_tasks.exceptions.CyclicDependencyError(cycle: list[str])[source]#

Bases: CondaTasksError

Raised when the task dependency graph contains a cycle.

exception conda_tasks.exceptions.NoTaskFileError(search_dir: str)[source]#

Bases: CondaTasksError

Raised when no task definition file is found.

exception conda_tasks.exceptions.TaskExecutionError(task_name: str, exit_code: int)[source]#

Bases: CondaTasksError

Raised when a task command exits with a non-zero status.

exception conda_tasks.exceptions.TaskNotFoundError(task_name: str, available: list[str] | None = None)[source]#

Bases: CondaTasksError

Raised when a referenced task does not exist.

exception conda_tasks.exceptions.TaskParseError(path: str, reason: str)[source]#

Bases: CondaTasksError

Raised when a task definition file cannot be parsed.