Home:ALL Converter>How to properly use Pipenv and Tox?

How to properly use Pipenv and Tox?

Ask Time:2021-03-05T16:52:19         Author:Eug_Zazou

Json Formatter

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

Author:Eug_Zazou,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/66489462/how-to-properly-use-pipenv-and-tox
yy