6

I'm starting to use pipenv in order to replace the pip freeze > requirements.txt and get some more advanced control of our third party dependencies. All my new code is done in Python 3.8

The problem is that when I use tox to validate my code against Python 2.7, pipenv checks the pipfile.lock which contains the hashes used by Python 3.8, causing the installation to fail. How do I configure toxto create a new environment from scratch without using the hashes in the pipfile lock?

My pipfile:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
jinja2 = "*"
pandas = "*"
python-docx = "*"
docxtpl = "*"
numpy = "*"
af-design-report = {path = ".", editable = true}

[dev-packages]
flake8 = "*"
coverage = "*"
tox = "*"
pytest = "*"
pytest-coverage = "*"
pytest-flake8 = "*"
Sphinx = "*"
tox-pipenv = "*"

My tox.ini:

[tox]
envlist = py27,py38

[testenv:py27]
allowlist_externals=pipenv
commands =
    pipenv install --dev
    pytest  --cov-report html:cov_html --cov=af_design_report tests

[testenv:py38]
allowlist_externals=pipenv
commands =
    pipenv install --dev
    pytest  --cov-report html:cov_html --cov=af_design_report tests

[testenv:docs]
description = invoke sphinx-build to build the HTML docs
deps = sphinx >= 1.7.5, < 2
commands =  build
Eug_Zazou
  • 155
  • 1
  • 11
  • This is not helping you with your problem with `pipenv`, but just in case you have not heard of it, there is also `pip-tools` which offers the `pip-freeze` command, which is basically a `pip freeze` on steroids. https://github.com/jazzband/pip-tools – Jürgen Gmach Mar 05 '21 at 09:11
  • Here is a discussion for supporting both Python 2 and 3 lockfiles... https://github.com/pypa/pipenv/issues/857 – Jürgen Gmach Mar 05 '21 at 09:14

0 Answers0