<br><br>On Monday, August 22, 2016, Daniel Holth <<a href="mailto:dholth@gmail.com">dholth@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="line-height:1.5">Some obvious ideas about how to enable greater compression for pypi, should anyone be motivated enough to do so.</span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">1. If it's a zip, nested zips like so, </span><br></div><div><br></div><div>setup.py</div><div>README</div><div>(metadata)</div><div>data.zip</div><div><br></div><div>The metadata is easy to get to, and everything else requires a second unpack operation. data.zip is stored, and only compressed by the outer .zip. This could be done in a backwards compatible way.</div><div><br></div><div>Wheel could be revised to put everything except *.dist-info inside a zipped *.data directory.</div></div></blockquote><div><br></div><div>"""</div><div><p style="color:rgb(17,17,17);font-family:Lato,proxima-nova,'Helvetica Neue',Arial,sans-serif;font-size:medium;line-height:24px;background-color:rgb(238,238,238)">PEX is just a class that manages requirements (often embedded within PEX files as egg distributions in the .deps directory) and autoimports them into the sys.path, then executes a prescribed entry point.</p><p style="color:rgb(17,17,17);font-family:Lato,proxima-nova,'Helvetica Neue',Arial,sans-serif;font-size:medium;line-height:24px;background-color:rgb(238,238,238)">If you read the code closely, you'll notice that it relies upon monkeypatching zipimport. Inside the twitter.common.python library we've provided a recursive zip importer derived from Google's <a href="http://code.google.com/appengine/articles/django10_zipimport.html" style="color:rgb(0,0,119)">pure Python zipimport</a>module that allows for depending upon eggs within eggs or zips (and so forth) so that PEX files need not extract egg dependencies to disk a priori. This even extends to C extensions (.so and .dylib files) which are written to disk long enough to be dlopened before being unlinked.</p></div><div> """ - <a href="https://pantsbuild.github.io/pex_design.html#pex-__main__py">https://pantsbuild.github.io/pex_design.html#pex-__main__py</a></div><div><br></div><div>find_eggs_in_zip and find_wheels_in_zip in</div><div><a href="https://github.com/pantsbuild/pex/blob/master/pex/finders.py">https://github.com/pantsbuild/pex/blob/master/pex/finders.py</a><br></div><div>may be helpful for building a recursive zip importer</div><div>(Which may or may not reduce total pypi bandwidth because DEFLATE)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>2. Sign the uncompressed data</div><div><br></div><div>Check hashes and signatures against the .tar file instead of .tar.gz when doing pip install ... #sha256=nnn. For zip, check against a hash of all the hashes of the uncompressed members.</div><div><br></div><div>3. Go crazy</div><div><br></div><div>pypi is now free to re-compress without additional input from the publisher. Both .gz and .lzma versions etc. could be offered.</div></div>
</blockquote>