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

loop over python versions in github actions #9376

Closed
zkurtz opened this issue Nov 23, 2024 · 6 comments
Closed

loop over python versions in github actions #9376

zkurtz opened this issue Nov 23, 2024 · 6 comments
Labels
question Asking for clarification or support

Comments

@zkurtz
Copy link
Contributor

zkurtz commented Nov 23, 2024

Here is what I did and it seems to work. But is that really the recommended way? It feels a bit hacky to overwrite .python-version. FWIW I'd appreciate any other feedback on that workflow config. I'm trying to set up uv with a few repos and would like to get my setup right.

@samypr100
Copy link
Collaborator

👋 I believe you can use UV_PYTHON instead

@samypr100 samypr100 added the question Asking for clarification or support label Nov 23, 2024
@zkurtz
Copy link
Contributor Author

zkurtz commented Nov 23, 2024

Seems to be working:

    - name: Set the python version for UV
      run: echo "UV_PYTHON=${{ matrix.python-version }}" >> $GITHUB_ENV

@zkurtz zkurtz closed this as completed Nov 23, 2024
@zanieb
Copy link
Member

zanieb commented Nov 26, 2024

I'd be happy to review a pull request adding documentation if needed. There's a bit at http://docs.astral.sh/uv/guides/integration/github/#setting-up-python but this sounds different.

@zkurtz
Copy link
Contributor Author

zkurtz commented Nov 26, 2024

Although #9376 (comment) seems to be working, I'm still not clear if that's considered a recommendable/canonical approach. From the docs you linked ^^, there is also this option

      - name: Set up Python ${{ matrix.python-version }}
        run: uv python install ${{ matrix.python-version }}

but it's not obvious to me whether the python version here specifically overrides the python version that would be used by subsequent uv run commands, which should obey the .python-version file regardless of which other versions of python happen to be available on the system

@zanieb
Copy link
Member

zanieb commented Nov 26, 2024

Yeah uv run would respect the .python-version file and ignore the installed version

@zkurtz
Copy link
Contributor Author

zkurtz commented Nov 26, 2024

#9454

zanieb added a commit that referenced this issue Dec 16, 2024
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

Existing documentation on how to apply a matrix strategy over the python
version in a github workflow is incomplete and possibly misleading. This
PR deletes the existing section and creates a new one to reflect current
best practice. See #9376.

## Test Plan

N/A, only docs.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

3 participants