You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some tools are designed to have access to multiple python interpreters, and then create their own virtualenvs. Tox is a common example (although there are other ways to use tox in Actions). Less common, but my use case, is maturin https://github.com/PyO3/maturin , which is used to build rust crates with python bindings. It's a lot quicker to do them all at once rather than in different jobs, as most of the compiled code is shared.
It would be helpful if setup-python allowed users to pass an array of python versions and installed all of them (which one takes python is up for debate, but python3.7, python3.8 etc should be fine).
Reacted by Tomasz Trębski, Ran Benita, Julianus Pfeuffer, Thomas Grainger, Tom Gringauz, Jerome Leclanche, Michael Merickel, Andy Lok, Jordan Milne, Manuel Riel and 33 more
I would go for installing x86 and x64 python's at same time as well, expecially if it means generating python c extension modules depending on the platform.
Any practical workarounds? I need this in order to make use of combined coverage reporting and I really want to avoid going towards collecting artifacts and combining them later, it would add a lot of complexity to the pipelines and increase the lock-in effect.
My goal is to read the python versions I want to test against from a config file, so I don't have to update the workflow(s) later on, when I only want to add or remove a python version. As I currently cannot just pass the list of python versions to actions/setup-python action I separate them in another job beforehand and put them in different variables like so:
jobs:
pyproject-config:
name: Get config from pyproject.tomlruns-on: ubuntu-latestoutputs:
test_python_version_1: ${{ steps.get-config.outputs.test_python_version_1 }}test_python_version_2: ${{ steps.get-config.outputs.test_python_version_2 }}...steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install dependenciesrun: | python -m pip install -U pip pip install -U tomlkit
- name: Get configid: get-configshell: pythonrun: | import tomlkit with open("pyproject.toml") as pyproject_file: PYPROJECT = tomlkit.parse(pyproject_file.read()) test_ver = PYPROJECT["tool"]["_testing"]["ci_test_python_versions"] if len(test_ver) >= 1: print(f"::set-output name=test_python_version_1::{test_ver[0]}") if len(test_ver) >= 2: print(f"::set-output name=test_python_version_2::{test_ver[1]}") ...
The test job than depends on the upper job and initializes the python versions like so:
I was able to use the Miniconda action as shown below to accomplish the OP's mention for tox with multiple Pythons in one invocation, where I am testing a Python library for 3.7, 3.8, and 3.9. Note the bash -l {0} is required for the Miniconda action to work properly across steps. Below, the testenv environment is automatically active at each step. Essentially, I just create the extra Python environments using conda and append the paths for the Python binaries in those environments to the PATH when running tox in the testing environment.
Hello everyone. We released a new version with support to install multiple python versions and updated the major tag.
For now I'm going to close the issue. If you have any concerns feel free to ping us.
Does this include the ability to specify multiple architectures as well in it too? like x86 and x64 where it will install each version with each architecture listed?
Activity
graingert commentedon Aug 2, 2020
I'd like to use
tox --parallelfor linting py2 and py3 as it's faster than separate machines. So I'd also like to be able to install both at onceAraHaan commentedon Oct 20, 2020
I would go for installing x86 and x64 python's at same time as well, expecially if it means generating python c extension modules depending on the platform.
ssbarnea commentedon Jan 11, 2021
Any practical workarounds? I need this in order to make use of combined coverage reporting and I really want to avoid going towards collecting artifacts and combining them later, it would add a lot of complexity to the pipelines and increase the lock-in effect.
Cielquan commentedon Jan 12, 2021
My goal is to read the python versions I want to test against from a config file, so I don't have to update the workflow(s) later on, when I only want to add or remove a python version. As I currently cannot just pass the list of python versions to
actions/setup-pythonaction I separate them in another job beforehand and put them in different variables like so:The test job than depends on the upper job and initializes the python versions like so:
I currently does that for 10 possible python versions and have 7 specified (incl. PyPy) so 3 steps are skipped.
btcross26 commentedon May 24, 2021
I was able to use the Miniconda action as shown below to accomplish the OP's mention for tox with multiple Pythons in one invocation, where I am testing a Python library for 3.7, 3.8, and 3.9. Note the
bash -l {0}is required for the Miniconda action to work properly across steps. Below, thetestenvenvironment is automatically active at each step. Essentially, I just create the extra Python environments using conda and append the paths for the Python binaries in those environments to the PATH when running tox in thetestingenvironment.dmitry-shibanov commentedon Jan 9, 2023
Hello everyone. We released a new version with support to install multiple python versions and updated the major tag.
For now I'm going to close the issue. If you have any concerns feel free to ping us.
AraHaan commentedon Jan 11, 2023
Does this include the ability to specify multiple architectures as well in it too? like x86 and x64 where it will install each version with each architecture listed?