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

setup-uv doesn't use latest Python 3.9 on macos #212

Open
vivodi opened this issue Dec 25, 2024 · 4 comments
Open

setup-uv doesn't use latest Python 3.9 on macos #212

vivodi opened this issue Dec 25, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@vivodi
Copy link

vivodi commented Dec 25, 2024

The following config installs Python 3.9.6 instead of Python 3.9.13.

jobs:
  tests:
    runs-on: macos-latest
    steps:
    - name: Install uv
      uses: astral-sh/setup-uv@v5
      with:
        python-version: 3.9
        enable-cache: true

actions/setup-python uses Python 3.9.13 on macos-latest, while setup-uv uses Python 3.9.6.

Proof

My test failed because of this version problem:
Failed test using setup-uv uses Python 3.9.6.
Successful test using actions/setup-python uses 3.9.13.

Run astral-sh/setup-uv@v5
  with:
    cache-dependency-glob: uv.lock
    enable-cache: true
    python-version: [3](https://github.com/vivodi/Flexget/actions/runs/12494794277/job/34864837941#step:3:3).9
    version: latest
    github-token: ***
    prune-cache: true
    ignore-nothing-to-cache: false
Downloading uv from "https://github.com/astral-sh/uv/releases/download/0.5.11/uv-aarch6[4](https://github.com/vivodi/Flexget/actions/runs/12494794277/job/34864837941#step:3:4)-apple-darwin.tar.gz" ...
......
......
Run uv run pytest -n logical --dist loadgroup --junit-xml=test-results.xml
============================= test session starts ==============================
platform darwin -- Python 3.9.6, pytest-[8](https://github.com/vivodi/Flexget/actions/runs/12494794277/job/34864837941#step:5:9).3.4, pluggy-1.5.0
Run actions/setup-python@v5
  with:
    python-version: 3.9
    check-latest: false
    token: ***
    update-environment: true
    allow-prereleases: false
Installed versions
  Version 3.9 was not found in the local cache
  Version 3.9 is available for downloading
  Download from "https://github.com/actions/python-versions/releases/download/3.9.13-111836878[2](https://github.com/vivodi/Flexget/actions/runs/12494892248/job/34865041628#step:3:2)0/python-[3](https://github.com/vivodi/Flexget/actions/runs/12494892248/job/34865041628#step:3:3).9.13-darwin-arm64.tar.gz"
@eifinger
Copy link
Collaborator

The rootcause is that uv searches for python executables that satisfy the requested version requirements before downloading a version. On macos there is 3.9.6 under /Applications/Xcode_15.4.app/Contents/Developer/usr/bin/python3.

I'm currently not sure what the best fix for that is. We could enforce downloading the latest version but by that would remove the capability to use system managed versions which e.g. get installed by actions/setup-python. This would break existing functionality.

@eifinger eifinger added the help wanted Extra attention is needed label Dec 26, 2024
@Ravencentric
Copy link

Would python-preference help here?
E.g.,

- name: Install uv
      uses: astral-sh/setup-uv@v5
      with:
        python-version: 3.9
        python-preference: "only-managed"

@vivodi
Copy link
Author

vivodi commented Dec 28, 2024

A good solution is to add the use-latest-python field, which you can refer to in the check-latest of actions/setup-python.

- name: Install uv
  uses: astral-sh/setup-uv@v5
  with:
    python-version: 3.9
    use-latest-python: true

@vivodi
Copy link
Author

vivodi commented Dec 28, 2024

We could enforce downloading the latest version but by that would remove the capability to use system managed versions which e.g. get installed by actions/setup-python.

But the fact is that the current behavior of astral-sh/setup-uv is different from actions/setup-python. actions/setup-python uses Python 3.9.13, while astral-sh/setup-uv uses Python 3.9.6, and the latest is Python 3.9.21.

I think astral-sh/setup-uv should at least align with actions/setup-python.

Image
Image
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants