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

Assume PIPENV_VENV_IN_PROJECT when a local virtual environment exists #1492

Merged
merged 1 commit into from
Feb 25, 2018

Conversation

jacebrowning
Copy link
Contributor

@jacebrowning jacebrowning commented Feb 24, 2018

Frequently I run into the situation where pipenv's virtual environment was created with PIPENV_VENV_IN_PROJECT=1 (via Makefile or other setup script), but when I go to run a one-off command some time later, pipenv creates a new virtual environment missing my dependencies:

$ PIPENV_VENV_IN_PROJECT=1 pipenv install pytest
Creating a virtualenv for this project…
⠋New python executable in /private/tmp/test/.venv/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /private/tmp/test/.venv
Installing pytest…
Collecting pytest
  Using cached pytest-3.4.1-py2.py3-none-any.whl
Collecting pluggy<0.7,>=0.5 (from pytest)
Collecting six>=1.10.0 (from pytest)
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting py>=1.5.0 (from pytest)
  Using cached py-1.5.2-py2.py3-none-any.whl
Collecting funcsigs; python_version < "3.0" (from pytest)
  Using cached funcsigs-1.0.2-py2.py3-none-any.whl
Requirement already satisfied: setuptools in ./.venv/lib/python2.7/site-packages (from pytest)
Collecting attrs>=17.2.0 (from pytest)
  Using cached attrs-17.4.0-py2.py3-none-any.whl
Installing collected packages: pluggy, six, py, funcsigs, attrs, pytest
Successfully installed attrs-17.4.0 funcsigs-1.0.2 pluggy-0.6.0 py-1.5.2 pytest-3.4.1 six-1.11.0

Adding pytest to Pipfile's [packages]…
Installing dependencies from Pipfile.lock (272659)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 12/12 — 00:00:02
To activate this project's virtualenv, run the following:
 $ pipenv shell
$ pipenv run pytest
Creating a virtualenv for this project…
⠋New python executable in /Users/Browning/.local/share/virtualenvs/test-6C_DLGjE/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /Users/Browning/.local/share/virtualenvs/test-6C_DLGjE
Error: the command pytest could not be found within PATH or Pipfile's [scripts].

This change sets PIPENV_VENV_IN_PROJECT automatically if the virtual environment directory already exists locally. I think this will reduce many of the problems people have documented running into on #1049.

@jtratner
Copy link
Collaborator

jtratner commented Feb 24, 2018 via email

@kennethreitz
Copy link
Contributor

I dig it!

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

Successfully merging this pull request may close these issues.

3 participants