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

Refactor setupPython to use uv python pin & venv setup #291

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Julfried
Copy link

This PR attempts to fix the issue where setup-uv does not correctly set up the Python version when pyproject.toml is specified and Python should be automatically determined from this file. As described in #283.

This is achieved by:

  • Using uv python pin to correctly pin Python versions
  • Extracting the pinned version from .python-version to ensure UV_PYTHON is set before activating venv

Let me know what you think. Feedback is very welcome :)

Closes #283

@Julfried Julfried requested a review from eifinger as a code owner February 17, 2025 11:13
@eifinger
Copy link
Collaborator

Thank you for the PR.

Unfortunately this issue is a bit tricky. In general we have to decide how much this action should actually do as the name suggest it sets up uv and not more. It currently already does setup a venv in some cases. So we have to decide what the default behavior should be for most users.

Please understand that it might take a while for me to fully engage in feedback as this has to be in combination with

@Julfried
Copy link
Author

No worries, I just wanted to give this a try and propose a solution for my use case. I completely understand that the scope of setup-uv needs to be carefully considered.

That said, I do believe that setting up and activating a Python environment based on the current project should be included—ideally as an optional feature that users can enable if needed. This would make setup-uv more flexible without changing its default behavior.

I’d be happy to discuss this further and extend the PR to cover more use cases if that aligns with your vision. Take your time, and thanks again for the feedback :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Caching uv Dependencies Across Branches for Faster CI
2 participants