Skip to content

Python-version output for PyPy isn't unique across different versions #1109

@cdce8p

Description

@cdce8p
Contributor

Description:
At the moment the python-version output for PyPy only includes the PyPy release version. In our workflow we use the python-version output to calculate a custom cache key. This breaks if the output for different minor version is the same. PyPy itself uses a combination of python version and internal version to identify each release.

PyPy file name 1 python-version output expected output
pypy3.10-v7.3.19-... pypy7.3.19 pypy3.10.16-7.3.19
pypy3.11-v7.3.19-... pypy7.3.19 pypy3.11.11-7.3.19

core.setOutput('python-version', 'pypy' + resolvedPyPyVersion);

It would be great if the output could be adjusted to include the python version as well. For it's own caching key, the action already uses a combine version identifier.

pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;

--
AFAICT this also affects graalpy. In that case it isn't an issue though as a particular release only supports one minor python version.

Expected behavior:
The python-version output for PyPy contains both the fully resolved python version as well as the resolved PyPy version. E.g.

`pypy${resolvedPythonVersion}-${resolvedPyPyVersion}`

Actual behavior:

'pypy' + resolvedPyPyVersion

Action version:
v5.6.0

Platform:

  • Ubuntu
    macOS
    Windows

Runner type:

  • Hosted
    Self-hosted

Tools version:
PyPy

Repro steps:

  tests:
    name: "Test ${{ matrix.python-version }}"
    strategy:
      matrix:
        python-version: ["3.10", "3.11", "3.12", "pypy-3.10", "pypy-3.11"]
    runs-on: ubuntu-latest
    steps:
      - name: Check out code from GitHub
        uses: actions/checkout@v4.2.2
      - name: Set up Python ${{ matrix.python-version }}
        id: python
        uses: actions/setup-python@v5.6.0
        with:
          python-version: ${{ matrix.python-version }}
          check-latest: true
      - run: echo "${{ steps.python.outputs.python-version }}"
      - name: Restore Python venv
        id: cache-venv
        uses: actions/cache@v4.2.3
        with:
          path: venv
          key: >-
            ${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version
            }}-${{ hashFiles('pyproject.toml', 'requirements_test.txt') }}
      - name: Create Python venv
        if: steps.cache-venv.outputs.cache-hit != 'true'
        run: |
          python -m venv venv
          . venv/bin/activate
          pip install -r requirements_test.txt
          pip install .
      - name: Run pytest
        run: |
          . venv/bin/activate
          pip install . --no-deps
          pytest tests/

Footnotes

  1. https://downloads.python.org/pypy/versions.json

Activity

priyagupta108

priyagupta108 commented on May 19, 2025

@priyagupta108
Contributor

Hello @cdce8p 👋,
Thank you for your report. We'll investigate the issue and get back to you with the details!

kurtmckee

kurtmckee commented on Jun 9, 2025

@kurtmckee
Contributor

A few years ago I tried to get better Python version output from setup-python but gave up waiting for feedback.

If there's interest I can try resubmitting that work.

cdce8p

cdce8p commented on Jun 9, 2025

@cdce8p
ContributorAuthor

Hi @kurtmckee 👋🏻 I saw your PR while searching for a solution for the issue. Personally it's a bit much for what I need. The python-version output is usually good enough already. It's just that current situation which PyPy where different Python version share the same release version.

With #1110 my intention therefore was to focus strictly on addressing the issue and nothing else to keep the diff as small as possible. Hopefully someone can take a look at it soon, given that it's only 7 LOC 🤞🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @kurtmckee@cdce8p@aparnajyothi-y@priyagupta108

    Issue actions

      Python-version output for PyPy isn't unique across different versions · Issue #1109 · actions/setup-python