-
Notifications
You must be signed in to change notification settings - Fork 617
Identify all installed Python versions #606
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
Comments
I've attempted to implement this. So far in my testing I'm not getting the additional |
Hello @kurtmckee! |
Hmm...it may be that I need to run |
Closing this. For any others finding this: I wrote https://github.com/kurtmckee/detect-pythons to address this need, since #611 didn't get reviewed/merged. |
Description:
I'd like trivially use all of the installed Python versions (in full) in my cache keys (like "3.8.16" and "3.9.16 (PyPy 7.3.11)").
This could be implemented in several ways, including:
python-versions
(plural!) output that includes the full Python versions in full. (How it's delimited doesn't matter to me due to my use case.) For example,3.8.10; 3.9.13; 3.9.16 (PyPy 7.3.11)
.Justification:
I'm very pleased with the new ability to install multiple Python versions simultaneously! This pairs well with tox-based testing.
I'm wanting to cache and restore my
.tox/
directories between runs, particularly on Windows hosts, because it's expensive to set up the tox environments for each Python version. In the past, with only one Python version installed, I would use the action output,python-version
, as a part of the cache key.However, when multiple versions are installed, if there is a cache hit but one of the Python versions that isn't the default has updated (say, if "3.11" is the default but "3.8" updates from "3.8.10" to "3.8.11") then tox will rebuild the 3.8 environment each time the cache is restored, the cache won't be invalidated, and test setup times will start to increase.
I don't know of a trivial, cross-platform way to write this myself that will work consistently as new Python versions and host platforms are added (like Pyston, as I saw in another ticket)...but I'd prefer to avoid crawling the filesystem and executing
python -V
on every executable that looks like a Python interpreter.Therefore, I think that outputting this metadata from within the setup-python action would be the most ideal scenario.
Are you willing to submit a PR?
I'd love to try! I don't know TypeScript and it might take a bit to write something that fits the requirements and runs correctly.
I'll take a look at what that might look like (particularly by studying the existing
python-version
output) while awaiting feedback for this idea.The text was updated successfully, but these errors were encountered: