8000 Identify all installed Python versions · Issue #606 · actions/setup-python · GitHub 8000
[go: up one dir, main page]

Skip to content
Identify all installed Python versions #606
Closed
@kurtmckee

Description

@kurtmckee

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:

  • A 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).
  • A file written at a known or configurable location that lists all of the install Python versions.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0