Live data from Hacker News

Pipenv: Python Dev Workflow for Humans

pipenv.pypa.io

41–50 of 64 posts

Re: Pipenv: Python Dev Workflow for Humans

#41
post #8

About a year ago or so I moved to pyenv and poetry. I have used python for over 10 years it was a game changer. I recommend this guide if your still using pip and venv. https://cjolowicz.github.io/posts/hypermodern-python-01-setu...

Is this not applicable to Windows? The article mentions Unix, Linux, and Mac. Sorry for the n00b question; I'm just an amateur Python data analyst.

Re: Pipenv: Python Dev Workflow for Humans

#42

EW. Avoid. For the tenth time in these comments, use poetry. It's a real shame PyPA endorsed this to be honest, I hope that can be reversed at some point in the future.

Poetry is basically perfect, it does what it says and has no surprises. Well, except one thing: If I do `poetry update `, it starts upgrading other packages as well. I'm not sure what that's about...

Poetry is great but sometimes I finding jarring that its error messages show up in the terminal with the full python exception as well.

Re: Pipenv: Python Dev Workflow for Humans

#43
post #36
post #33

Earlier quoted context omitted.

What do you mean? If you run pip freeze inside a venv it will print every user-installed module and their dependencies. When installing them in a new venv as a requirements file, you end up with the exact same set of modules.

Agree. Works fine for me exactly as you describe. I don't understand why people furiously want more than this for the common case. (Choose python version, create .venv/ directory, install packages, use installed .venv/ and do work.)

What happens when you use a different version of the same library that a dependency uses?

Re: Pipenv: Python Dev Workflow for Humans

#44
post #40

Earlier quoted context omitted.

Poetry is basically perfect, it does what it says and has no surprises. Well, except one thing: If I do `poetry update `, it starts upgrading other packages as well. I'm not sure what that's about...

As long as you install it correctly, which can be difficult on systems where python2 is the default.

Actually, I tried that the other day. It complains about having the wrong Python, but will auto-select a version compatible with your project and run fine. For me, it selected Python 3.7 because that's what the pyproject.toml specified, even though I was running it under Python 2.

Re: Pipenv: Python Dev Workflow for Humans

#45
post #34

Seeing all the comments in this thread that people have had bad experiences with pipenv, this contrasts with my own experience which has been pretty good. How has pipenv failed for everyone? Gonna take a look at poetry, but would love to hear what problems people have had with pipenv?

1. Dependency resolution algorithm failed in places that Poetry handles fine.

2. When Airflow added a dependency choice (based on licences) the setup script required an ENV var choosing one to be set, pipenv swallowed the stdout output and dumped a Pip stacktrace that didn't help diagnose the issue.

3. Mysterious bugs on new pipenv releases that usually manifested as a Pip stack-trace or setuptools stack-trace.

4. Sometimes the bugs were installed Pip version dependent, which made replication hard.

There was other stuff, but can't quite remember off the top of my head.

But yeah, we spent a lot of time trying to figure out why pipenv had broken again. Poetry has been a breeze in comparison.

Re: Pipenv: Python Dev Workflow for Humans

#46
post #8

About a year ago or so I moved to pyenv and poetry. I have used python for over 10 years it was a game changer. I recommend this guide if your still using pip and venv. https://cjolowicz.github.io/posts/hypermodern-python-01-setu...

Is this not applicable to Windows? The article mentions Unix, Linux, and Mac. Sorry for the n00b question; I'm just an amateur Python data analyst.

I'm using poetry on Windows with no issues whatsoever.

Re: Pipenv: Python Dev Workflow for Humans

#47
post #33

Earlier quoted context omitted.

pip freeze only pins the version of direct, not transitive dependencies. Meaning you don't get deterministic builds.

What do you mean? If you run pip freeze inside a venv it will print every user-installed module and their dependencies. When installing them in a new venv as a requirements file, you end up with the exact same set of modules.

Issues start occurring when you, for example, delete dependencies because with pip freeze you cannot ensure that you have deleted their dependencies also. The most common solution to this (that poetry and pipenv use) is to provide a lockfile to track transitive dependencies and their versions, without that (except for manually curating your dependencies) you can't ensure that you get a reproducible environment.

Re: Pipenv: Python Dev Workflow for Humans

#48
post #16

Earlier quoted context omitted.

Isn’t this what pip freeze is for?

pip freeze only pins the version of direct, not transitive dependencies. Meaning you don't get deterministic builds.

Not so. I use pip freeze to manage my dependencies, including all transitive dependencies, and my builds are deterministic.

Re: Pipenv: Python Dev Workflow for Humans

#49
post #33

Earlier quoted context omitted.

What do you mean? If you run pip freeze inside a venv it will print every user-installed module and their dependencies. When installing them in a new venv as a requirements file, you end up with the exact same set of modules.

Issues start occurring when you, for example, delete dependencies because with pip freeze you cannot ensure that you have deleted their dependencies also. The most common solution to this (that poetry and pipenv use) is to provide a lockfile to track transitive dependencies and their versions, without that (except for manually curating your dependencies) you can't ensure that you get a reproducible environment.

OK, but it does manage the versions of transitive dependencies, and there's nothing in that process stopping deterministic builds.

Adding/removing top level dependencies over time does require the use of two files (the top level requirements and the frozen/locked requirements which lists everything). Or you can list the top level requirements in setup.py and let requirements.txt be the lockfile. It would be nice if pip managed this lockfile automatically, but I'm not really interested in adding any of these newer tools to my toolchain just to manage a lockfile.

There are many packaging and distribution frustrations in Python, I don't think pip's management of dependency lists is one of them

Re: Pipenv: Python Dev Workflow for Humans

#50
post #36

Earlier quoted context omitted.

Agree. Works fine for me exactly as you describe. I don't understand why people furiously want more than this for the common case. (Choose python version, create .venv/ directory, install packages, use installed .venv/ and do work.)

What happens when you use a different version of the same library that a dependency uses?

Sometimes it works, sometimes it doesn't. This is indeed a problem, but one for which there isn't an elegant solution.

When multiple versions of the same library are allowed to coexist in different dependency trees there is less incentive to solve these conflicts and versions proliferate (see npm).

I'd much rather solve the occasional conflict (usually solved either by settling on some older version of both parent dependencies - and later advancing as possible - or just trying to fix it and send a patch upstream).

Post reply on HN