Skip to main content

A pipenv plugin for tox

Project description

tox-pipenv

https://img.shields.io/pypi/v/tox-pipenv.svg https://github.com/tox-dev/tox-pipenv/workflows/Test%20Package%20Compatibility/badge.svg PyPI - Downloads

A tox plugin to replace the default use of virtualenv with Pipenv.

This is a convenient way to retain your use of Pipenv, whilst testing multiple versions of Python.

Installation

pip install tox-pipenv

Or,

pipenv install tox-pipenv

Creating virtual environments

With this plugin, tox will use pipenv –python {python binary} as given to the tox interpreter for each python path.

If you already have virtual environments cached with tox, use the –recreate flag to recreate them with pipenv.

Note: tox will pass the –site-packages flag to pipenv if this is configured in your tox config.

The Pipfile will exist in .tox/{env}/Pipfile as well as Pipfile.lock

Installing requirements

The installation of requirements from your tox config will be passed to pipenv install for installation into the virtual environment. This replaces the use of pip within tox.

requirements.txt files will also be parsed by Pipenv and used for each test environment

Executing tests

Each of the commands in your testenv configuration will be passed to pipenv to execute within the pipenv virtual environment

Example tox.ini

This simple example will test against Python 2.7 and 3.6 using pytest to execute the tests.

[tox]
envlist = py27, py36

[testenv]
deps =
    pytest
    pytest-mock
commands = python -m pytest test/

Frequently asked questions

Where to install

Tox-Pipenv should be installed in the same environment as Tox, whether that is in a virtualenvironment, system environment or user environment. Tox-Pipenv depends on Tox 3.0 or newer.

Is user expected to create Pipfile and Pipfile.lock before executing tox with this plugin?

Yes, although if you are migrating from a requirements.txt to a Pipfile, you can use Pipenv to create the Pipfile for you.

Is Pipfile.lock expected to be under source control?

According to pipenv documentation, Pipfile.lock is not recommended under source control if it is going to be used under multiple Python versions.

What is the role of requirements.txt file?

Often, tox users use requirements.txt which is then referenced from within tox.ini file as deps. Pipenv will automatically install any packages listed in requirements.txt for each virtual environment that Tox creates.

Is tox.ini deps section really in control?

No, this is a known limitation.

Authors

  • Anthony Shaw

  • Omer Katz

  • Almog Cohen

Release notes

1.10.1 (2020-09-22)

  • Bugfix : Support for Tox 3.9+ (#67)

1.10.0 (2020-05-01)

  • Bugfix : Support for Tox 3.8 (#66)

1.9.0 (2019-01-27)

  • Update: Added support for tox 3.7.0 (#60)

1.8.0 (2018-10-30)

Bugfix : Tox-pipenv would skip the installation of Pipfile if the user had not specified any additional deps in tox.ini (#53)

1.7.0 (2018-10-30)

  • Bugfix : Support for Tox 3.0+

  • Bugfix : Fixed API in Tox 3.4.0+

  • Bugfix : Removed pinned version which fixes pipenv issue (#50)

1.6.0 (2018-07-04)

  • Bugfix : Tox would fail when executed twice if usedevelop was set to True, reported by @ashwinvis #46

  • BugfixAny additional dependencies specified in deps within tox.ini would be written to the root Pipfile. A temporary Pipfile is created

    for each virtualenv now, which is a clone of the root Pipfile

1.5.0 (2018-07-03)

  • Update : Update tox to 3.0.0

  • Feature : Tox report now uses pipenv instead of pip freeze

  • Bugfix : Fixed issue on newer versions of pipenv raising error “AttributeError: ‘Project’ object has no attribute ‘pipfile_sources’” (#41)

1.4.1 (2018-03-15)

  • Removed test virtualenv from package, meaning distribution was 18MB, should be 15Kb #38

1.4.0 (2018-03-08)

  • Bugfix : Fixed error “LocalPath object has no attribute endswith”

  • Bugfix : Fixed error “Cannot run tox for the first time with this plugin installed”

1.3.0 (2018-03-03)

  • Bugfix : fixed issue when Pathlib.Path occured instead of string

  • Update : updated pipenv to 11.0.1

1.2.1 (2018-01-08)

  • Added documentation and fixed pypi build

1.2.0 (2018-01-08)

  • Virtual environments are now correctly stored in .tox/<pyver>/.venv

  • Packages will be reported by pipenv graph after installation. Pip freeze is still being run, downstream PR raised in tox

  • Plugin should not accidentally remove host virtualenv binaries

1.1.0 (2017-12-30)

  • Use Pipenv install –dev as the default installation command

1.0.0 (2017-12-22)

  • Support for creation and recreation of virtual environments using Pipenv

  • Isolation of Pipfile within the tox directory

  • Support for installation of tox-specified packages in Pipenv

  • Support for execution of test commands within a Pipenv virtual env

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tox-pipenv-1.10.1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

tox_pipenv-1.10.1-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tox-pipenv-1.10.1.tar.gz.

File metadata

  • Download URL: tox-pipenv-1.10.1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15

File hashes

Hashes for tox-pipenv-1.10.1.tar.gz
Algorithm Hash digest
SHA256 5fe576294be7a5a14ba4bdea729d9c738e6c7d423ab84273c9b106d5b2508999
MD5 cdd53129cbb1cfb77dcfb337706fc2e6
BLAKE2b-256 789a23cdced884150525015bed3d9e75306198695cf3d6dce9788ead520720c8

See more details on using hashes here.

File details

Details for the file tox_pipenv-1.10.1-py2.py3-none-any.whl.

File metadata

  • Download URL: tox_pipenv-1.10.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15

File hashes

Hashes for tox_pipenv-1.10.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f51476491b52c22455fe37f31aa1a0c5aa9798d223f19be58dfadcf79e503362
MD5 16d95f208bacc756954b5afc2f13e720
BLAKE2b-256 ab176e6f34018d9b3e7b0f62e0385e20da57471405d2b4b1e6a1815b37cc1a82

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page