Resolve
Resolves a package — and its transitive dependencies — into an isolated directory,
for trustedlicenses check. Independent of whatever installer the consuming project
actually uses. See Usage Guide § Checking a package before you add
it.
trustedlicenses.resolve_packages(packages, target)
Install packages and their transitive dependencies into target.
Tries uv pip install first, since it's an order of magnitude faster and
already this project's own tooling; falls back to python -m pip install
(available in nearly every Python installation) when uv isn't on PATH.
Neither call touches the current environment -- both install into target
only, via --target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
packages
|
list[str]
|
Package requirement strings (e.g. |
required |
target
|
Path
|
An existing, empty directory to install into. |
required |
Raises:
| Type | Description |
|---|---|
ResolutionError
|
Neither |
Source code in src/trustedlicenses/resolve.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
trustedlicenses.ResolutionError
Bases: Exception
Packages could not be resolved -- no installer available, or resolution failed.