Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How this project correlates with tox. #154

Closed
proofit404 opened this issue Jan 29, 2017 · 6 comments
Closed

How this project correlates with tox. #154

proofit404 opened this issue Jan 29, 2017 · 6 comments

Comments

@proofit404
Copy link

I'm trying to get my head around this tool and understand its proper usecases.

In tox I can create many virtual environments and run my tests in different ways against multiple python versions. Is it possible with pipenv right now or maybe planned milestone in the future?

@kennethreitz
Copy link
Contributor

you can specify a version of python with --python, but only one version of python can be specified at a time.

@vadimadr
Copy link
Contributor

@kennethreitz this is not the problem he meant. Tox relies on its own virtualenvs and use old requirements.txt format, however it allows to use any custom command to install dependencies. But if we use pipenv we must specify requirements in pipfile format and always use pipenv to install dependencies. The problem is pipenv always creates its own virtualenv. Maybe cli option to install packages into current environment should be added?

@timofurrer
Copy link
Contributor

What you guys are looking for might be the eventual integration of the Pipfile into pip itself: https://github.com/pypa/pipfile#pip-integration-eventual

@kennethreitz
Copy link
Contributor

@vadimadr there is a --system option for that actually!

@kennethreitz
Copy link
Contributor

When used, a virtualenv will still be created, but it wont' be used for installation of packages.

@matthijskooijman
Copy link

I explored this a bit, and the following works in my tox.ino:

[testenv]
# We must specify deps, in order to get tox to run the install_command
deps = pipenv
# Allow using sh from outside the virtualenv
whitelist_externals = sh
# Use sh to allow running multiple commands. First run pip to install
# pipenv (and any other dependencies), then run pipenv to install stuff
# from the pipfile. This passes a dummy argument to sh to fill $0 and
# the list of packages (from deps=) as $@.
install_command = sh -c 'pip install "$@" && pipenv install --ignore-pipfile --deploy --system --dev' dummy {packages}

commands = actual_test_command

Annoyingly it seems this only works in the actual test section, so all this stuff must be repeated for every test section. Also, this uses pipenv install, since sync does not support --system (#2227).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants