-
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
installer: use venv and improve error handling #4099
installer: use venv and improve error handling #4099
Conversation
cc: @sdispater |
@abn Won't that be an issue on Debian-based system which, as far as I recall, do not have the |
I thought this was now a built-in on there as well. Will check. We can do a fall back. But think now there is also install-virtualenv. |
Pretty sure this is a non-issue. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I have some minor (very minor) nitpicks, but this nicely solves the issue I was having and eliminates the complexity of shelling out to virtualenv
!
abee5b4
to
5ec9f35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0130019
to
1b48f0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've rebased this onto master, and squashed my contributions. We're now testing green across the board, with only one weird hack/workaround (can't call Subprocess with a Path
on Windows).
For posterity, we were struggling with macOS + Python 3.10 -- it ended up being an issue with blanking the environment. Omitting that eliminates a whole class of weirdness -- we can always revisit if needed.
It turns out I was wrong and we do end up with an error -- however, since Ubuntu/Debian monkey-patch Python, it's quite readable and is not a blocker:
|
I have a wip fix for that coming as soon as I fix merge conflicts from master. We'll be falling back to a virtualenv zipapp. |
Co-authored-by: Bjorn Neergaard <[email protected]>
3487d4b
to
d7f5c90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good -- the best fusion of both our changes. I'd like to fix that redundant return cls(target)
and merge this!
This change refactors virtual environment creation and introduces a new wrapper to handle command execution etc. If venv module is not available, in cases like that of the ubuntu distribution where the module is not part of the default python install, the virtualenv package is used by fetching the appropriate zipapp for the package for the python runtime. Resolves: python-poetry#4089 Resolves: python-poetry#4093
This change ensures that if creation of a new environment fails, any previously existing environment is restored.
d7f5c90
to
0419ed2
Compare
* installer: improve error handling and logging Co-authored-by: Bjorn Neergaard <[email protected]> * installer: default to using in-built venv module This change refactors virtual environment creation and introduces a new wrapper to handle command execution etc. If venv module is not available, in cases like that of the ubuntu distribution where the module is not part of the default python install, the virtualenv package is used by fetching the appropriate zipapp for the package for the python runtime. Resolves: python-poetry#4089 Resolves: python-poetry#4093 * ci/installer: upload failure logs * installer: preserve existing environment on failure This change ensures that if creation of a new environment fails, any previously existing environment is restored. Co-authored-by: Bjorn Neergaard <[email protected]>
* installer: improve error handling and logging Co-authored-by: Bjorn Neergaard <[email protected]> * installer: default to using in-built venv module This change refactors virtual environment creation and introduces a new wrapper to handle command execution etc. If venv module is not available, in cases like that of the ubuntu distribution where the module is not part of the default python install, the virtualenv package is used by fetching the appropriate zipapp for the package for the python runtime. Resolves: python-poetry#4089 Resolves: python-poetry#4093 * ci/installer: upload failure logs * installer: preserve existing environment on failure This change ensures that if creation of a new environment fails, any previously existing environment is restored. Co-authored-by: Bjorn Neergaard <[email protected]>
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This change drops the dependency on
virtualenv
for the installer,replacing environment creation with the built-in
venv
module availablein Python >= 3.2.
In addition, this change also improves error handling for subprocess
commands.
The following behavioural changes are also introduced.
tracebacks on error.
is saved, and used for recovery if installation fails.
Resolves: #4093
Resolves: #4089
Resolves: #4195
Resolves: #4463