Trim distlib to only include scripts code #13342
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to #13337.
Distlib is our largest dependency. The vast majority of that is the Windows stub executables which we can't get rid of. However, distlib is a general purpose low-level packaging library, of which we only use the scripts module.
By line count, this results in a 5% reduction in the total (
_internal
and_vendor
) LOC of pip, which translates to ~250 KB of uncompressed and 64 KB of compressed (wheel) savings.I have a few more ways of reducing the size of our vendored dependencies, but they are more invasive changes with lower benefits. I'm only looking to propose simple tweaks that lead to a significant reduction. Broadly, I do not want to redefine our vendoring policy to say that we will or even plan to trim our dependencies. For example, the dependency groups dependency added in the
--group
PR has CLI functionality that we're never going to use but the code involved is so small (<100 LOC) that it isn't worth it.