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

consistent virtualenv location? #589

Closed
AlJohri opened this issue Sep 18, 2017 · 16 comments
Closed

consistent virtualenv location? #589

AlJohri opened this issue Sep 18, 2017 · 16 comments

Comments

@AlJohri
Copy link
Contributor

AlJohri commented Sep 18, 2017

hi, I was wondering if its possible to have a consistent named virtualenv path? Some people on my team like to use pycharm which I believe needs to have a consistent path to a virtualenv to work properly. It's not entirely clear to me right now when the virtualenv path (pipenv --venv) changes.

I understand I can use WORKON_HOME to change the folder but I believe the venv name is still subject to change?

@uranusjr
Copy link
Member

uranusjr commented Sep 18, 2017

The name is a combination of the project name and the hash of the full path of Pipfile, so it will stay the same as long as you don’t move the project.

https://github.com/kennethreitz/pipenv/blob/2628b5e3062314c3b5a7e09884cd036e1930437a/pipenv/project.py#L73-L95

I’m not sure if this can be relied on, or just implementation detail.

@kennethreitz
Copy link
Contributor

We have no plans on changing this.

@kennethreitz
Copy link
Contributor

It's best to run ($ pipenv --venv) to resolve the location of the virtualenv though, if you're going to access it programatically.

@kennethreitz
Copy link
Contributor

Also there's a setting, via environment variable PIPENV_VENV_IN_PROJECT, which you can set, which will stick the virtualenv in project/.venv. That might be more appropriate for your team.

@AlJohri
Copy link
Contributor Author

AlJohri commented Sep 18, 2017

@kennethreitz it would be great if there was either a cli option or perhaps a project level settings file for pipenv. I would very much like my users to just have to run pipenv install and not have to modify anything in their global shell profile for a great first time user experience

@nateprewitt
Copy link
Member

I'm still not opposed to a pipfile.conf setup similar to how pip.conf that would work in parallel with the environment variables. We've discussed this in the past though and the decision has leaned toward not implementing this as a feature.

@AlJohri
Copy link
Contributor Author

AlJohri commented Sep 18, 2017

Yeah, I would love to see something like pip.conf.

One thing that I don't particularly like is that PIPENV_SHELL_COMPAT is essentially required if you're using pyenv but it isn't explicitly documented (even though pyenv is mentioned other places in the docs). I feel like PIPENV_SHELL_COMPAT would be a great candidate to put in a pip.conf since pipenv shell pretty much doesn't work properly for pyenv users.

I'm just 100% focused on first time user experience for collaborators developing locally and I think pipenv solves a very large chunk of those problems for me, especially in combination with a tool like envdir. Just a few additional things like pip.conf would make that experience even better! 🎉

@kennethreitz
Copy link
Contributor

not happening.

Pyenv is perfectly compatible with pipenv without -c — you just have to configure your shell properly. I opened a pull request to start that process already.

@kennethreitz
Copy link
Contributor

e.g. pyenv is doing it wrong.

@AlJohri
Copy link
Contributor Author

AlJohri commented Sep 19, 2017

linking issue: pyenv/pyenv#982

@AlJohri
Copy link
Contributor Author

AlJohri commented Sep 19, 2017

@kennethreitz would you accept a PR that would allow for a custom virtualenv name? I tend to do multi-app projects so the path to my Pipfile would be myproject/api/Pipefile. I would ideally like the virtualenv to be called myproject-api. I end up with several virtualenv's all named something like api-somehashvalue right now

@kennethreitz
Copy link
Contributor

no

@vlasovskikh
Copy link

@AlJohri Feel free to vote for PY-26492 to get pipenv support in PyCharm.

@foobacca
Copy link

Note for PyCharm users - you can change the name that PyCharm gives to the virtualenv. It is only the name of the virtualenv that is a shared setting, not the location. Provided the name of the virtualenv is the same for everyone everything works as expected.

Note you can't set the name when creating the virtualenv in PyCharm, you can only edit the name later. To change the name click on "Show All ..." in the dropdown at the side of the virtualenv drop down. Then click on your virtualenv and click the edit icon (the pencil). Then you can rename the virtualenv to match the agreed team name.

@jtratner
Copy link
Collaborator

jtratner commented Mar 18, 2018 via email

@vlasovskikh
Copy link

We're fine with the current algorithm in virtualenv_name as long as it won't change. We would prefer not to depend on run-time tools.

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

7 participants