Pipenv: building wheels with pipenv?

Created on 7 Mar 2018  ·  3Comments  ·  Source: pypa/pipenv

I'd like to be able to generate wheels for all dependencies in a Pipfile.lock while taking advantage of hash verification. Prior to 11.1.2 you could accomplish this with:

pipenv lock -r > reqs.txt
pip wheel -r reqs.txt

_(#1417 was problematic for this workflow, but otherwise it worked)_

In 11.1.2, hashes were removed from the requirements-style output which (afaik) means there is no way to build/download hash-verified wheels from a lock file.

The use-case is to package Python modules for offline installs or installs without compilation/development tools on the server. The wheels can be built, then distributed and installed in a minimal Python environment.


Is this functionality that you'd consider including in the project? If not, is there some way to support this workflow again?

Most helpful comment

Just in case anybody looks here for a solution, it's pretty easy (assuming the pipenv internals don't change):

from pipenv.utils import convert_deps_to_pip
with open('Pipfile.lock') as f:
    deps = json.load(f)['default']
# remove local project which wouldn't have a hash
for k, v in list(deps.items()):
    if v.get('path') == '.':
        del(deps[k])
path_to_requirements_file_with_hashes = convert_deps_to_pip(deps)

All 3 comments

no plans for this at this time

this sounds like a great opportunity for a pipenv-wheels tool, though.

Just in case anybody looks here for a solution, it's pretty easy (assuming the pipenv internals don't change):

from pipenv.utils import convert_deps_to_pip
with open('Pipfile.lock') as f:
    deps = json.load(f)['default']
# remove local project which wouldn't have a hash
for k, v in list(deps.items()):
    if v.get('path') == '.':
        del(deps[k])
path_to_requirements_file_with_hashes = convert_deps_to_pip(deps)
Was this page helpful?
0 / 5 - 0 ratings