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

uses python-finder during env activate #5778

Closed

Conversation

bmarroquin
Copy link
Contributor

@bmarroquin bmarroquin commented Jun 5, 2022

Pull Request Check List

Resolves #3520

  • Added tests for changed code.
  • Updated documentation for changed code.

While resolving for python versions in the PATH, python-finder executes a python command to get the python version. It will execute the command for every supported python implementation in the path until it finds the right one.

On windows, pythons registered per pep-514 take priority over path pythons. When checking registered pythons, it does not execute the version command. It does succeed in finding pythons installed through the MS Store (they are in the path). Py.exe also prefers registered pythons over MS Store pythons, so the behavior here is consistent. To be clear this doesn't use py.exe. pyenv-win creates a python.bat shim in the path. The bat files are recognized as other pythons in the path so it just works.

I added an experimental flag to enable or disable the python-finder.

I haven't tested this with linux but I figured the implementation wouldn't change much so creating the draft PR. I also expected to just work since python-finder covers this testing.

@Diggsey
Copy link

Diggsey commented Jul 8, 2022

pyenv-win creates a python.bat shim in the path. The bat files are recognized as other pythons in the path so it just works.

FWIW, this doesn't work for me - either because poetry only recognises .exe files, or it tries to execute the files with no-extension that pyenv-win also creates, and then gives an error.

@bmarroquin
Copy link
Contributor Author

@Diggsey, could you provide more info on your python installations. Python-finder executes a "get version" command using the full path. It also checks for both python.exe and python.bat on windows. poetry env use 3.x should just work.

@Diggsey
Copy link

Diggsey commented Jul 8, 2022

@bmarroquin, sorry maybe I misunderstood - I thought you were saying that poetry works without this PR for python installed via pyenv-win because it creates appropriate stubs in the PATH. For me that's not the case. It probably works just fine with the changes in this PR.

@Secrus
Copy link
Member

Secrus commented Jan 30, 2024

@bmarroquin thank you for your effort. Since there were many changes to the codebase in the meantime, I will be taking this feature on myself, with a fresh start.

@Secrus Secrus closed this Jan 30, 2024
Copy link

github-actions bot commented Mar 3, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Natively support py launcher on Windows
3 participants