-
Notifications
You must be signed in to change notification settings - Fork 18
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
Auto activate venv when python-version is set #194
Conversation
9595274
to
1dd7e4b
Compare
ccecdb8
to
84c49d2
Compare
84c49d2
to
0f6716a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! I'm coming from #124 (comment), and I think this should resolve most of our problems with using setup-uv
in pyodide/pyodide#5255.
However, additionally, I was also testing this action on HIPS/autograd#659, and I found that it was difficult to get uv
to pick the correct Python version I have set up using the actions/setup-python
action, and what this action is doing here seems to resolve the problem by using its own setup-python
variable and using https://github.com/indygreg/python-build-standalone to grab Python binaries. Is there a way for uv
to "infer" the version of Python I set using actions/setup-python
without hacking my way with its outputs? That is, I'd love to be able to use the GHA Python builds seamlessly instead of using uv
's Python builds, since the latter still have some rough edges when working with compiled projects – where building from source has been battle-tested on Python binaries from GHA (or other sources, such as conda-forge
).
Edit: sorry, I should have checked the FAQ as well :) https://github.com/astral-sh/setup-uv#do-i-still-need-actionssetup-python-alongside-setup-uv. To elaborate a bit further: I think it's fine to use the standalone builds for pure Python projects and not recommend using actions/setup-python
, but here was a recent case where there were troubles with NumPy: astral-sh/python-build-standalone#374
@agriyakhetarpal I think the following should work: test-python-version:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Install latest version
uses: astral-sh/setup-uv@auto-environment
with:
python-version: ${{ matrix.python-version }} uv should then pickup the already configured system python by GHA and use it |
Ah, good idea – I will try that after this PR makes it to a release, so that I don't need to pass |
I should probably say that the weird floating point exception issues I saw with the python-build-standalone python I ultimately was able to reproduce with the python.org Python, so it probably has something to do with the system I was testing on. The issues with INCLUDEPY should be resolved in uv. I'm hoping to try converting some of the numpy and pyo3 CI jobs to use uv's python-build-standalone python soon and will follow up with any issues. Thanks so much for working to improve Python packaging and distribution! |
Closes: #124