Skip to content

activate#

Return an ActivationResult object that contains the new PATH environment variable and the script to run to activate the environment.

Parameters:

Name Type Description Default
prefix Path

The path to the conda prefix to activate.

required
activation_variables ActivationVariables

The current activation variables.

required
shell Optional[Shell]

The shell to generate the activation script for.

required
platform Optional[Platform | PlatformLiteral]

The platform to generate the activation script for. If None, the current platform is used.

None

Returns:

Type Description
ActivationResult

An ActivationResult object containing the new PATH environment variable

ActivationResult

and the script to run to activate the environment.

Examples#

>>> from rattler.shell import Shell, activate, ActivationVariables
>>> from rattler.platform import Platform
>>> from pathlib import Path
>>> import sys
>>> p = Path("/path/to/conda/prefix")
>>> actvars = ActivationVariables(None, sys.path)
>>> a = activate(p, actvars, Shell.xonsh)
>>> print(a)
<rattler.shell.shell.ActivationResult object at ...>
>>>