LWN: Comments on "Remote imports for Python?" https://lwn.net/Articles/732194/ This is a special feed containing comments posted to the individual LWN article titled "Remote imports for Python?". en-us Sun, 05 Oct 2025 03:32:35 +0000 Sun, 05 Oct 2025 03:32:35 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Remote imports for Python? https://lwn.net/Articles/733301/ https://lwn.net/Articles/733301/ Garak <div class="FormattedComment"> DWA, my new TLA of the day, thx. I think the DWA angle is interestingly core here. The modern world being a smaller place has had this evolution of putting oddities, and perhaps a shrinking amount of scattered human suffering under a metaphoric microscope. The sorts of news stories that make the feeds as well as the mainstream news are a lot like this. And unfortunately, the sensationalism outweighing a more rationally weighted perception seems to be the rule in this day and age. (Of course a lot more was more easily hidden from the public in the past, not claiming things overall were obviously better historically).<br> <p> What I'm thinking in response to your comment is that such arguments of trying to protect people from shooting themselves in the foot don't seem that persuasive to me. I see a vast diverse ecosystem of developers, and I'm personally not bothered by the DWA factor. The news industry won't let the DWA factor fade, they'll just add another lense to that microscope and give people the entertaining idiot story to laugh at or be scared of for a moment.<br> <p> Of course the example that comes to mind above is bannning swimming pools to save children because of course some parents who choose to have pools will fail, and kids will die. Somehow, for reasons I couldn't map out in a thesis, I'm more worried about the swimming pools than the dangers being talked about here if the feature gets added. And I've been able to swim for 3 decades now. I mean seriously, there will always be ways for software developers and businesses that rely on them to metaphorically shoot themselves in the foot. I don't see this as significantly effecting that in the long term. But OTOH, the obvious FOSS answer is - Fork Python if you care enough. Let the fittest thrive the most in the ecosystem. Somehow I doubt anyone cares about this feature that much. But it made for some sensationalist reaction commentary with academic entertainment value.<br> </div> Sun, 10 Sep 2017 05:32:53 +0000 Remote imports for Python? https://lwn.net/Articles/732772/ https://lwn.net/Articles/732772/ johan <div class="FormattedComment"> <font class="QuotedText">&gt; It's not really any different then how people get software now. It just cuts out steps. </font><br> <p> It could potentially cut out pip from the loop yes, but how hard is a "pip install" anyway?<br> We are not talking about simplifying something that is currently complex, we are talking about shaving of a few minutes at max in their workflow.<br> So why should we need yet another way to do the same thing in a slightly less secure manner?<br> <p> Personally i see this httpimport as a great library, but I don't see much reason to add it to the python standard library.<br> There's probably more people afraid of the security of python than who wants this feature, so adding it to the python standard library doesn't make sense.<br> </div> Sun, 03 Sep 2017 07:13:41 +0000 Remote imports for Python? https://lwn.net/Articles/732719/ https://lwn.net/Articles/732719/ sasha <div class="FormattedComment"> Here in Russia, the government authorities can block access to some IPs. At some point they blocked access to GitHub (I do not remember the reason: hate speech or substances). It broke a lot of things for large corporations, so GitHub was immediately unblocked. The programmers explained that they were following "the world best practices".<br> <p> The possibility to replace a curl script with direct python import changes nothing here.<br> </div> Sat, 02 Sep 2017 17:34:29 +0000 Remote imports for Python? https://lwn.net/Articles/732702/ https://lwn.net/Articles/732702/ robert_s <div class="FormattedComment"> The "distro build package" step you mention here is actually more like: distro build package, run tests, make sure it works properly with all the other components of the distro.<br> <p> And most importantly, if a package author goes AWOL or starts adding things that might not be in the users interest, the distro has the ability to patch the code or even transparently switch to a different upstream.<br> </div> Sat, 02 Sep 2017 11:45:16 +0000 Remote imports for Python? https://lwn.net/Articles/732606/ https://lwn.net/Articles/732606/ syops <p>I do find myself wishing <a href="https://www.w3.org/TR/SRI/">Subresource Integrity</a> could be generalized to work with any HTTP GET. As it stands, SRI provides the resource in the src or href attribute, and the hash (or <a href="https://github.com/mikewest/signature-based-sri/blob/master/README.markdown">signature</a>?) in a separate attribute. But that doesn't help with any arbitrary simple http application or library. Requests, pip and our favorite <code>curl | sudo bash</code> aren't designed to checksum the data they're fetching. I'd like to think this could be solved in a future implementation of http (maybe rolling hashes could be used to avoid the pitfall of the client having to stage and hash a very large download before writing it to disk), but I'm a dreamer.</p> <p>Then again, there's always <a href="https://ipfs.io/">IPFS</a>. As I understand it, with IPFS, the hash <em>is the address</em> of the content.</p> Fri, 01 Sep 2017 13:52:59 +0000 Remote imports for Python? https://lwn.net/Articles/732604/ https://lwn.net/Articles/732604/ bandrami <div class="FormattedComment"> from leftpad import unpredictability<br> </div> Fri, 01 Sep 2017 13:20:07 +0000 Remote imports for Python? https://lwn.net/Articles/732598/ https://lwn.net/Articles/732598/ amarao <div class="FormattedComment"> There is a huge difference between 'direct from http' and apt-get (yum) install.<br> <p> 1. when we compile anything from external git we clone it into our git.<br> 2. Normally all code comes with tests and those tests are executed at build time (at CI)<br> 3. Packages are artifacts, they are stored and used every time in pristine manner to rebuild working environment on each run.<br> <p> If you replace whole build-&gt;publish-&gt;install cycle, you will have flaky production. What if there was a hiccup in the connectivity during installation? What if author pushed new version between deploying two servers with same dependencies (but their subdependencies unpinned?).<br> <p> Best practice for DevOps:<br> <p> 1. Everything can be rebuild and deployed automatically.<br> 2. And we have it sources.<br> 3. On our premises<br> 4. Even build system and jobs can be rebuild from git.<br> 5. Every deploy can be repeated in precise manner.<br> 6. Everythin committed is covered by tests.<br> </div> Fri, 01 Sep 2017 10:07:01 +0000 Remote imports for Python? https://lwn.net/Articles/732590/ https://lwn.net/Articles/732590/ anselm <blockquote><em>Good engineering discipline is in precious short supply nowadays...</em></blockquote> <p> It seems to me that a software system whose installation procedure is based on piping the output of <tt>curl</tt> into a local root shell forfeits any claim to “good engineering discipline” right there. </p> Fri, 01 Sep 2017 01:12:56 +0000 Remote imports for Python? https://lwn.net/Articles/732587/ https://lwn.net/Articles/732587/ ThinkRob <div class="FormattedComment"> <font class="QuotedText">&gt; From the article I get the impression that this feature is meant for really rapid prototyping or testing. </font><br> <p> The road to hell is paved with good intentions.<br> <p> There is no doubt in my mind that as soon as this feature hits mainline, that a whole bunch of shops with "Agile" in their job descriptions are gonna go "Sweet, we don't need a build system anymore!" and run with it.<br> <p> Remember: this is the reality in which something like 20% or whatever of npm modules broke when 'leftpad' went away. Good engineering discipline is in precious short supply nowadays...<br> </div> Fri, 01 Sep 2017 00:53:21 +0000 Remote imports for Python? https://lwn.net/Articles/732561/ https://lwn.net/Articles/732561/ lsl <div class="FormattedComment"> Right, although it's even more layered than that.<br> <p> To the compiler, import paths are opaque strings used for identifying a given module/package.<br> <p> The 'go' build tool (roughly equivalent to what you would use CMake or whatever for in a C-based project) interprets them as file system references inside GOPATH and uses them to figure out what source files to pass to the compiler.<br> <p> Only 'go get' tries to infer a remote location from them. What 'go get' does is let you say "clone this repo without making me figure out whether it uses Git, Mercurial or SVN and put it where the build system will pick it up". It's a convenience wrapper around VCS tools and is inherently targeted at developers, not users. You don't want to use it at deploy time.<br> <p> Thus, Torakis' Go analogy is a bogus one.<br> </div> Thu, 31 Aug 2017 19:38:40 +0000 Remote imports for Python? https://lwn.net/Articles/732562/ https://lwn.net/Articles/732562/ k8to <div class="FormattedComment"> Python is definitely incapable of meaningfully sandboxing.<br> <p> That aside, the proposal for supporting it with a hash seems sort of vaguely OK, but I don't see the point. If you know the content you want to run ahead of time, why do you need to load it dynamically? I expect the major use pattern at that point will be people who write some code to generate the hash dynamically and then httpimport it, or in other words, the path of laziness.<br> </div> Thu, 31 Aug 2017 19:32:07 +0000 Remote imports for Python? https://lwn.net/Articles/732553/ https://lwn.net/Articles/732553/ cesarb <div class="FormattedComment"> I don't know if it has already been mentioned on the thread, but there's another problem with remote imports: reliability. A local import can work even offline; a remote import depends on both the remote server and the network being up every time the process is started.<br> </div> Thu, 31 Aug 2017 16:44:55 +0000 Remote imports for Python? https://lwn.net/Articles/732544/ https://lwn.net/Articles/732544/ gioele <div class="FormattedComment"> <font class="QuotedText">&gt; It searches for it, makes an RPM spec file, builds and installs it, and submits the source package for inclusion in Fedora?</font><br> <p> It is not that automated, but the Debian packages for many Rubygems are created, built and semi-automatically updated in a similar way, using gem2deb and gemwatch.<br> </div> Thu, 31 Aug 2017 15:57:16 +0000 Remote imports for Python? https://lwn.net/Articles/732511/ https://lwn.net/Articles/732511/ bernat <div class="FormattedComment"> Go doesn't have this feature either. Package names look like an URL but are just names. "go get" will interpret them as URL (with a builtin set of rules), fetch them and put them in GOPATH for the compiler to find them.<br> </div> Thu, 31 Aug 2017 12:09:26 +0000 Remote imports for Python? https://lwn.net/Articles/732493/ https://lwn.net/Articles/732493/ dunlapg <p><blockquote>As Torakis's age post indicates, there may be something of a generation gap surrounding this issue. The GitHub-centric, rapid-fire development style meets the grizzled graybeards who still sport some of the scars of security issues past.</blockquote> <p>I think it's worth noting that in the world the actual greybeards grew up in was a world of open ports and unsecured SMTP relays -- a world where you typed your password in the clear into telnet and ftp. In other words, a world just as trusting and impatient as the "curl http://somecode.com/install.sh | sudo sh" crowd. The difference is not one of culture or personality, it's one of experience. Thu, 31 Aug 2017 08:52:58 +0000 Remote imports for Python? https://lwn.net/Articles/732495/ https://lwn.net/Articles/732495/ Sesse <div class="FormattedComment"> So what happens when you want to move from e.g. Gitlab to Github (or your URL becomes inaccessible for any other reason), but there's 200k users out there with your module URL hard-coded in their imports?<br> <p> /* Steinar */<br> </div> Thu, 31 Aug 2017 08:45:26 +0000 Remote imports for Python? https://lwn.net/Articles/732494/ https://lwn.net/Articles/732494/ lamby <div class="FormattedComment"> "age post" ?<br> </div> Thu, 31 Aug 2017 08:44:20 +0000 Remote imports for Python? https://lwn.net/Articles/732484/ https://lwn.net/Articles/732484/ jwilk <div class="FormattedComment"> <font class="QuotedText">&gt; [HTTPS] surely was not in widespread use by 1995.</font><br> <p> Indeed. HTTPS support was added to stdlib in Python 2.0, released in 2000.<br> <p> Source: <a href="https://docs.python.org/3/whatsnew/2.0.html#module-changes">https://docs.python.org/3/whatsnew/2.0.html#module-changes</a><br> </div> Thu, 31 Aug 2017 07:17:22 +0000 Remote imports for Python? https://lwn.net/Articles/732479/ https://lwn.net/Articles/732479/ smckay <div class="FormattedComment"> Homebrew is pretty dang good these days. It's basically Portage on OSX except the default build configuration has binaries available.<br> </div> Thu, 31 Aug 2017 03:12:38 +0000 Remote imports for Python? https://lwn.net/Articles/732474/ https://lwn.net/Articles/732474/ drag <div class="FormattedComment"> <font class="QuotedText">&gt; So maybe not an import-from-URL, but more of an "auto-pip", where everything is hosted and vetted?</font><br> <p> I suppose so. <br> <p> I like how Debian does it with apt-get. You have a signed list of packages with their checksums and locations and mirrors. You could mirror the file local to the list or on any server really. Then you don't have to really care where or how they are stored because you have their checksums in a secure manner. Https vs http vs ftp vs nfs mount or whatever... doesn't matter. <br> <p> Nothing revolution or weird or remarkable or even that much different. The difference between this sort of setup versus distro packages is that it would be OS agnostic since it would be largely source code based. The same list of packages would be for OS X vs Linux vs Windows or whatever. <br> <p> Of course the crappy part is that some packages would require all libraries being present for compiling. I know that is relatively easy for Linux, but I don't know what that is like to setup for OS X or Windows. <br> </div> Thu, 31 Aug 2017 01:20:34 +0000 Remote imports for Python? https://lwn.net/Articles/732414/ https://lwn.net/Articles/732414/ epa <div class="FormattedComment"> It searches for it, makes an RPM spec file, builds and installs it, and submits the source package for inclusion in Fedora?<br> </div> Wed, 30 Aug 2017 17:11:20 +0000 Remote imports for Python? https://lwn.net/Articles/732412/ https://lwn.net/Articles/732412/ adam820 <div class="FormattedComment"> So maybe not an import-from-URL, but more of an "auto-pip", where everything is hosted and vetted? If you stick an import in the code, and then try to run it but it doesn't have it, it just searches for it and auto-downloads it?<br> </div> Wed, 30 Aug 2017 16:49:06 +0000 Remote imports for Python? https://lwn.net/Articles/732407/ https://lwn.net/Articles/732407/ jezuch <div class="FormattedComment"> <font class="QuotedText">&gt; Nowhere is mentioned that this should come anywhere near production code.</font><br> <p> You're right, but that doesn't mean that it won't. I guess a Daily WTF article about some "quick hack" like this that ended up in production ("just temporarily, promise!"), won't be long coming :)<br> </div> Wed, 30 Aug 2017 16:41:40 +0000 Remote imports for Python? https://lwn.net/Articles/732376/ https://lwn.net/Articles/732376/ drag <div class="FormattedComment"> It's not really any different then how people get software now. It just cuts out steps. <br> <p> <p> Currently if you use pip it goes like this:<br> <p> https server --&gt; pip install foo --&gt; import foo<br> <p> If you use distro supplied packages it is like this:<br> <p> https server ---&gt; distro build package ---&gt; https server ---&gt; yum install python-foo --&gt; import foo<br> <p> In a real sense it's not a whole lot different then just going:<br> <p> https server ---&gt; import foo<br> <p> In every case the original source of trust is the https server. Even the deb or rpm package signatures doesn't confirm that the original code wasn't pulled from a compromised source. Sometimes distros can audit the code, but that only happens for a minority of packaged software.<br> <p> If security is really the priority then the real way to do it is to have the original developers sign a tarball or package of the source code prior to ever being posted to anything touching the internet and then establish a chain of trust all the way through to the end user. The easiest way to do that may just be to eliminate as many layers between end users and developers as possible. This doesn't prevent a third party from auditing the source code and giving their official blessing to specific revisions.<br> </div> Wed, 30 Aug 2017 16:29:46 +0000 Remote imports for Python? https://lwn.net/Articles/732355/ https://lwn.net/Articles/732355/ niner <div class="FormattedComment"> From the article I get the impression that this feature is meant for really rapid prototyping or testing. The httpimport module's documentation talks about testing pull requests. Nowhere is mentioned that this should come anywhere near production code. Having to get a checksum of some remote module first negates the speed benefits. And people who think about security at all will know not to use httpimport in production code.<br> <p> That said, it _is_ a good idea when downloading remote code is indeed wanted. Some Perl 6 modules for example are just bindings for native libraries. To simplify installation on Windows, their installation may involve downloading DLLs and it's common to use checksums to secure that.<br> </div> Wed, 30 Aug 2017 07:22:35 +0000 Remote imports for Python? https://lwn.net/Articles/732352/ https://lwn.net/Articles/732352/ mokki <div class="FormattedComment"> Java has tried to support this for 20+ years with signed remote packages and a sandbox.<br> <p> 99% of security bugs reported against java in the last 5 years have been about remote code escaping the sandbox.<br> <p> Why would python want that security circus? It just makes the language seem bad when actually 99.9% of code never uses the remote execute feature and thys does not even enable the sandbox.<br> <p> Enabling this in python without sandbox would be security nightmare and supporting a sandbox is known to be security nightmare.<br> </div> Wed, 30 Aug 2017 06:53:08 +0000 Remote imports for Python? https://lwn.net/Articles/732350/ https://lwn.net/Articles/732350/ josh <div class="FormattedComment"> Likewise, that would be quite helpful.<br> <p> Or the hash of a public key matching the private key the module is signed with.<br> </div> Wed, 30 Aug 2017 05:04:49 +0000 Remote imports for Python? https://lwn.net/Articles/732342/ https://lwn.net/Articles/732342/ smckay <div class="FormattedComment"> I find it difficult to take the guy at face value. Compared to the alternatives, the value of remote code loading as a language feature is mostly making exploits easier. Everyone who actually wants this terrible misfeature can google "Python import from URL" and be good to go in 2 minutes. <br> </div> Wed, 30 Aug 2017 03:53:34 +0000 Remote imports for Python? https://lwn.net/Articles/732340/ https://lwn.net/Articles/732340/ luto <div class="FormattedComment"> I'm surprised no one has suggested doing this but making it mandatory for the import call to include a hash of the module.<br> </div> Wed, 30 Aug 2017 03:39:31 +0000 Remote imports for Python? https://lwn.net/Articles/732338/ https://lwn.net/Articles/732338/ bferrell <div class="FormattedComment"> I'm guessing the lesson from "deprecated" javascript module was lost on this person.<br> </div> Wed, 30 Aug 2017 02:57:38 +0000