question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`.python-version` file is not used to establish the python version

See original GitHub issue

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 https://github.com/actions/setup-python/pull/450/

Reading from .python-version when the python-version input is unset is documented in action.yml - https://github.com/actions/setup-python/blob/00a5248c77bed9280afb34f891aa24a152490ab5/action.yml#L6-L7

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/setup-python@v4.0.0

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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
IvanZosimovcommented, Jul 18, 2022

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.

1reaction
IvanZosimovcommented, Aug 2, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should we gitignore the .python-version file? - Stack Overflow
python -version file, and when I create a Python repo with github and specify that it should have a .gitignore , it adds...
Read more >
Your Guide to pyenv | LearnPython.com
This is your guide to pyenv for changing and switching between Python versions. pyenv lets you switch between Python versions.
Read more >
Managing Multiple Python Versions With pyenv
In this step-by-step tutorial, you'll learn how to install multiple Python versions and switch between them with ease, including project-specific virtual ...
Read more >
Dropping support for older Python versions
This mechanism can be used to drop support for older Python versions, by amending the “Requires-Python” attribute in the package metadata.
Read more >
How To Use Python Version Management with Pyenv
Visit the official Python website and install it on your machine. · Set up the shell as required – to enable pyenv to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found