-
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
[virtualenvs] configuration not working with pyproject.toml #2937
Comments
To the best of my knowledge, using a key called |
I see your point and partially agree with the argument. Nevertheless, I believe there's at least one action item for this issue: better document For me, this is really a pain because VS Code doesn't work with the default poetry venv dir (there are issues open on this) and VS Code users HAVE to change venv's directory in order to use poetry venv. In order to avoid that my team has problems with poetry and VS Code, I looked for a way to enforce poetry to install venv in the project's root everytime (that way, VS Code would always find the venv folder). This being said, I can see that lots of developers will spend considerable time looking for an appropriate solution for their professional projects and not finding proper documentation and relying on trial and error or workarounds. I believe this justifies adding some documentation on Lastly, an opinion on the separation of files: we have
Just to be clear, I really appreciate your help and opinion... this is a IMO response only, based on bad UX regarding the documentation (not Poetry itself, which is so awesome that I'm trying to change my peers mind to use it in our project) 😄 |
Hello @lcbm, the reason why the local configs are not in But it's a good idea to document the existens of this file and would fit at best in the Local Configuration section of the docs. PR is welcome :) fin swimmer |
Could I ask what the difference between having the local config in |
The The |
I see, thanks @finswimmer |
On some arcane setups where virtual environments need to be managed with another tool (see conda), it would be really helpful to have a way of overriding the virtual environment settings from the @finswimmer, would it be possible to preserve the current behavior and allow custom overrides? The priority order would look like this:
|
Hello @0x2b3bfa0, if poetry detects that it is already running in a virtual environment - also if it is created by conda - it will not create another venv. Does this fit to your use case? fin swimmer |
🙏 Thank you, @finswimmer! I wasn't able to trigger that behavior due to a misconfiguration, but it works perfectly now. |
@finswimmer I would like to add another point to maybe revisit this decision. Recently Poetry implemented another config This setting alone will turn the developer's environment consistent and therefore it should be set on a per-project basis IMHO. This was an example, but other settings might be introduced in the future that developers would like to "enforce" across their teams for sake of consistency/environment reproducibility. Perhaps, as an option for future-proofing, it's worth considering allowing users to set these properties at the project-level as well (on |
Is there any patch or fork here yet? |
I assume you're talking about enabling poetry configuration at the project level. In that case, not that I'm aware of, but maybe due to the issue title and tags, this is not getting enough visibility. To help the devs (and to better clarify the request) we can push this as a feature request in a separate issue. |
Hi @finswimmer I quite agree with @0x2b3bfa0 's suggestion. So I can have a default virtualenv setting in pyproject.toml(this makes perfect sense for the purpose of pyproject.toml), then if developer prefers a different venv setting then it can be overwritten by |
This is precisely what needs to be done. |
|
It's just a personal opinion that these are personal opinions. Other teams can decide otherwise. pyproject.toml contains the configuration for black,isort,mypy, pytest,... We are happy to get rid of pytest.ini, .pylintrc,... Now we are forced to create a poetry.toml, add it to the repo, |
To add to this, I can only assume you guys don't have a bunch of junior developers on your team. Having a consistent development setup is incredibly important to aid beginners and writing instructions. It would be great to ensure all of them have the venv folder at the same location. |
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. |
-vvv
option).Issue
Hello, I've been trying to make Poetry create the virtual environment folder in the project's root but it kept installing in
home/leleco/.cache/pypoetry/virtualenvs
despite the configuration set inpyproject.toml
file.After a few tries, I ran
poetry config --list
and the output was this 👇This got me startled, so I tried
poetry config virtualenvs.in-project true
, thenpoetry install
and it worked: a.venv
was created inside my project's root directory. I then tried the same, except that withvirtualenvs.create
👇And the result from
poetry config --list
was this 👇With this, I concluded that
[virtualenvs]
does not work withpyproject.toml
(which was expected to me, as a user). Furthermore,poetry config virtualenvs.in-project true --local
creates apoetry.toml
instead of adding an entry inpyproject.toml
. 👇Is this expected? If so, I couldn't find the documentation explaining this... also, is there a chance that we convert this issue from Bug to Feature Request in case the described behavior is the expected behavior? I'm more than glad to update this description and convert it to a feature request with proper use-case description.
Thanks in advance,
Hope I can be useful to resolve this, or to implement this feature, somehow 🥳
The text was updated successfully, but these errors were encountered: