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
Poe tries to activate the environment even if poetry config virtualenvs.create false
#65
Comments
Hi @lsorber, thanks for the feedback. By "unnecessary noise" do you just mean that poe invokes I guess it would not make sense to mediate this with a config on the project itself, for example by setting Setting The poetry CLI is kind of slow, so would be too expensive to invoke routinely to check the config. Thus the only way I see to improve would be for the Does that sound right to you? Could a windows dev confirm for me that this would reliably get the correct path for the config on windows? import os
config_path = f"C:\Users\{os.getlogin()}\AppData\Roaming\pypoetry/config.toml" |
Sorry, I should have been more clear:
To be clear, everything is still perfectly functional without a workaround, it's just that the experience is less than desirable as a result of the above.
That's a great suggestion – however, this would be problematic elsewhere. The trouble with this is that for non-Docker based workflows we actually do want poe to make sure the environment is active, and setting
Agreed!
A few comments:
On Windows, I believe Poetry's global config location is |
Hi @lsorber, I played around a bit with this and came away unconvinced that the complexity of finding and reading the various config files was worth it. It's also quite difficult to write convincing tests for. However I've implemented a more minimal solution that I think should be sufficient for your use case, which is to make poe respect the POETRY_VIRTUALENVS_CREATE env var. So if you set I hope this works for you. |
That sounds OK to me, thank you for looking into this! |
…65 Also: - PoetryExecutor uses VirtualEnv based execution whenever possible - Fixed issue where poe would use the env from the current project instead of the target project - Update some tests to not avoid encountering missing poetry env
This feature is available now as of 0.16.1 |
…65 Also: - PoetryExecutor uses VirtualEnv based execution whenever possible - Fixed issue where poe would use the env from the current project instead of the target project - Update some tests to not avoid encountering missing poetry env
…65 Also: - PoetryExecutor uses VirtualEnv based execution whenever possible - Fixed issue where poe would use the env from the current project instead of the target project - Update some tests to not avoid encountering missing poetry env
* Fix various issues manifesting on windows - Make the tests that break on python37 on windows only run for python >= 3.8 - Reenable disabled test matrix item for windows-python37 In shell tasks: - check for sh installed with git - trust git bash over bash on the path which might be a decoy put there to trick us - add test for the default powershell, as distinct from pwsh * Revert "Revert "PoetryExecutor does not use poetry if POETRY_VIRTUALENVS_CREATE=false #65"" This reverts commit e6e162e. * Always explicitly use the poetry virtualenv if possible in the poetry executor This removes an optimization that probably does add much value anymore, but does seem to cause tasks to be run without the correct virtual_env in some scenarios on windows. Also make process of updaating the path env var to enable a venv try to avoid redundant updates in case the virtualenv is already active.
* Fix various issues manifesting on windows - Make the tests that break on python37 on windows only run for python >= 3.8 - Reenable disabled test matrix item for windows-python37 In shell tasks: - check for sh installed with git - trust git bash over bash on the path which might be a decoy put there to trick us - add test for the default powershell, as distinct from pwsh * Revert "Revert "PoetryExecutor does not use poetry if POETRY_VIRTUALENVS_CREATE=false #65"" This reverts commit e6e162e. * Always explicitly use the poetry virtualenv if possible in the poetry executor This removes an optimization that probably does add much value anymore, but does seem to cause tasks to be run without the correct virtual_env in some scenarios on windows. Also make process of updaating the path env var to enable a venv try to avoid redundant updates in case the virtualenv is already active.
When creating a Docker image
FROM python:3.8-slim AS base
, we setpoetry config virtualenvs.create false
as the image itself already isolates the Python environment. In that situation, Poe will still try to activate the environment with every task, which works but does generate some unnecessary noise.Workaround: we currently set
ENV POETRY_ACTIVE 1
to avoid the unnecessary activations.The text was updated successfully, but these errors were encountered: