Skip to content

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

Closed
Julfried wants to merge 3 commits intoastral-sh:mainfrom
Julfried:fix-python-setup
Closed

Refactor setupPython to use uv python pin & venv setup#291
Julfried wants to merge 3 commits intoastral-sh:mainfrom
Julfried:fix-python-setup

Conversation

@Julfried
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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 :)

@eifinger eifinger added the venv-activation Temporay label to track issues with first venv activation label Mar 29, 2025
@eifinger
Copy link
Copy Markdown
Collaborator

Resolved by: #381

Thank you very much for your input!

@eifinger eifinger closed this Apr 24, 2025
@Julfried Julfried deleted the fix-python-setup branch April 24, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

venv-activation Temporay label to track issues with first venv activation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python version part of the cache key is undefined if the required python version is not yet installed

2 participants