@named_env_base decorator allows you to reference a pre-resolved, named environment for all steps in your flow by default. Named environments are like Docker tags - they’re aliases for fully resolved environments that can be shared across flows and teams.
Overview
Use@named_env_base to set a default named environment for your entire flow. Individual steps can override this with their own @named_env decorator or extend it with @conda or @pypi.
When to Use
- Team-standard environments: Use your team’s standard environment across all steps
- Reduce repetition: Avoid specifying the same environment on every step
- Versioned base: Pin all steps to a specific environment version
- Shared environments: Use environments maintained by your team or organization
- Production stability: Lock production flows to tested environment versions
- Latest by default: Use
:latesttag to always use current environment
Parameters
Reference to a named environment alias. The environment must have been previously resolved and aliased.Name format: Note: Cannot specify both
namespace/environment-name[:tag]- The tag is optional; defaults to
:latestif not specified - Tags can contain environment variables using
@{VAR_NAME}syntax - Mutable tags:
:latest,:candidate,:stablecan be updated - Immutable tags: All other tags are permanent once created
name and pathspec in the same decorator.Reference the environment from a previously executed step using its pathspec.Pathspec format: Note: Cannot specify both
FlowName/RunId/StepName- Can use environment variables with
@{VAR_NAME}syntax - Useful for reproducing exact environments from past runs
- Automatically fetches the environment used by that step
name and pathspec in the same decorator.If
True, fetches the environment when each task executes (at runtime) rather than at deploy time or flow start.This is useful for:- Using the
:latestversion at execution time, not deployment time - Dynamic environments that update frequently
- Production deployments that should pick up environment updates
name or pathspec to be specified.If set to
True, disables the managed environment for all steps by default. Individual steps can still enable environments using @named_env, @conda, or @pypi.Usage Examples
Basic Flow-Wide Named Environment
Set a named environment for all steps:Extending Base Environment
Add step-specific packages to the base environment:Overriding Base Environment
Use a different named environment for specific steps:Using Latest Environment
Always use the latest version of an environment:Fetch at Execution Time
Fetch the latest environment when tasks execute, not when deployed:Using Pathspecs
Reproduce environments from previous runs:Environment Versioning Strategy
Maintain multiple environment versions:Combining Multiple Decorators
Extend named base with additional packages:Disabling by Default
Disable environments by default, enable selectively:Creating Named Environments
Before using@named_env_base, create and name the environment:
From requirements.txt
From environment.yml
From a flow’s environment
From existing pathspec
Merge Behavior
When combining@named_env_base with step-level decorators:
Extending Base Environment
Overriding Base Environment
Disabling for Specific Steps
Interaction with Other Decorators
Cannot Combine with Definition Decorators
At flow level,@named_env_base conflicts with @conda_base and @pypi_base:
Can Extend at Step Level
Step-level decorators can extend the base named environment:Mutable vs Immutable Tags
Mutable Tags
These can be updated to point to different environments::latest- Points to the most recently resolved environment:candidate- For testing/staging environments:stable- For production-ready environments
Immutable Tags
Once created, these always point to the same environment:Environment Sharing
Named environments are automatically shared across your team:- One person creates: A team member resolves and names the environment
- Others use it: Everyone else references it by name
- Automatic sync: Environments are cached in cloud storage (S3/GCS/Azure)
Production Deployment Pattern
Recommended pattern for production:- Develop with
:latest - Promote to
:candidatefor testing - Release as versioned tag (e.g.,
:v2.1.0) for production
Related Decorators
@named_env- Step-level named environment reference@conda_base- Flow-level Conda dependencies (conflicts with this)@pypi_base- Flow-level PyPI dependencies (conflicts with this)@conda- Step-level Conda dependencies (extends this)@pypi- Step-level PyPI dependencies (extends this)
Requirements
- Must use
--environment=condawhen running the flow - Named environment must exist (be previously resolved and aliased)
- Requires Conda/Mamba/Micromamba installed
- Applied at the class level (before the flow class definition)
Notes
- Named environments are fully resolved and locked
- Cannot combine with
@conda_baseor@pypi_baseat flow level - Can be extended at step level with
@condaor@pypi - Mutable tags (
:latest,:candidate,:stable) can be updated - Immutable tags (versions, dates) are permanent
- Environments are cached in cloud storage for sharing
fetch_at_execuseful for production flows using mutable tags
