<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 2, 2017, at 10:14 PM, Nathaniel Smith <<a href="mailto:njs@pobox.com" class="">njs@pobox.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On Fri, Jun 2, 2017 at 9:39 AM, Paul Moore <<a href="mailto:p.f.moore@gmail.com" class="">p.f.moore@gmail.com</a>> wrote:<br class=""><blockquote type="cite" class="">Note that there's an implication here - if we define the build process<br class="">in terms of the effect of "going via a sdist", then we need to at<br class="">least have an intuitive understanding of what that means in practice.<br class="">I don't think it's a contentious point (even if the specific term<br class="">"sdist" is open to debate), as I think repeatable builds are a<br class="">well-understood idea. (It's at this point that the concerns of people<br class="">who want incremental builds come in - we should support incremental<br class="">builds in a way that preserves the "just like going via a sdist"<br class="">principle. But again, they need to raise their concerns if they think<br class="">we're missing something key to their use case).<br class=""></blockquote><br class="">So far my belief is that packages with expensive build processes are<br class="">going to ignore you and implement, ship, document, and recommend the<br class="">direct source-tree->wheel path for developer builds. You can force the<br class="">make-a-wheel-from-a-directory-without-copying-and-then-install-it<br class="">command have a name that doesn't start with "pip", but it's still<br class="">going to exist and be used. Why wouldn't it? It's trivial to implement<br class="">and it works, and I haven't heard any alternative proposals that have<br class="">either of those properties. [1]<br class=""></div></div></blockquote><div><br class=""></div><div>If someone wants to implement a direct-to-wheel build tool and have it compete with ``pip install .`` they’re more than welcome to. Competition is healthy and at the very worst case it could validate either the idea that direct-to-wheel is important enough that people will gladly overcome the relatively small barrier of having to install another tool and then we have data to indicate maybe we need to rethink things or it could validate the idea that it’s not important enough and leave things as they are.</div><div><br class=""></div><div>I went and looked through all 105 pages of pip’s issues (open and closed) and made several searches using any keyword I could think of looking for any issue where someone asked for this. The only times I can find anyone asking for this were you and Ralf Gommers as part of the extended discussion around this set of PEPs and I’ve not been able to find a single other person asking for it or complaining about it. </div><div><br class=""></div><div>However, what I was able to find was what appears to be the original reason pip started copying the directory to begin with, <a href="https://github.com/pypa/pip/issues/178" class="">https://github.com/pypa/pip/issues/178</a> which was caused by the build system reusing the build directory between two different virtual environments and causing an invalid installation to happen. The ticket is old enough that I can get at specifics it because it was migrated over from bitbucket. However the fact that we *used* to do exactly what you want and it caused exactly one of problem I was worried about seems to suggest to me that pip is absolutely correct in keeping this behavior.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">Relatedly, the idea of a copy_files hook doesn't make sense to me. The<br class="">only reason pip wants to force builds through the sdist phase is<br class="">because it doesn't trust the backend to make clean wheels, and it's<br class="">willing to make its local directory builds much slower to get that<br class="">guarantee. When you add copy_files, you lose that guarantee *and*<br class="">you're still making local directory builds much slower, so what's the<br class="">point? If the always-via-sdist plan doesn't work for either the<br class="">simplest cases (flit) or the most complex (incremental builds), then<br class="">is it really a good plan?<br class=""></div></div></blockquote><div><br class=""></div><div>It’s not that I don’t trust the backend, it’s that I believe in putting in systems that make it harder to do the wrong thing than the right thing. As it is now building in place correctly requires the build backend to do extra work to ensure that some file that wouldn’t be included in the sdist doesn’t influence the build in some way. Given that I’m pretty sure literally every build tool in existence for Python currently fails this test, I think that is a pretty reasonable statement to say that it might continue to be a problem into the future.</div><div><br class=""></div><div>Copying the files makes that harder to do (but still easier than always going through the sdist). If you want to argue that we should always go through the sdist and we shouldn’t have a copy_files hook, I’m ok with that. I’m only partially in favor of it as a performance trade off because I think it passes a high enough bar that it’s unlikely enough for mistakes to be made (and when they do, they’ll be more obvious).</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">… <snip> ...<br class=""><br class="">- 'flit' adds code to make sdist-from-sdist work. (One way: when<br class="">building an sdist from a VCS checkout, make a list of all the<br class="">ancillary files and include it in the resulting sdist. Or possibly<br class="">just a list of all files + hashes. When asked to make an sdist from an<br class="">arbitrary directory, check for this file, and if present use it as the<br class="">list of ancillary files to include, and possibly check if any hashes<br class="">have changed, and if so change the version number of the resulting<br class="">sdist by appending "+dirty" or something; otherwise, use the current<br class="">VCS-based system.)<br class=""></div></div></blockquote><div><br class=""></div><div>This seems reasonable to me.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">One thing that's not clear to me: a crucial use case for sdists is (1)<br class="">download, (2) unpack, (3) patch the source, possibly adding new files,<br class="">(4) build and install. (After all, the whole reason we insist on<br class="">distributing sdists is that open source software should be modifiable<br class="">by the recipient.) Does flit currently support this, given the<br class="">reliance on VCS metadata?<br class=""><br class="">Other unresolved issues:<br class=""><br class="">- Donald had some concerns about get_wheel_metadata and they've led to<br class="">several suggestions, none of which has made everyone go "oh yeah<br class="">obviously that's the solution". To me this suggests we should go ahead<br class="">and drop it from PEP 517 and add it back later if/when the need is<br class="">more obvious. It's optional anyway, so adding it later doesn't hurt<br class="">anything.<br class=""></div></div></blockquote><div><br class=""></div><div>My main concern is the metadata diverging between the get_wheel_metadata and the building wheel phase. The current PEP solves that in a reasonable enough way (and in a way I can assert against). My other concerns are mostly just little API niggles to make it harder to mess up.</div><div><br class=""></div><div>I think this one is important to support because we do not to be able to get at the dependencies, and invoking the entire build chain to do that seems like it will be extraordinarily slow.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">- It sounds like there's some real question about how exactly a build<br class="">frontend should handle the output from build_wheel; in particular, the<br class="">PEP should say what happens if there are multiple files deposited into<br class="">the output dir. My original idea when writing the PEP was that the<br class="">build frontend would know the name/version of the wheel it was looking<br class="">for, and so it would ignore any other files found in the output dir,<br class="">which would be forward compatible with a future PEP allowing<br class="">build_wheel to drop multiple wheels into the output dir (i.e., old<br class="">pip's would just ignore them). It's clear from the discussion that<br class="">this isn't how others were imagining it. Which is fine, I don't think<br class="">this is a huge problem, but we should nail it down so we're not<br class="">surprised later.<br class=""></div></div></blockquote><div><br class=""></div><div>How do you determine the name/version for ``pip install .`` except by running get_wheel_metadata or build_wheel or build_sdist?</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">-n<br class=""><br class="">[1] Donald's suggestion of silently caching intermediate files in some<br class="">global cache dir is unreasonably difficult to implement in a<br class="">user-friendly way – cache management is Hard, and I frankly I still<br class="">don't think users will accept individual package's build systems<br class="">leaving hundreds of megabytes of random gunk inside hidden<br class="">directories. We could debate the details here, but basically, if this<br class="">were a great idea to do by default, then surely one of<br class="">cmake/autoconf/... would already do it? Also, my understanding is the<br class="">main reason pip wants to copy files in the first place is to avoid<br class="">accidental pollution between different builds using the same local<br class="">tree; but if a build system implements a global cache like this then<br class="">surprise, now you can get pollution between arbitrary builds using<br class="">different trees, or between builds that don't even use a local tree at<br class="">all (e.g. running 'pip install numpy==1.12.0' can potentially cause a<br class="">later run of 'pip install numpy==1.12.1' to be corrupted). And, it<br class="">assumes that all build systems can easily support out-of-tree<br class="">incremental builds, which is often true but not guaranteed when your<br class="">wheel build has to wrap some random third party C library's build<br class="">system.<br class=""><br class=""></div></div></blockquote><div><br class=""></div><div><br class=""></div><div>Make it opt-in and build a hash of the directory into the cache key so different file contents mean different cache objects then. I’m not really sold on the idea that the fact some developers haven’t decided to do it then it is a bad idea. Perhaps those build systems are operating under different constraints than we are (I’m almost certainly sure this is the case).</div></div><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class="">—<br class="">Donald Stufft<br class=""></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><br class="Apple-interchange-newline">
</div>
<br class=""></body></html>