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

Update PY_PYTHON env var on windows with installed version if update-environment is true #1027

Open
heathhenley opened this issue Jan 31, 2025 · 1 comment
Labels
feature request New feature or request to improve the current logic

Comments

@heathhenley
Copy link

Description:
The update-environment flag updates seems to update a bunch of env variables to point at the newly installed version (cypthon example: https://github.com/actions/setup-python/blob/main/src/find-python.ts#L111).

Could it also add the PY_PYTHON=<version> on Windows whenever update-environment is true? This will make the default version for the Windows py launcher match the one requested - even if the runner has another version already installed.

Justification:
In short: make sure that py <script.py> runs on the version of python that you just installed with setup-python.

I bumped into this because we had some scripts running on a windows runner using py <script.py> in an action. The runner updated, everything broke, and we noticed that even though setup-python is installing everything correctly - if another version is there (in this case a newer version) running anything with py can use the other version instead of the one that was just installed by setup-python.

Are you willing to submit a PR?
Happy to! I just didn't want to to put time into it if the feature is not a good idea / I'm missing something. Setting the PY_PYTHON env var in the actions worked for my specific case, though I'm wondering if to do it in general it should set any other py launcher related variables to match the newly installed python too.

@heathhenley heathhenley added feature request New feature or request to improve the current logic needs triage labels Jan 31, 2025
@gowridurgad
Copy link
Contributor

Hi @heathhenley,
Thank you for this feature request. We will investigate it and get back to you as soon as we have some feedback.

@lmvysakh lmvysakh assigned lmvysakh and unassigned lmvysakh Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

3 participants