Pipenv: Can I specify PIPENV_VENV_IN_PROJECT in Pipfile?

Created on 15 May 2018  路  7Comments  路  Source: pypa/pipenv

Is there a way to specify PIPENV_VENV_IN_PROJECT in a Pipfile? Adding an empty directory to source control is not universally supported, and dropping a .venv/README.txt or something similar to force creation of the directory seems unfortunate.

Duplicate

Most helpful comment

Things you can do:

  • Simply create the .venv yourself. Pipenv will use it.
  • Use a tool like direnv to activate this setting per directory
  • Set the envvar globally
  • Create a file in the project root called .venv whose contents are only the path to the root directory of a virtualenv

For points 1 and 4, pipenv will pick this up automatically

All 7 comments

No, this has been discussed in the past. It really does not make sense because the virtualenv location is a personal preference, not a project preference. There is little reason (as far as I can see) to force others into using the same config.

That depends very much on the project and other tooling required, doesn't it?

I'll certainly live with the answer being "no", but disagree that it never matters.

I agree this may not be impossible, but, well, let鈥檚 say I will try to make a very strong argument against this requirement if I ever need to be involved in such a project.

We have discussed this in the past -- it is definitely something we want to keep as a user level setting (unless there is a virtualenv in the project directory)

For the lurkers, here are some related issues:

Things you can do:

  • Simply create the .venv yourself. Pipenv will use it.
  • Use a tool like direnv to activate this setting per directory
  • Set the envvar globally
  • Create a file in the project root called .venv whose contents are only the path to the root directory of a virtualenv

For points 1 and 4, pipenv will pick this up automatically

For what it's worth, what I eventually came up with was a script to build a .deb for my project, using a virtualenv created by pipenv as fodder.

To build, my script moves aside any existing pipenv-managed venv and let's pipenv create a new one (at whatever location it happens to choose). The lib/pythonX.Y/site-packages directory is then used as a component to create the raw input for dpkg-deb (which does not contain a venv). The application package then depends on a clean, non-system Python installation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fbender picture fbender  路  3Comments

ipmb picture ipmb  路  3Comments

bgjelstrup picture bgjelstrup  路  3Comments

Californian picture Californian  路  3Comments

erinxocon picture erinxocon  路  3Comments