packager
flavor.packaging.python.packager
¶
Python packager that owns all Python-specific packaging logic.
Classes¶
PythonPackager
¶
PythonPackager(
manifest_dir: Path,
package_name: str,
entry_point: str,
build_config: dict[str, Any] | None = None,
python_version: str = "3.11",
)
Python packager that owns all Python-specific packaging logic.
This class orchestrates the packaging process by delegating to specialized modules: - PythonEnvironmentBuilder: Handles Python environment setup and distribution - PythonSlotBuilder: Manages slot preparation and artifact assembly - WheelBuilder: Builds Python wheels and resolves dependencies - PythonDistManager: Manages Python distributions - PyPaPipManager: Handles PyPA pip operations - UVManager: Handles UV operations
Initialize the Python packager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest_dir
|
Path
|
Directory containing the package manifest (pyproject.toml) |
required |
package_name
|
str
|
Name of the package |
required |
entry_point
|
str
|
Entry point for the package (e.g., "module:function") |
required |
build_config
|
dict[str, Any] | None
|
Build configuration from pyproject.toml |
None
|
python_version
|
str
|
Python version to use (e.g., "3.11") |
'3.11'
|
Source code in flavor/packaging/python/packager.py
Functions¶
__repr__
¶
String representation of the packager.
clean_build_artifacts
¶
Clean up temporary build artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
work_dir
|
Path
|
Working directory to clean |
required |
Source code in flavor/packaging/python/packager.py
create_build_environment
¶
Create a temporary build environment for wheel building.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
build_dir
|
Path
|
Directory to create environment in |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to Python executable in the environment |
Source code in flavor/packaging/python/packager.py
download_uv_binary
¶
Download UV binary for packaging.
Delegates to environment builder for the actual download.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dest_dir
|
Path
|
Directory to save UV binary to |
required |
Returns:
| Type | Description |
|---|---|
Path | None
|
Path to UV binary if successful, None otherwise |
Source code in flavor/packaging/python/packager.py
get_build_dependencies
¶
Get build dependencies from pyproject.toml.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of build dependency specifications |
Source code in flavor/packaging/python/packager.py
get_package_metadata
¶
Get package metadata from pyproject.toml.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with package metadata |
Source code in flavor/packaging/python/packager.py
get_python_binary_info
¶
Get information about the Python binary to use.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with Python binary information: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
Source code in flavor/packaging/python/packager.py
get_runtime_dependencies
¶
prepare_artifacts
¶
Prepare all artifacts needed for flavor assembly.
Delegates to PythonSlotBuilder for the actual preparation.
Returns:
| Type | Description |
|---|---|
dict[str, Path]
|
Dictionary mapping artifact names to their paths: |
dict[str, Path]
|
|
dict[str, Path]
|
|
dict[str, Path]
|
|
dict[str, Path]
|
|
Source code in flavor/packaging/python/packager.py
validate_manifest
¶
Validate that the manifest directory contains a valid Python project.
Returns:
| Type | Description |
|---|---|
bool
|
True if valid, raises exception otherwise |