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.

Announcing Pipenv

664 pointsby imkevinxuover 8 years ago

32 comments

cderwinover 8 years ago
This is great, but sometimes I think that python needs a new package manager from scratch instead of more tools trying to mix and mash a bunch of flawed tools together in a way that&#x27;s palatable by most of us. Python packaging sucks, the whole lot of it. Maybe I&#x27;m just spoiled by rust and elixir, but setuptools, distutils, pip, ez_install, all of it is really subpar. But of course everything uses pypi and pip now, so it&#x27;s not like any of it can actually be replaced. The state of package management in python makes me sad. I wish there was a good solution, but I just don&#x27;t see it.<p>Edit: I don&#x27;t mean to disparage projects like this and pipfile. Both are great efforts to bring the packaging interface in line with what&#x27;s available in other languages, and might be the only way up and out of the current state of affairs.
评论 #13460395 未加载
评论 #13460412 未加载
评论 #13460285 未加载
评论 #13460327 未加载
评论 #13466055 未加载
评论 #13460829 未加载
评论 #13462454 未加载
评论 #13461690 未加载
shaknaover 8 years ago
&gt; I wrote a new tool this weekend, called pipenv.<p>&gt; It harnesses Pipfile, pip, and virtualenv into one single toolchain. It features very pretty terminal colors.<p>For a weekend project, this has some very nice things.<p>Which removes the need for me to run my own project that basically does these things... In more or less, a worse way.<p>Everything I&#x27;ve come to expect from Reitz, and hopefully it&#x27;ll gain some decent ground like other projects of the same author.
therealmarvover 8 years ago
For people who want to do it right without using an additional tool read this: setup.py vs. requirements.txt by Donald Stufft <a href="https:&#x2F;&#x2F;caremad.io&#x2F;posts&#x2F;2013&#x2F;07&#x2F;setup-vs-requirement&#x2F;" rel="nofollow">https:&#x2F;&#x2F;caremad.io&#x2F;posts&#x2F;2013&#x2F;07&#x2F;setup-vs-requirement&#x2F;</a>
评论 #13460255 未加载
kalefranzover 8 years ago
Hey everyone. I&#x27;m Kale, currently the lead developer on the conda project. It&#x27;s been mentioned a few times in this thread, and I just want to make sure that any questions about it are answered accurately. Feel free to ask me anything about product conda. Thanks!
renesdover 8 years ago
Neat. Now for questions and comments.<p>Often people have a requirements.live.txt, or other packages depending on the environment. Is that handled somehow? Can we use different files or sections? [ED: yes, different sections]<p>Still wondering to myself if this is worth the fragmentation for most people using requirements.txt ? Perhaps the different sections could have a &quot;-r requirements.txt&quot; in there, like how requirements.dev.txt can have &quot;-r requirements.txt&quot;. [ED: the pipfile idea seems to have quite some people behind it, and pip will support it eventually. Seems it will be worth it to standardise these things. requirements.txt is a less jargony name compared to Pipfile though, and has a windows&#x2F;gui friendly extension.]<p>Other tools can set up an environment, download stuff, and run the script. Will pipenv --shell somescript.py do what I want? (run the script with the requirements it needs). ((I guess I could just try it.)) [ED: doesn&#x27;t seem so]<p>Why Pipfile with Caps? Seems sort of odd for a modern python Thing. It looks like a .ini file? [ED: standard still in development it seems. TOML syntax.]<p>With a setup.py set up, all you need to do is `pip install -e .` to download all the required packages. Or `pip install somepackage`. Lots of people make the setup.py file read the requirements.txt. Do you have some command for handling this integration? Or is this needed to be done manually? [ED: seems no considering about this&#x2F;out of scope.]<p>Is there a pep? [ED: too early it seems.]
评论 #13460054 未加载
conradevover 8 years ago
I&#x27;m surprised that no one has mentioned pip-tools: <a href="https:&#x2F;&#x2F;github.com&#x2F;nvie&#x2F;pip-tools" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nvie&#x2F;pip-tools</a><p>It&#x27;s a very similar set of tools. I use pip-compile which allows me to put all of my dependencies into a `requirements.in` file, and then &quot;compile&quot; them to a `requirements.txt` file as a lockfile (so that it is compatible with pip as currently exists).<p>This looks great, though, I&#x27;m excited to check it out!
评论 #13465343 未加载
throw2016over 8 years ago
I think an app should not expose end users to its dependencies. That leaves the end user with a lot of pain figuring out versions of dependencies and god forbid you need to compile some dep then you need a build environment and its dependencies any of which can fail in this chain leaving a very unpleasant and even hostile end user experience.<p>Ruby and Node apps are particularly guilty of this pulling in sometimes hundreds of packages some of which need compilation. Compare that to a Go binary which is download and use. These things can get very complicated very fast even for developers or system folks let alone end users who may not be intimately familiar with that specific ecosystem.
choxiover 8 years ago
Is this like Ruby&#x27;s Bundler for Python? I&#x27;ve just been getting into Python and am really glad to see this, thanks for creating it!
评论 #13460467 未加载
评论 #13460276 未加载
gourneauover 8 years ago
Hey other Reitz fans. Make sure to check out his newish podcast series: <a href="https:&#x2F;&#x2F;www.kennethreitz.org&#x2F;import-this&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.kennethreitz.org&#x2F;import-this&#x2F;</a>
olejorgenbover 8 years ago
Seems to be a python specific nix-shell like tool?<p>With nix[OS] you just run `nix-shell -p python[2,3] python[2,3]Pacakges.numpy ...` to get an environment with the required packages.<p>Of course this requires that the python library is packaged in nix, but in my experience the coverage is quite good, and it&#x27;s not very hard to write packages once you get the hang of it.<p>It also possible (but currently a bit clumsy in some ways) to set up named and persistent environments.
command_tabover 8 years ago
See also: <a href="https:&#x2F;&#x2F;github.com&#x2F;pypa&#x2F;pipfile" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pypa&#x2F;pipfile</a><p>I&#x27;m glad to see Python getting the same attention as other modern package managers. This is all great work!
caconym_over 8 years ago
I will definitely be trying this out. Python version and package management is a dumpster fire that wastes gobs of my time on the regular. I&#x27;ll try anything that promises to end the pain.
istoicaover 8 years ago
Finally someones does it! I was using: pip -t .pip in my code, avoiding virtual-env completely, but that was not enough and incomplete.<p>As this is not cross platform and it would be nice to switch between Linux&#x2F;Windows while coding to maintain platform compatibility, can the virtualenv envs be created with a os platform &amp; subsystem prefix ? for example, having multiple envs at once:<p><pre><code> - env&#x2F;posix&#x2F;bin&#x2F;activate - env&#x2F;nt&#x2F;Scripts&#x2F;activate.bat</code></pre>
zoulover 8 years ago
I always wonder if this could be done once and for all languages, instead of Ruby making bundler, Haskell Cabal sandboxes or stack, Perl Brew, etc. Is this where Nix is going?
评论 #13460382 未加载
评论 #13460524 未加载
评论 #13463141 未加载
jaybuffover 8 years ago
See also, pex: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=NmpnGhRwsu0" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=NmpnGhRwsu0</a>
nejdetckenobiover 8 years ago
normally I use virtualenvwrapper and that makes a virtualenv directory for all virtualenvs you create with it. before that, I always create my projects&#x27; venvs inside my project hierarchy.<p>I had a dilemma about it. But after all, you can not move your venv directory unless you use `--relocatable` option. So, anyone have a strong argument about creating venvs inside your project directory?
评论 #13460572 未加载
评论 #13460508 未加载
sametmaxover 8 years ago
I was really not a fan of the last &quot;made in Reitz&quot; project Maya. But this, I really can get along.<p>The whole things make it way easier to get started for a beginner. Now more activate. No more wondering about virtualenv. Automatic lock files are great since no project I know of use them since they are not well understood.<p>It&#x27;s like node_packages (easy and obvious), but cleaner (no implicit magic).<p>Like.
georgeaf99over 8 years ago
LinkedIn has a similar open source project that is much more mature. It builds on Gradle features to manage complex dependencies and build Python artifacts. If you include this LinkedIn Gradle Plugin [1] you can automatically run tests in a virtual env and source a file to enter the project&#x27;s virtual env.<p>PyGradle [2]: &quot;The PyGradle build system is a set of Gradle plugins that can be used to build Python artifacts&quot;<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;linkedin&#x2F;pygradle&#x2F;blob&#x2F;01d079e2b53bf9933aa786af1ec7dabcf964c669&#x2F;docs&#x2F;python.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;linkedin&#x2F;pygradle&#x2F;blob&#x2F;01d079e2b53bf9933a...</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;linkedin&#x2F;pygradle" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;linkedin&#x2F;pygradle</a>
helbover 8 years ago
<i>&gt; --three &#x2F; --two Use Python 3&#x2F;2 when creating virtualenv.</i><p>I use Python 2.7, 3.4, and 3.5 on various projects. Is there a way to choose between 3.4 and 3.5 using Pipenv? I&#x27;m using something like this with virtualenv:<p><pre><code> $ virtualenv -p `which python3.5` .venv</code></pre>
评论 #13462490 未加载
评论 #13463097 未加载
dvlover 8 years ago
Why people are trying to complicate things? requirements.txt are much simpler and better.
评论 #13470584 未加载
wyldfireover 8 years ago
I haven&#x27;t really used requirements.txt because I found that I could install &#x27;extra&#x27; and &#x27;test&#x27; specific content based on args to setup() in my setup.py. It seems more like the Right Thing than requirements.txt, from what I can tell.<p>At first glance, this doesn&#x27;t seem to offer anything beyond what I already see from setup(). What am I missing?<p>It&#x27;s unfortunate that CPython gave us distutils and took a very long time to converge on a built-in successor (setuptools?) that gives the right composability.
noway421over 8 years ago
This is very interesting! I had exact same question how to do it in python just a while ago! <a href="http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;41427500&#x2F;creating-a-virtualenv-with-preinstalled-packages-as-in-requirements-txt" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;41427500&#x2F;creating-a-virtu...</a><p>Glad that someone thought about similar thing and made a tool to solve it!
JeremyBanksover 8 years ago
&gt; Otherwise, whatever $ which python will be the default.<p>This is a bit strange because the python binary is always supposed to be Python 2. The Python 3 binary is supposed to be named python3. Some distributons don&#x27;t follow this, but they&#x27;re the weird non-conformant ones; it&#x27;s not a behaviour that should really be relied on.
评论 #13463391 未加载
评论 #13464301 未加载
评论 #13463094 未加载
mikhuangover 8 years ago
Uninstall by default removing everything seems a little scary. Otherwise looks really neat, looking forward to trying it
评论 #13461017 未加载
therealmarvover 8 years ago
Currently using fish and virtualfish. This seems incompatible to non bash shells. Did somebody tested?
评论 #13460095 未加载
btashtonover 8 years ago
Interesting. I have been leveraging tox to provide a lot of what this seems to give you, but it certainly has been more of a hack than a solution.
natmasterover 8 years ago
This is cool - it&#x27;s like yarn for python! :)
zyxzkzover 8 years ago
What took Python so long to get a tool like this?
评论 #13460554 未加载
评论 #13460106 未加载
lukasmover 8 years ago
Did anyone had a problem installing in on El Captain? I manage to do it with --user flag but the pipenv command doesn&#x27;t exist.
zephyrfalconover 8 years ago
A bit off-topic, but what font is used in the video&#x2F;animated GIF?
评论 #13460316 未加载
austonover 8 years ago
I can only express my gratitude, thank you Kenneth!
korijnover 8 years ago
Windows support?
评论 #13460188 未加载