Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Use PKG-INFO and METADATA to infer package names in pip analysis #292

Merged
merged 2 commits into from
Feb 1, 2019

Conversation

nkubala
Copy link
Contributor

@nkubala nkubala commented Jan 25, 2019

Fixes #287

This code adds improvements to the pip analyzer to produce more accurate results for installed Python packages, by using required (read: encouraged) metadata files in egg and wheel packages.

Some packages do not always adhere to these conventions, so in the event we can't use the expected metadata files, we fall back on the original heuristic of checking directories with similar names and assuming those are the corresponding directories. This code slightly modified this heuristic from checking the "previous alphabetical entry" to checking the previous and next entries, and doing a string comparison to match the package name. This gives more accurate results, for example with egg bzr-2.8.0dev1.egg-info and matching code directory bzrlib.

Note: this code modifies results from container-diff to include all installed python packages, not just those explicitly installed through pip. This means the results will be different than what is retrieved by running pip list, but gives more insight into what dependencies have been installed.

@nkubala nkubala merged commit 5b5e627 into GoogleContainerTools:master Feb 1, 2019
@nkubala nkubala deleted the pip_metadata branch February 1, 2019 18:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant