-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Change default to virtualenvs.in-project = true
#2949
Comments
I disagree. I almost never us that config option besides for CI caching the .venv. |
I can honestly live with either but I do have a preference for in-project venvs as it is much less surprising for developers that are new to Python, or just developers that are new to As long we can switch between them I think the question really is "who is the default for"? |
Backwards compatibility is a thing, so I think this should not be done. |
I saw your point since users of |
For me the fact that this is not default is the biggest pain point of using poetry across various machines, especially hosts where I don't have a HOME and I don't want to have to edit my bashrc just to set the right env var. |
@billop but you know you can change this setting both globally and for given project and you don't have to play manually with |
@jaklan I'm aware of both options yes; sorry looking back it seems my comment is kind of confusing. My main point was that I never want virtualenvs not to be in the project, and every time I have to setup pypoetry on a new machine I have to set the option, and the global configuration is sometimes not an option on some new hosts, which means setting it for every project. |
@billop what do you mean by the global configuration is sometimes not an option on some new hosts? Why are you not able to change it (especially when you can modify As a workaround you can just use the one-liner: poetry config virtualenvs.in-project true --local && poetry [new | init | install] BTW I also use Poetry only with in-project virtualenvs, so I support this proposal in general. |
@jaklan I don't even remember myself, but I think I confused two different hosts, one of which periodically cannot access HOME while the other doesn't have access to my HOME (GPU cluster). To constructively add something to the discussion: what is the advantage of the current default? I think the advantage is the usual advantage of following XDG_CACHE_HOME where files that can be deleted can be consolidated and easily kept track of. But I don't really see anything beyond that. I feel like it causes more problems than benefits and should be an option, not the default. |
@billop one solid benefit of is that you can easily switch between python version without a need to reinstall environments each time. since Still in my daily python library development, I'm usually staying with a single python version and let CI/CD check other versions for me. If I have to debug then I could do a reverse of @jaklan. e.g. |
Hi, is this issue going to be resolved somehow? I personally also vote in favour of default in-project virtualenv which I consider more convenient. |
Hi! I can't set virtualenvs.in-project config to true on Windows 11 with python 3.10 poetry 1.2.0: it doesn't show any error, but config stays to false, and the virtual environment has created in default cache dir. Is it an issue or am i doing something wrong? |
It worked after restarting Windows |
I'm going to close this as the current behavior is stable and unlikely to change -- users who prefer this as the default can set it with For users in containers, managing your virtual environments outside of Poetry so they are at a consistent path not beholden to changes in Poetry is suggested. Poetry will re-use an already activated virtual environment instead of creating a new one -- #6398 doesn't exactly cover this, but some of the discussion and links there point to relevant patterns. Note that |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature Request
The config
virtualenvs.in-project
should be defaulted to true at installation. Personally, I did this almost every single time.On my local, codespaces, and many dockerfiles are set
POETRY_VIRTUALENVS_IN_PROJECT=true
. If the 80% always changes it every single time, why don't we consider make it a new default.The text was updated successfully, but these errors were encountered: