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

virtualenv.in-project=true has no effect if project has an existing virtualenv #6666

Closed
3 of 4 tasks
s7m4b4 opened this issue Oct 1, 2022 · 6 comments · Fixed by #8126
Closed
3 of 4 tasks

virtualenv.in-project=true has no effect if project has an existing virtualenv #6666

s7m4b4 opened this issue Oct 1, 2022 · 6 comments · Fixed by #8126
Labels
area/docs Documentation issues/improvements area/ux Features and improvements related to the user experience area/venv Related to virtualenv management good first issue kind/enhancement Not a bug or feature, but improves usability or performance

Comments

@s7m4b4
Copy link

s7m4b4 commented Oct 1, 2022

  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

virtualenvs.path will always takes precedence once a project's virtualenv has been initialised under {cache-dir}/virtualenvs.
This means you can only convert to using virtualenvs.in-project if the original virtualenv directory is deleted - just setting virtualenvs.in-project to true is not enough.
This is likely intended, however it can be a bit misleading if you're unfamiliar with Poetry. It would be nice if something like the following output was displayed when adding packages -
Installing package to /path/to/exmaple-project/virtualenv
EDIT: I just realised the above is provided when using -v. Might still be nice to provide it by default though?

Steps -

  1. Create a new Poetry project with virtualenvs.in-project unset
  2. Install a package to populate the cache
  3. Remove the package
  4. Set virtualenvs.in-project to true
  5. Install a package
@s7m4b4 s7m4b4 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 1, 2022
@togetherwithasteria togetherwithasteria added area/docs Documentation issues/improvements kind/enhancement Not a bug or feature, but improves usability or performance and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 2, 2022
@togetherwithasteria
Copy link
Member

Hiiii~~~

I have reproduced this on Fedora 36 (Toolbox)!!

Screenshot from 2022-10-02 09-15-28
Screenshot from 2022-10-02 09-19-27
Screenshot from 2022-10-02 09-19-41
Screenshot from 2022-10-02 09-20-09

On Poetry Shell, the output logs the where the virtualenv is but users might not notice them.

@togetherwithasteria
Copy link
Member

togetherwithasteria commented Oct 2, 2022

I assume we need to log out a warning like this?

Warning: The virtualenvs.in-project is set to true in your project, but we already have a virtual environment from before. Your configuration will be ignored for now.

If you would like to immediately apply this setting. You can modify the available virtual environments and set which one to use. See poetry list env. You might also want to use poetry env remove.

@togetherwithasteria togetherwithasteria added the area/venv Related to virtualenv management label Oct 2, 2022
@clintonroy
Copy link
Contributor

This feels like it's more user interface than anything else (which is not my area). In my mind, having a warning printed will just get ignored most of the time.

Maybe it's best to fail the config change if there are any envs, with an error?

@togetherwithasteria togetherwithasteria added the area/ux Features and improvements related to the user experience label Oct 2, 2022
@Kronifer
Copy link

Would this be up for grabs?

@finswimmer
Copy link
Member

This behavior is intended, otherwise all venv's of Poetry project in the systems needs to be recreated if one changes the config. A clarification in the docs about it should be sufficient.

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/docs Documentation issues/improvements area/ux Features and improvements related to the user experience area/venv Related to virtualenv management good first issue kind/enhancement Not a bug or feature, but improves usability or performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants