Context and template variables#
The conda.* and pixi.* namespaces available in Jinja2 templates.
Template context variables for Jinja2 rendering.
Provides conda.* (and pixi.* alias) template variables that
mirror pixi’s built-in template variables.
- class conda_tasks.context.CondaContext(manifest_path: Path | None = None)[source]#
Lazy-evaluated namespace exposed as
conda.*in templates.Attribute access is deferred so we only import conda internals when a template actually references a variable.
- property environment: _EnvironmentProxy#
Allows
{{ conda.environment.name }}in templates.
- property environment_name: str#
Name of the currently active conda environment, or
"base".
- property init_cwd: str#
The working directory at the time of context creation.
- property is_linux: bool#
True when the host platform is Linux.
- property is_osx: bool#
True when the host platform is macOS.
- property is_unix: bool#
True when running on a Unix-like system (Linux or macOS).
- property is_win: bool#
True when running on Windows.
- property manifest_path: str#
Path to the task definition file, or empty string if unknown.
- property platform: str#
The conda platform/subdir string, e.g.
linux-64orosx-arm64.
- property prefix: str#
Absolute path to the target conda environment prefix.
- property version: str#
The installed conda version string.
- conda_tasks.context.build_template_context(manifest_path: Path | None = None, task_args: dict[str, str] | None = None) dict[str, object][source]#
Build the full Jinja2 template context dict.
The returned dict contains: -
conda: a CondaContext instance -pixi: alias to the same CondaContext (for pixi.toml compat) - Any user-supplied task argument values