Pipenv: Python Dev Workflow for Humans
pipenv.pypa.io
pipenv.pypa.io
https://cjolowicz.github.io/posts/hypermodern-python-01-setu...
I remember pipenv used to support this pretty well but it was out if scope for poetry.
Edit: there's a 'poetry run' command now so it might be fixed. Don't remember what was broken.
At the time, it was unusable and community responses wildly swung between "its not official", its "PyPA endorsed", "don't like it build your own". Which are fine responses beta version of software, not when you convince the community and several companies that its a stable production ready, langauge endorsed package manager. Ultimately, pipenv in Heroku python buildpack was broken for a long time because of it.
Despite being assured it was stable, there were daily Pipenv releases at times, until they stopped for some reason for months.
In summary: avoid pipenv unless you really have to use it, otherwise - use poetry.
https://github.com/pypa/pipenv/issues/1722
I switched to Poetry after that, as Poetry did meet my expectations.
With Poetry, the venv is created with whatever version of python that Poetry was installed with. So if you (like me) follow the setup guide on macOS, Poetry will always create python 2.7 virtualenvs until you uninstall it and re-install it under python 3.X. Annoying.
I'm not sure I completely love that behavior; it would be nice if it would default toward trying to use the minimum supported version, even if the currently active one is compatible. But I guess that wouldn't do anything that tox couldn't do better.
You can also explicitly tell it what version to use for a project with a command like `poetry env 3.8`.
It's a real shame PyPA endorsed this to be honest, I hope that can be reversed at some point in the future.
Well, except one thing: If I do `poetry update <somepackage>`, it starts upgrading other packages as well. I'm not sure what that's about...
There seems to be a lot of activity in this area for a seemingly solved problem. Having solved it, people appear to wish to expand the problem to something bigger (such as multiple interpreter versions, for example)
I believe the most-common case to be: 1 Choose python version and install on operating system., 2 create .venv/ directory. 3, install packages from package system (pip)., 4 freeze versions to local file. 5 use installed .venv/ and do work.
I've got some scripts I use for the above [1] -- must give it some TLC, and I don't understand why people furiously want more than this.
The problems are:
requirements.txt is way too flexible, so users want a lock file to freeze stuff in place.
You can use pip freeze to generate a sort-of-lockfile but it's more manual than tools like Cargo/npm/bundler which do it automatically. And more adhoc as to what you call it. Combined with needing to mange venvs and sourcing etc. people want a standard script that just figures out its context from the now standard "explicit requirements"/lockfile setup.
It doesn't handle versioning Python itself, which is expected of it for some reason, even though nobody cares that npm/Cargo/bundler don't version their languages.
And the solution to the multiple interpreter versions problem should be orthogonal to venv like pyenv [1] instead of overlapping with venv like pipenv.
The biggest IMO is pip doesn't provide a way to pin indirect dependencies, so there is no good way to ensure that other people working on a project are also using the same dependency versions. You can do it with extra tooling of course - and that's what poetry and pipenv do.
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).
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
Gonna take a look at poetry, but would love to hear what problems people have had with pipenv?
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.
Worth noting that Sébastien Eustace is an author of the provisional PEP 621: "Storing project metadata in pyproject.toml"
it's not, because it is literally pipenv
> Also, does it work on Heroku?
yes