whl2conda.api.compare¶
Semantic comparison of conda packages.
This module compares two conda packages - typically one generated by whl2conda from a PyPI wheel and a reference package built from a recipe (e.g. by conda-build or rattler-build for conda-forge) - and reports their differences, classifying each as expected (benign differences inherent to the different build processes), notable, or unexpected errors.
Classes¶
CompareOptions
dataclass
¶
Options controlling conda package comparison.
Source code in src/whl2conda/api/compare.py
Attributes¶
extra_run_exports
class-attribute
instance-attribute
¶
Additional dependency names treated as benign run-exports.
ignore
class-attribute
instance-attribute
¶
Categories demoted to EXPECTED severity.
renames
class-attribute
instance-attribute
¶
pypi to conda package rename map.
Defaults to the standard rename table from load_std_renames.
strict
class-attribute
instance-attribute
¶
Promote NOTICE differences to ERROR.
ComparisonResult
dataclass
¶
Result of comparing two conda packages.
Source code in src/whl2conda/api/compare.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
Attributes¶
differences
instance-attribute
¶
All differences found, including expected ones.
Functions¶
report ¶
Generate a human readable report.
| PARAMETER | DESCRIPTION |
|---|---|
min_severity
|
only include differences of at least this severity. |
| RETURNS | DESCRIPTION |
|---|---|
str
|
Multi-line report string. |
Source code in src/whl2conda/api/compare.py
to_json ¶
JSON-compatible dictionary representation.
Source code in src/whl2conda/api/compare.py
DiffCategory ¶
Bases: Enum
Category of a difference between two conda packages.
Source code in src/whl2conda/api/compare.py
Difference
dataclass
¶
A single difference between two conda packages.
Source code in src/whl2conda/api/compare.py
Severity ¶
Bases: IntEnum
Severity of a difference between two conda packages.
Source code in src/whl2conda/api/compare.py
Attributes¶
ERROR
class-attribute
instance-attribute
¶
Unexpected difference that likely indicates a problem.
EXPECTED
class-attribute
instance-attribute
¶
Benign difference inherent to the different build processes.
NOTICE
class-attribute
instance-attribute
¶
Notable difference that is not necessarily a problem.
Functions¶
compare_conda_packages ¶
compare_conda_packages(
package1: Path,
package2: Path,
*,
options: CompareOptions | None = None
) -> ComparisonResult
Semantically compare two conda packages.
The comparison is directional: package1 is the package under
test (e.g. generated by whl2conda) and package2 is the reference
package (e.g. from conda-forge). Differences that are inherent to
the different build processes are reported with EXPECTED severity;
differences that likely indicate a conversion problem are reported
as errors.
| PARAMETER | DESCRIPTION |
|---|---|
package1
|
TYPE:
|
package2
|
TYPE:
|
options
|
comparison options.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ComparisonResult
|
Comparison result with the list of differences found. |