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

.python-version file is not used to establish the python version #458

Closed
2 of 5 tasks
gg-kialo opened this issue Jul 12, 2022 · 7 comments
Closed
2 of 5 tasks

.python-version file is not used to establish the python version #458

gg-kialo opened this issue Jul 12, 2022 · 7 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@gg-kialo
Copy link

gg-kialo commented Jul 12, 2022

Description:
v4.1.0 introduced a regression where the repo-root .python-version file is no longer used by default to select the python version to install.
The regression was introduced by #450

Reading from .python-version when the python-version input is unset is documented in action.yml -

python-version:
description: "Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset."

Action version:
v4.1.0 (regression from v4.0.0)

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
N/A

Repro steps:
Create a repository with a .python-version file containing 3.10.4 and a workflow containing a setup-python step, e.g.:

name: CI
on: [push]
jobs:
  python:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install python
        uses: actions/[email protected]

Expected behavior:
setup-python should install 3.10.4 as it is listed in the .python-version file, i.e. the step logs:

Run actions/setup-python@v4
  with:
    token: ***
Resolved  as 3.10.4

This is the behaviour with v4.0.0.

Actual behavior:
setup-python ignores the .python-version file and logs:

Run actions/setup-python@v4
Warning: Neither 'python-version' nor 'python-version-file' inputs were supplied.
Warning: The `python-version` input is not set.  The version of Python currently in `PATH` will be used.
@gg-kialo gg-kialo added bug Something isn't working needs triage labels Jul 12, 2022
@gg-kialo gg-kialo changed the title .python-version file is not used to establish the python version .python-version file is not used to establish the python version Jul 12, 2022
@IvanZosimov IvanZosimov self-assigned this Jul 12, 2022
@IvanZosimov IvanZosimov added documentation Improvements or additions to documentation and removed bug Something isn't working needs triage labels Jul 12, 2022
@IvanZosimov
Copy link
Contributor

Hi, @gg-kialo 👋 Thanks for that issue, actually it's not a bug, but a piece of excess information in the documentation. Since v4.1.0 action will check .python-version file either if .python-version file is specified in python-version-path input or if the path that is specified in python-version-path doesn't exist. Sorry for the inconvenience, we're going to fix the documentation as soon as possible.

@gg-kialo
Copy link
Author

Would you consider restoring the old behaviour? I've only just gone through all my repos and workflows and removed the with: python-version: xxx lines.
I quite like tooling respecting my toolchain files without me having to tell them to do so (like rust+cargo, nvm, etc.).

@rs-garrick
Copy link

rs-garrick commented Jul 15, 2022

Why do we have to add the default filename to our actions in all of our repos? Shouldn't the default behaviour just find the default file?

@IvanZosimov
Copy link
Contributor

Hi, @gg-kialo and @rs-garrick 👋 Thank you for your questions, we took them into consideration and decided to update behavior of the action, take a look at this PR.

@IvanZosimov
Copy link
Contributor

Hi, @ALL, I'm closing this issue now as the PR mentioned above was merged. If you have any additions feel free to ping us.

@OmeGak
Copy link

OmeGak commented Jul 19, 2022

All my CI workflows are still failing since they don't explicitly specify python-version-file. I guess GitHub Actions uses the latest available release of actions/setup-python@v4 (v4.1.0 at the moment) . Is there an ETA for a new release that includes the restored behavior introduced in #465? I'm trying to assess if it's worth to update all my CI workflows or just wait for the new release.

@IvanZosimov
Copy link
Contributor

Hi, @OmeGak 👋 Sorry for the long delay, the new version of setup-python is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants