Install & Compatibility
Where this runs
tested against v0.23.13 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 82.5MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 5.5s · import 0.000s · 81MB
76MB installed
● package 76MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Edk2Path
✓ from edk2toollib.path_utilities import Edk2Path
PrintFileData
✓ from edk2toollib.utility_functions import PrintFileData
This quickstart demonstrates how to import and use the `Edk2Path` class from `edk2toollib.path_utilities` to manage EDK2 file paths. It sets up a temporary workspace and package structure to showcase how an absolute path can be converted into an EDK2 relative path. It also includes a brief mention of a utility function from `edk2toollib.utility_functions`.
from edk2toollib.path_utilities import Edk2Path
from pathlib import Path
import tempfile
# Create a dummy workspace and package for demonstration
with tempfile.TemporaryDirectory() as tmpdir:
workspace_path = Path(tmpdir) / "edk2_workspace"
package_path = workspace_path / "MyPkg"
(package_path / "MyModule").mkdir(parents=True)
(package_path / "MyModule" / "MyModule.inf").touch()
workspace_path.mkdir()
package_path.mkdir()
# Instantiate Edk2Path - note the performance warning in warnings section
edk2_path_obj = Edk2Path(ws=workspace_path, package_path_list=[package_path])
# Example: Get an EDK2 relative path
abs_module_path = package_path / "MyModule" / "MyModule.inf"
edk2_relative_path = edk2_path_obj.GetEdk2RelativePathFromAbsolutePath(str(abs_module_path))
print(f"EDK2 Relative Path: {edk2_relative_path}")
# Example using a utility function (requires a file to print)
test_file = Path(tmpdir) / "test.txt"
test_file.write_text("Hello, EDK2!")
print("\nPrinting file data:")
# PrintFileData is often used internally, no direct output capturing shown here for simplicity
# The function itself prints to console, so we can't easily assert its output without mocking sys.stdout
# For demonstration, we simply call it.
# In a real scenario, you'd likely use a logger or capture stdout.
# from edk2toollib.utility_functions import PrintFileData
# PrintFileData(str(test_file))
print(f"Content of {test_file.name}: {test_file.read_text()}") # Simulate PrintFileData output
Debug
Known issues
gotchaIt is strongly recommended to use Python virtual environments when working with `edk2-pytool-library` (and related EDK2 tools). This helps prevent dependency conflicts with other Python projects and ensures a consistent development environment. This recommendation is consistently highlighted in the official documentation for both the library and related tools.fixAlways activate a virtual environment before installing or using `edk2-pytool-library`: `python -m venv .venv && source .venv/bin/activate` (Linux/macOS) or `.venv\Scripts\activate.bat` (Windows).
affects: All versions
gotchaThe EDK2 build system (which `edk2-pytool-library` supports) is sensitive to spaces in certain environment variables. `WORKSPACE`, `PACKAGES_PATH`, and `EDK_TOOLS_BIN` must not contain space characters, even if the operating system permits them.fixEnsure that the directory paths assigned to `WORKSPACE`, `PACKAGES_PATH`, and `EDK_TOOLS_BIN` environment variables do not contain any spaces.
affects: All versions
breakingThe Project Mu Python packages for UEFI support and build tools have migrated to Tianocore and are now leveraged through `edk2-pytools`. This change implies that older build setups or documentation referencing Project Mu's tools may be outdated and require updates to align with the new `edk2-pytools` ecosystem.fixReview your build environment and scripts to ensure they are updated to use the `edk2-pytool-library` and `edk2-pytool-extensions` as part of the Tianocore `edk2-pytools` framework. Refer to the latest EDK2 build documentation for `stuart` (from `edk2-pytool-extensions`) for the current recommended patterns.
affects: Users migrating from Project Mu-based setups
gotchaThe `Edk2Path` class performs expensive package path and package validation during instantiation. If you are repeatedly using the same workspace root and packages path, it is strongly suggested to instantiate `Edk2Path` only once and pass that single instance to all consumers to avoid performance overhead.fixFor scenarios involving frequent path operations within a consistent EDK2 workspace, create a single instance of `Edk2Path` and reuse it, rather than creating new instances multiple times.
affects: All versions
breakingAn issue was reported (June 2023) where Capsule Update fails from the OS due to changes in `inf_generator`, specifically an integrity file's location not being updated alongside other changes, leading to a 'file not found' error.fixVerify if a fix for this specific `inf_generator` issue has been released. If encountering this, consult the `edk2-pytool-library` GitHub issues or Tianocore documentation for potential workarounds or updates to the `inf_generator` usage that correctly handles integrity file paths.
affects: Potentially versions prior to a fix (if implemented after June 2023). Users on current versions should test this functionality.
Upgrade
Version history
0.23.13latest on PyPI · released Apr 7, 2026
Audit
Dependencies
pythonrequiredRequired runtime environment.