[09:15:38] <hellp> It seems pip doesn't use its cache when installing something from a custom web server via --find-links. Correct? Can I configure it to do so? Does my web server has to set specific headers?
[11:08:40] <dstufft> hellp: It uses the standard HTTP cache mechanisms, so it's looking for CacheControl headers, ETag headers, LastModified headers etc
[11:09:49] <dstufft> hellp: any combination of that will cause pip to start using it's cache to varying degrees, the CacheControl header wll cause pip to cache things for X seconds (as defined in the CacheControl header, except with a maximum of 10 minutes for non package files), the Etag and Last-Modified headers will cause pip to attempt to use conditional GETs to download things instead of uncdontionally fetching whenever the cache expires
[11:19:26] <hellp> dstufft: thx for the info. I'm using nginx with the simple "autoindex: on" directory listing feature. No Etags, but Last-Modified reports the correct timestamp for the file (2 months old in this case). Should that be enough for pip?
[11:20:08] <dstufft> hellp: you probably want to include something like expires 1d; or however long you want the file cached for
[11:21:42] <hellp> dstufft: ok, I'll look into it. My main concern was that it wasn't supported for --find-links at all.
[11:22:00] <dstufft> It should work yea, it just needs all the right headers
[13:17:48] <malinoff> so can I somehow get a wheel/tar.gz from already installed library without downloading it again? consider pip cache is invalidated
[13:34:36] <malinoff> ronny, so to solve my issue, I can imagine the following workflow: ssh to remote machine, pip install virtualenv; create a virtual env; install the library within; further work is within this venv; is it ok? what is the best place for such venv?
[13:34:58] <ronny> pf_moore: how can one use it to package a app from a number of wheels?
[13:36:19] <pf_moore> You can't. It's deliberately minimal. But how is packaging an app from wheels hard? You just unzip all the wheels, add your driver script as __main__ and zip he whole lot up.
[13:37:12] <pf_moore> zipapp is really just providing a utility for doing that in simple cases where everything is already unpacked, more as publicity for the feature that's been around since Python 2.6, than as a full-featured tool
[13:39:05] <pf_moore> ronny: The fun bit is finding the wheels, downloading them, doing dependency stuff, etc.
[13:41:13] <pf_moore> I keep thinking I should write a script that takes a requirements file, does pip install -t DIR -r requirements.txt, adds a __main__.py and zips it up
[13:41:26] <pf_moore> But it's so trivial to do by hand I've never bothered...
[13:41:55] <pf_moore> And there's always corner cases that mean I want something slightly different, so "by hand" ends up being better...
[13:42:15] <pf_moore> It's not the doing it that's hard, it's the UI design for making it general.
[13:50:13] <apollo13> pf_moore: in fairness I knew about it, but never really had a usecase, hence never looked in detail
[13:50:14] <pf_moore> But yeah, if you have C extensions you can't run them from zipfile. That's a platform limitation (all platforms) not a Python one
[13:50:16] <malinoff> sorry for rocking the #pypa board :)
[13:51:39] <dstufft> Google has something cool - they have their systems patched so that dlopen can take an offset
[13:51:48] <pf_moore> dstufft: yeah, py2exe does it by loading the dll from in-memory, but that's for Windows, and it's a bit obscene...
[13:52:09] <dstufft> so they can dlopen from a zipfile by not compressing the zipfile, and just passing explicit offsets to where the .so is inside of the zipfile
[13:52:16] <dstufft> er, not compressing that part of the zipfile*
[13:52:27] <pf_moore> but I think Barry is looking at extract on demand, which works everywhere but potentially leaves a bit of tempfile clutter
[13:53:45] <pf_moore> dstufft: In theory anywhere could do it by extracting the .so/.dll into memory then memory-mapping that "as if" it were a dynamic lib. It's whether the OS loader lets you do that that's the fun bit.
[13:53:52] <apollo13> that is something I could do in a custom import hook with my main, no?
[13:54:00] <pf_moore> But hey, on Linux you have the source code, so you can code it yourself ;-)
[13:54:17] <pf_moore> apollo13: Sorry, back to reality. Yes you could
[13:54:32] <dstufft> pf_moore: yea, I think probably long term the best way forward on that is to have a list of ways we can support that and select the "best" method based on the platform
[13:54:34] <pf_moore> It's fiddly but doable (it;'s what setuptools does, I believe)
[13:54:35] <apollo13> but? I mean tempdir + atexit handler sounds somewhat sane
[13:55:20] <pf_moore> apollo13: IIRC (I've never looked at this in detail) the trick is extracting at the right time so that the tempdir is on sys.path when you need it.
[13:55:30] <ronny> apollo13: i use whl import to run virtualenv from a rsynced download folder
[13:55:37] <pf_moore> apollo13: it looks if the file format is correct so filename is irrelevant