-
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
Support Python Launcher on Windows when using poetry env use
and poetry env remove
(#3520)
#4217
Conversation
Kudos, SonarCloud Quality Gate passed! |
poetry env use
(#3520)poetry env use
and poetry env remove
(#3520)
Kudos, SonarCloud Quality Gate passed! |
Both tests currently failed due to |
poetry/utils/env.py
Outdated
) | ||
python_version = execute_python_script( | ||
python, | ||
"\"import sys; print('.'.join([str(s) for s in sys.version_info[:3]]))\"", |
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.
What do you think about creating a constant for the script "\"import sys; print('.'.join([str(s) for s in sys.version_info[:3]]))\""
?
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.
Thank you for reviewing my code. I added the constant for the script. Also, I made the execute_python_script
a member function of EnvManager
as it is only used inside it. It is now EnvManager._execute_python_script
.
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.
Great. Good catch.
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.
Is there anything else I need to do? It seems that running more test require approval.
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 think it needs more tests and one more reviewer.
I forgot to delete now unused `execute_python_script`.
Change py launcher detection to be run once when `EnvManager` is created. Also, if both python executable (pythonX.X) and py launcher exist, poetry will prefer python executable over py launcher.
As a fan of the launcher I have tested your PR with poetry-1.2.0a2 on Win10. It mostly works. 👍 Only when removing an env an error occurs. The env is removed nevertheless. The error is probably due to a "feature" in Win10. When you don't have python on path but enter "python", Win10 suggests to install Python from the Microsoft store. So testing for "python" gives an unexpected output. Maybe it is better to test for the presence of "pip"?
|
There are some issues that need discussions which are:
I think a new issue elaborating the behavior should be created. |
The current consensus is that we should use |
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. |
Pull Request Check List
Resolves: #issue-number-here
Fix #3520
I did not add any test because I'm not really familiar with PyTest and thus had no idea how to add Windows specific test. However, the code was built and tested on Windows 10 device and it proved to resolve #3520 without apparent errors.EDIT
Added test to verify if
EnvManager._execute_python_script
works as expected.