Environment
EnvironmentLink
The sierra.core.environment
module handles creation, initialization, and teardown of the on‑disk Sierra development environment—setting up config directories, the virtualenv, scripts folder, and more.
Initializing your Sierra environment
sierra.core.environment
Link
ClassesLink
Environment
Link
SierraDevelopmentEnvironment
Link
SierraDevelopmentEnvironment(
client: sierra_client.SierraDevelopmentClient,
**kwrags: typing.Unpack[Environment],
)
Bases: sierra_core_base.SierraCoreObject
Manages the lifecycle of a SIERRA development environment.
Logs each step to the client's logger.
Initialize a SierraDevelopmentEnvironment.
PARAMETER | DESCRIPTION |
---|---|
client
|
The client instance to use for logging and API interactions.
TYPE:
|
**kwrags
|
Environment parameters.
TYPE:
|
AttributesLink
scripts_path
instance-attribute
Link
invokers_path
instance-attribute
LinkFunctionsLink
destroy
LinkRemove the environment configuration directory.
Logs each step of the operation.
RAISES | DESCRIPTION |
---|---|
OSError
|
If the directory removal fails. |
exists
Linkexists() -> bool
Check if the environment configuration directory exists.
RETURNS | DESCRIPTION |
---|---|
bool
|
True if the directory exists. |
list_contents
LinkList the contents of the environment configuration directory.
RETURNS | DESCRIPTION |
---|---|
list of str
|
List of file names in the configuration directory. |
RAISES | DESCRIPTION |
---|---|
SierraPathError
|
If the configuration directory does not exist. |
install_dependencies
LinkInstall dependencies from a requirements file into the virtual environment.
PARAMETER | DESCRIPTION |
---|---|
requirements_file
|
Path to the requirements file. If None or the file does not exist, the installation is skipped. |
RAISES | DESCRIPTION |
---|---|
SierraExecutionError
|
If pip is not found in the virtual environment or if the installation of dependencies fails. |
activate_instructions
Linkactivate_instructions() -> str
Generate the command string for activating the virtual environment.
RETURNS | DESCRIPTION |
---|---|
str
|
The activation command string for the appropriate OS environment. |
Notes
This function constructs the activation command for virtual environments on both Windows and Unix-like systems.