linkedin / shiv

shiv is a command line utility for building fully self contained Python zipapps as outlined in PEP 441, but with all their dependencies included.
BSD 2-Clause "Simplified" License
1.73k stars 94 forks source link

Accept pipenv's Pipfile.lock in place of pip's requirements.txt #219

Open JDLH opened 2 years ago

JDLH commented 2 years ago

When running shiv to build an app file, a good way to include all the other packages your app depends on seems to be to pass in the option, -r requirements.txt. The requirements.txt file is managed by pip. But I use pipenv in preference to pip. Pipenv lists dependencies in a file named Pipfile.lock.

I would like to have shiv accept Pipfile.lock in place of requirements.txt as a way to list all the packages which shiv should install into the app file.

lorencarvalho commented 2 years ago

hi @JDLH,

I'm certainly open to supporting Pipefile.lock, however I lack direct experience with it (or pipenv, for that matter). My understanding is that pipenv is compatible with pip but not the other way around? For projects using Pipfile.lock would it make sense to use pipenv to stage the dependencies prior to packaging (similar to how shiv leverages pip today)?

JDLH commented 2 years ago

Thank you for the reply.

I added this issue as I was learning about shiv and about Python packaging. The underlying problem that I wanted to solve is that my environment managment tool, pipenv, was not communicating with my packaging tool, shiv.

Now I have read more of the Python Packaging User Guide, and I think there are better ways to solve the underlying problem than this. In particular, I just packaged another project where I listed all my dependencies in the pyproject.toml file. pipenv and shiv were able to communicate via that mechanism.

If it turns out that listing dependencies in pyproject.toml works robustly, then I am happy to use that, and drop this request. However, in that case there is (if I recall correctly) an issue that the shiv documentation does not describe well how to communicate dependencies via pyproject.toml.

lorencarvalho commented 2 years ago

However, in that case there is (if I recall correctly) an issue that the shiv documentation does not describe well how to communicate dependencies via pyproject.toml.

Very true! I will leave this issue open to address the deficiencies in the current docs & close it once I've given them a once-through. Thanks!