Comment 4 for bug 1903605

Revision history for this message
Shivaram Lingamneni (slingamn) wrote :

Requests is a "kitchen-sink" library that's really more suitable for webapps and suchlike. It bundles its own certificate store (python3-certifi), which was necessary back when Python didn't verify SSL/TLS certificates by default, but is no longer needed on Linux. (In fact, updates to python3-certifi currently seem to be lagging behind updates to ca-certificates.) It also includes a character encoding detection library (python3-chardet), which is unnecessary in a systems context like software-properties or apport. (The dependencies on python3-idna and python3-urllib are similar.)

So there are concrete performance costs to pulling all of this code in; on my system, importing `requests` consumes an additional 10 MB of memory relative to just importing `json` and `http.client`. (It also takes an extra 100 milliseconds, which might be a secondary concern.)

ddstreet also had concerns about the size of the bundled shim code. In this MR, he refactored it so that the only bundled code is `UHTTPConnection`, which is just a few lines:

https://code.launchpad.net/~ddstreet/software-properties/+git/software-properties/+merge/396926

I could do something similar for apport.

Thanks for your time!