TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Python requirements for Humans

78 pointsby Socketubsabout 9 years ago

6 comments

JulianWasTakenabout 9 years ago
This is a nice idea in theory, but setup.py and requirements.txt are not the same, and you cannot particularly generate one from the other:<p><a href="https:&#x2F;&#x2F;caremad.io&#x2F;2013&#x2F;07&#x2F;setup-vs-requirement&#x2F;" rel="nofollow">https:&#x2F;&#x2F;caremad.io&#x2F;2013&#x2F;07&#x2F;setup-vs-requirement&#x2F;</a><p>Also, unfortunately pip&#x27;s parser for requirements.txt isn&#x27;t public, like much of its internals at the moment, which means AIUI it&#x27;s likely that the parsing code here is going to be brittle if it uses it, or miss edge cases if it doesn&#x27;t. (I haven&#x27;t read this carefully yet though).
评论 #11332276 未加载
评论 #11329543 未加载
guitarbillabout 9 years ago
Python dependency management is a hard problem, but better than most languages [citation needed]. And `pip` and `setup.py` have emerged over several years, with several influences merged in (remember distutils?).<p>Honestly, I wish you&#x27;d picked a different tag-line though (riffing on `requests` no doubt). Unlike `requests`, your solution only works for a subset of deployment situations, because - as already pointed out - `setup.py` and `requirements.txt` are for different things.<p>One of the best examples for this I&#x27;ve seen is to use both to deploy to a server with no internet connectivity. For development the dependencies are installed from `setup.py`. Then, before deploying, all dependencies are downloaded via `pip download`. Put the dependencies on the server, finally, use `requirements.txt` with `--no-index` and `--find-links` to install. Definitely an <i>interesting</i> setup, but needs must. Unfortunately, your solution doesn&#x27;t support `--no-index`, `--find-links` and a few others.<p>You may want to have a look at tools like `pbr` (Python Build Reasonableness) [1], which has an interesting way of dealing with some hard problems. It also shows how to use `setup_requires` so you don&#x27;t have to have `requirements.py` hanging around in your repo.<p>[1] <a href="http:&#x2F;&#x2F;docs.openstack.org&#x2F;developer&#x2F;pbr&#x2F;" rel="nofollow">http:&#x2F;&#x2F;docs.openstack.org&#x2F;developer&#x2F;pbr&#x2F;</a>
评论 #11333184 未加载
评论 #11332774 未加载
mpdehaan2about 9 years ago
Ironically, the package to make your package requirements easier to write has additional requirements not in the core distribution :)<p>But more seriously, good idea in thinking that things should already be this way. The dual maintainance of the dependency list between setup.py and requirements.txt unfortunately leads to a lot of packages being left out of one or the other, or a package that works great from source that has a broken setup.py (which usually applies to everything I do).<p>A setup.py command for installing deps from setup.py would, to me, seem a bit more logical - but things already exist the way they do.<p>In the end though, it&#x27;s a bit weird to deviate from the standard norms of package installation, at least in Python circles, which may introduce some confusion -- contrast this with Javascript circles that replace &quot;the one true way&quot; about every 3 months :)
评论 #11330221 未加载
reidracabout 9 years ago
I see a problem with that &quot;License is MIT&quot;. That&#x27;s not how software is licensed and if the author wants this to be used, the legal part must be flawless.<p>Who&#x27;s the copyright holder? How can I contact that person? What&#x27;s the copyright year? Licensing software with MIT licence is trivial: <a href="http:&#x2F;&#x2F;choosealicense.com&#x2F;licenses&#x2F;mit&#x2F;" rel="nofollow">http:&#x2F;&#x2F;choosealicense.com&#x2F;licenses&#x2F;mit&#x2F;</a><p>Depending on the project, if I really care about the legal status of the code I use, I may contact the author to clarify this kind of thing, but sometimes it is too much hassle. Just look at it as a critical bug in your software, and fix it.<p>On a more personal note I started to dislike the &quot;* for humans&quot;, it&#x27;s been overused.
评论 #11331285 未加载
评论 #11331278 未加载
whalesaladabout 9 years ago
I wish the Python community would adopt a Bundler&#x2F;Gemfile style. The project.clj concept is also a fantastic approach. Environments should just be maps of data that you can modify or compose on the fly.
haldeanabout 9 years ago
How would you install a package that depended on this? You can&#x27;t install it&#x27;s dependencies automatically until you&#x27;ve got one of the dependencies installed.
评论 #11330162 未加载