setup-python icon indicating copy to clipboard operation
setup-python copied to clipboard

Support reading the version from from runtime.txt

Open fregante opened this issue 3 years ago • 1 comments

Description: https://github.com/actions/setup-python/pull/336 added support for .python-version, which is used by pyenv.

- uses: actions/setup-python@v4
  with:
    python-version-file: runtime.txt # ❌ fail 👇 
Resolved runtime.txt as python-3.10.7

Version python-3.10.7
 was not found in the local cache
Error: Version python-3.10.7
 with arch x64 not found
The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json

Justification: Runtime.txt is used by Heroku and more tools and it's not a raw version file like .python-version, it looks more like:

python-3.10.7

Dependabot also seems to explicitly support runtime.txt

More details: https://devcenter.heroku.com/articles/python-runtimes

My current solution involves manually parsing the file with an extra step:

      - name: Parse Python version
        run: sed  s/python-// runtime.txt | head > .python-version
      - uses: actions/setup-python@v4
        with:
          cache: pip

fregante avatar Oct 25 '22 09:10 fregante

Hello @fregante. Thank you for your report. We'll investigate the feature request.

dmitry-shibanov avatar Oct 25 '22 09:10 dmitry-shibanov