Installation Context¶
hatch.installers.installation_context
¶
Defines context, status, and result data structures for dependency installation.
This module provides the InstallationContext dataclass for encapsulating environment and configuration information required during dependency installation, as well as InstallationStatus and InstallationResult for representing the outcome and details of installation operations.
Classes¶
InstallationContext
dataclass
¶
Context information for dependency installation.
This class encapsulates all the environment and configuration information needed for installing dependencies, making the installer interface cleaner and more extensible.
Source code in hatch/installers/installation_context.py
Attributes¶
cache_dir = None
class-attribute
instance-attribute
¶
Cache directory for reusable artifacts.
environment_name
instance-attribute
¶
Name of the target environment.
environment_path
instance-attribute
¶
Path to the target environment where dependencies will be installed.
extra_config = None
class-attribute
instance-attribute
¶
Additional installer-specific configuration.
force_reinstall = False
class-attribute
instance-attribute
¶
Whether to force reinstallation of existing packages.
parallel_enabled = True
class-attribute
instance-attribute
¶
Whether parallel installation is enabled.
simulation_mode = False
class-attribute
instance-attribute
¶
Whether to run in simulation mode (no actual installation).
temp_dir = None
class-attribute
instance-attribute
¶
Temporary directory for download/build operations.
Functions¶
get_config(key, default=None)
¶
Get a configuration value from extra_config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Configuration key to retrieve. |
required |
default
|
Any
|
Default value if key not found. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Configuration value or default. |
Source code in hatch/installers/installation_context.py
set_config(key, value)
¶
Set a configuration value in extra_config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Configuration key to set. |
required |
value
|
Any
|
Value to set for the key. |
required |
Source code in hatch/installers/installation_context.py
InstallationResult
dataclass
¶
Result of an installation operation.
Provides detailed information about the installation outcome, including status, paths, and any error information.
Source code in hatch/installers/installation_context.py
Attributes¶
artifacts = None
class-attribute
instance-attribute
¶
List of files/directories created during installation.
dependency_name
instance-attribute
¶
Name of the dependency that was installed.
error_message = None
class-attribute
instance-attribute
¶
Error message if installation failed.
installed_path = None
class-attribute
instance-attribute
¶
Path where the dependency was installed.
installed_version = None
class-attribute
instance-attribute
¶
Actual version that was installed.
metadata = None
class-attribute
instance-attribute
¶
Additional installer-specific metadata.
status
instance-attribute
¶
Final status of the installation.
InstallationStatus
¶
Bases: Enum
Status of an installation operation.