wheel_builder
flavor.packaging.python.wheel_builder
¶
TODO: Add module docstring.
Classes¶
WheelBuilder
¶
Wheel builder with sophisticated dependency resolution.
Combines the speed of UV with the reliability of PyPA pip for complex Python package building scenarios.
This class handles: - Source package wheel building - Complex dependency resolution - Cross-platform wheel selection - Proper manylinux compatibility
Initialize the wheel builder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
python_version
|
str
|
Target Python version for wheel building |
'3.11'
|
Source code in flavor/packaging/python/wheel_builder.py
Functions¶
build_and_resolve_project
¶
build_and_resolve_project(
python_exe: Path,
project_dir: Path,
build_dir: Path,
requirements_file: Path | None = None,
extra_packages: list[str] | None = None,
) -> dict[str, Any]
Complete wheel building and dependency resolution for a project.
CRITICAL: The PROJECT wheel is ALWAYS built from LOCAL SOURCE. Runtime dependencies are resolved and downloaded from PyPI as normal. This ensures the packaged project is never downloaded from PyPI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
python_exe
|
Path
|
Python executable to use |
required |
project_dir
|
Path
|
Project source directory |
required |
build_dir
|
Path
|
Directory for build artifacts |
required |
requirements_file
|
Path | None
|
Optional requirements file |
None
|
extra_packages
|
list[str] | None
|
Additional packages to include |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with build information and file paths |
Source code in flavor/packaging/python/wheel_builder.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
build_wheel_from_source
¶
build_wheel_from_source(
python_exe: Path,
source_path: Path,
wheel_dir: Path,
use_isolation: bool = True,
build_options: dict[str, Any] | None = None,
) -> Path
Build wheel from Python source package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
python_exe
|
Path
|
Python executable to use |
required |
source_path
|
Path
|
Path to source directory |
required |
wheel_dir
|
Path
|
Directory to place built wheel |
required |
use_isolation
|
bool
|
Whether to use build isolation |
True
|
build_options
|
dict[str, Any] | None
|
Additional build options |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the built wheel file |
Source code in flavor/packaging/python/wheel_builder.py
download_wheels_for_resolved_deps
¶
download_wheels_for_resolved_deps(
python_exe: Path,
requirements_file: Path,
wheel_dir: Path,
use_uv_for_download: bool = False,
) -> list[Path]
Download wheels for resolved dependencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
python_exe
|
Path
|
Python executable to use |
required |
requirements_file
|
Path
|
Locked requirements file |
required |
wheel_dir
|
Path
|
Directory to download wheels to |
required |
use_uv_for_download
|
bool
|
Whether to use UV for downloading |
False
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
List of downloaded wheel file paths |
Source code in flavor/packaging/python/wheel_builder.py
resolve_dependencies
¶
resolve_dependencies(
python_exe: Path,
requirements_file: Path | None = None,
packages: list[str] | None = None,
output_dir: Path | None = None,
use_uv_for_resolution: bool = True,
) -> Path
Resolve dependencies and create a locked requirements file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
python_exe
|
Path
|
Python executable to use |
required |
requirements_file
|
Path | None
|
Input requirements file |
None
|
packages
|
list[str] | None
|
List of packages to resolve |
None
|
output_dir
|
Path | None
|
Directory for output files |
None
|
use_uv_for_resolution
|
bool
|
Whether to use UV for fast resolution |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to locked requirements file |