Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Read python version from pyproject.toml (fix #542)#669

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dmitry-shibanov merged 8 commits intoactions:mainfromdariocurr:main
Jun 28, 2023
Merged

Read python version from pyproject.toml (fix #542)#669

dmitry-shibanov merged 8 commits intoactions:mainfromdariocurr:main
Jun 28, 2023

Conversation

@dariocurr
Copy link
Contributor

@dariocurrdariocurr commentedMay 22, 2023
edited
Loading

Hi, I'm Dario, a tech PO athiop.

Description:
This PR enables the action to read the Python version from thepyproject.toml file (or another TOML file if specified) both for standard python (PEP 621,PEP 508) and poetry (https://python-poetry.org/docs/basic-usage/).

More in detail, it deserializes the TOML files using thetoml package and then navigates it to extract the Python versions.

Related issue:

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Notes:

  1. Is there a specific reason not to test thesrc/setup-python.ts? I didn't find any test related to those functions
  2. >=3.9,<=3.10 bounds are transformed insemver-like bounds
  3. In addition to the tests for this new feature, I added some missing tests. For example.
  • .python-version file used if no parameters are provided.github/workflows/test-python.yml
  • python version provided with bounds.github/workflows/e2e-tests.yml

jacksonj04 reacted with hooray emojiavillp, BrandonLWhite, giacomorebecchi, jacksonj04, per1234, and drumgoolej reacted with heart emoji
@dariocurrdariocurr requested a review froma team as acode ownerMay 22, 2023 19:38
@dariocurrdariocurr changed the titleReading python version from pyproject.toml (fix #542)Read python version from pyproject.toml (fix #542)May 22, 2023
@dariocurr
Copy link
ContributorAuthor

Is anyone maintaining this action?

@dmitry-shibanov
Copy link
Contributor

Hello@dariocurr. Sorry for the late response. Could you please fix the code because it looks like you have the recursive calling of some function.

@dariocurr
Copy link
ContributorAuthor

dariocurr commentedJun 6, 2023
edited
Loading

Sorry, I fixed it, it was a silly error.
I thought the workflows were failing because I was overshooting the API calls

@dariocurr
Copy link
ContributorAuthor

I guess we are ready to give it another run

@dariocurr
Copy link
ContributorAuthor

Can I have more info about the failing test?

@dmitry-shibanov
Copy link
Contributor

Hello@dariocurr. If I understood correctly you changed that python-version input could accept values from toml files ? If it's so could you please change to python-version-file input only. Besides, I'm not sure about toml library because the last update was 4 years ago. Can we achieve required behaviour without extra library ?

@dariocurr
Copy link
ContributorAuthor

I didn't understand your first request, can you please explain it better?
About the TOML package, sure I can look for a newer and maintained package, but parsing a TOML manually seems silly to me

@dariocurr
Copy link
ContributorAuthor

I replacedtoml with@iarna/toml which as you can seehere should not have any vulnerabilities and it's probably the best option.
I don't want to implement a customTOML parser. It sounds like reinventing the wheel to me.
Many packages are old and not maintained anymore because there is nothing new and there is no need to update them

}).join('\n')
if (escaped.slice(-1) === '"') escaped += '\\\n'
return '"""\n' + escaped + '"""'
}

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding

This does not escape backslash characters in the input.
@dariocurr
Copy link
ContributorAuthor

I don't have a clue about the failing checks and CodeQL issue

-name:Run with setup-python ==3.8
uses:./
with:
python-version:'==3.8'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could you please keep syntax specific for toml files for python-version-file

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you explain better the expected behaviour you desire?

Copy link
ContributorAuthor

@dariocurrdariocurrJun 23, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's quite difficult for me to keep up with this PR with feedbacks once a week

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Previously such type of syntax was not supported by setup-python. If I understood correctly it comes from the toml file log. I'd like to keep this logic in the scope of python-version-file input.

Copy link
ContributorAuthor

@dariocurrdariocurrJun 23, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You already supported it because you parse versions usingsemver. I did not change the parsing behavior.

You were already supporting it, but you were not testing it.

giacomorebecchi, fioreale, and ggbaro reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you for your response@dariocurr. It is right that '==3.8' is supported by SemVer but as I suppose that>=3.8,<3.10 is not supported. If it is so could you please keep logic regarding to toml to python-version-file parsing.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It is right that we need to change it to SemVer syntax but I'd like to keep it this syntax for in scope of python-version-file input so when you get it from the toml file it get parsed but it should not be allowed to pass it through python-version input.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Done with39c1ae5

if(versions.length&&versionFile){
core.warning(
'Both python-version and python-version-file inputs are specified, only python-version will be used.'
functionresolveVersionInputFromDefaultFile():string[]{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could you please removepyproject.toml. We'd like to keep only.python-version file as a default option.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

IMHO it would be a nice option since is the python standard (PEP 621) and this action is calledsetup-python.
But as you wish. I edited it in the latest commit

john-kurkowski reacted with thumbs up emoji
@dariocurr
Copy link
ContributorAuthor

I fixed the test that was failing

@dariocurr
Copy link
ContributorAuthor

I fixed also the prettier issue

@dariocurr
Copy link
ContributorAuthor

Ready to go?

@dmitry-shibanovdmitry-shibanov merged commit0d5da6a intoactions:mainJun 28, 2023
@dmitry-shibanov
Copy link
Contributor

Hello@dariocurr. Thank you for your pull request. I'll test the action additionally this week. After that we'll prepare a new release next week.

@BrandonLWhite
Copy link

Wow! Thanks@dariocurr for implementing this and sticking with it! Little improvements to the Python ecosystem like this that simplify and unify project config are huge benefits.

@dariocurr
Copy link
ContributorAuthor

Thank you for accepting the PR.
It is a pleasure to contribute to such an impactful project.
Feel free to contact me if you have any problems during testing or need help with future new features!

fioreale and timxyz reacted with rocket emoji

@dariocurr
Copy link
ContributorAuthor

When will it be released?

welpaolo referenced this pull request in canonical/spark-k8s-toolkit-pyAug 14, 2023
[![MendRenovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)This PR contains the following updates:| Package | Type | Update | Change ||---|---|---|---|| [actions/setup-python](https://togithub.com/actions/setup-python) |action | major | `v2.2.2` -> `v4.7.0` ||[canonical/data-platform-workflows](https://togithub.com/canonical/data-platform-workflows)| action | major | `v2` -> `v4` |---### Release Notes<details><summary>actions/setup-python (actions/setup-python)</summary>###[`v4.7.0`](https://togithub.com/actions/setup-python/releases/tag/v4.7.0)[CompareSource](https://togithub.com/actions/setup-python/compare/v4.6.1...v4.7.0)In scope of this release, the support for reading python version frompyproject.toml was added([https://github.com/actions/setup-python/pull/669](https://togithub.com/actions/setup-python/pull/669)).```yaml      - name: Setup Python        uses: actions/setup-python@v4        with:          python-version-file: pyproject.toml```##### Besides, it includes such changes as:- Bump tough-cookie and[@&#8203;azure/ms-rest-js](https://togithub.com/azure/ms-rest-js) by[@&#8203;dependabot](https://togithub.com/dependabot) in[https://github.com/actions/setup-python/pull/697](https://togithub.com/actions/setup-python/pull/697)- Bump semver from 7.3.8 to 7.5.2 by[@&#8203;dependabot](https://togithub.com/dependabot) in[https://github.com/actions/setup-python/pull/692](https://togithub.com/actions/setup-python/pull/692)- Fix typos found by codespell by[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)in[https://github.com/actions/setup-python/pull/650](https://togithub.com/actions/setup-python/pull/650)#### New Contributors- [@&#8203;dariocurr](https://togithub.com/dariocurr) made their firstcontribution in[https://github.com/actions/setup-python/pull/669](https://togithub.com/actions/setup-python/pull/669)-[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)made their first contribution in[https://github.com/actions/setup-python/pull/650](https://togithub.com/actions/setup-python/pull/650)**Full Changelog**:actions/setup-python@v4...v4.7.0###[`v4.6.1`](https://togithub.com/actions/setup-python/releases/tag/v4.6.1)[CompareSource](https://togithub.com/actions/setup-python/compare/v4.6.0...v4.6.1)#### What's Changed- Fix `allow-prereleases` sample configuration by[@&#8203;mayeut](https://togithub.com/mayeut) in[https://github.com/actions/setup-python/pull/615](https://togithub.com/actions/setup-python/pull/615)- Fix a incorrect link advanced-usage.md by[@&#8203;siyuan0322](https://togithub.com/siyuan0322) in[https://github.com/actions/setup-python/pull/657](https://togithub.com/actions/setup-python/pull/657)- Remove implicit dependency by[@&#8203;nikolai-laevskii](https://togithub.com/nikolai-laevskii) in[https://github.com/actions/setup-python/pull/668](https://togithub.com/actions/setup-python/pull/668)- Automatic update of configuration files from 05/23/2023 by[@&#8203;github-actions](https://togithub.com/github-actions) in[https://github.com/actions/setup-python/pull/671](https://togithub.com/actions/setup-python/pull/671)- Add warning for python 2.7 on release/v4 by[@&#8203;dmitry-shibanov](https://togithub.com/dmitry-shibanov) in[https://github.com/actions/setup-python/pull/673](https://togithub.com/actions/setup-python/pull/673)#### New Contributors- [@&#8203;siyuan0322](https://togithub.com/siyuan0322) made their firstcontribution in[https://github.com/actions/setup-python/pull/657](https://togithub.com/actions/setup-python/pull/657)- [@&#8203;nikolai-laevskii](https://togithub.com/nikolai-laevskii) madetheir first contribution in[https://github.com/actions/setup-python/pull/668](https://togithub.com/actions/setup-python/pull/668)**Full Changelog**:actions/setup-python@v4...v4.6.1###[`v4.6.0`](https://togithub.com/actions/setup-python/releases/tag/v4.6.0):Add allow-prereleases input[CompareSource](https://togithub.com/actions/setup-python/compare/v4.5.0...v4.6.0)In scope of this release we added a new input (`allow-prereleases`) toallow [falling back to pre-release versions of Python when a matching GAversion of Python is notavailable](https://togithub.com/actions/setup-python/pull/414)```yamlsteps:  - uses: actions/checkout@v3  - uses: actions/setup-python@v4    with:      python-version: 3.12      allow-prereleases: true```Besides, we added such changes as:- Fix bug to trim new line for PyPy version:[https://github.com/actions/setup-python/pull/610](https://togithub.com/actions/setup-python/pull/610)- Added pip dependency file to generate hash from it:[https://github.com/actions/setup-python/pull/604](https://togithub.com/actions/setup-python/pull/604)- Improved error handling for saving and restoring cache:[https://github.com/actions/setup-python/pull/618](https://togithub.com/actions/setup-python/pull/618)- Add warning if cache paths are empty:[https://github.com/actions/setup-python/pull/642](https://togithub.com/actions/setup-python/pull/642)###[`v4.5.0`](https://togithub.com/actions/setup-python/releases/tag/v4.5.0):Fix cache issue for Poetry projects located in subfolders[CompareSource](https://togithub.com/actions/setup-python/compare/v4.4.0...v4.5.0)In scope of this release we fixed cache issue for Poetry projectslocated in subfolders([https://github.com/actions/setup-python/issues/446](https://togithub.com/actions/setup-python/issues/446)).Besides that we updated json5 version from 2.2.0 to 2.2.3([https://github.com/actions/setup-python/pull/579](https://togithub.com/actions/setup-python/pull/579)).###[`v4.4.0`](https://togithub.com/actions/setup-python/releases/tag/v4.4.0):Add support to install multiple python versions[CompareSource](https://togithub.com/actions/setup-python/compare/v4.3.1...v4.4.0)In scope of this release we added support to [install multiple pythonversions](https://togithub.com/actions/setup-python/pull/567). For thisyou can try to use this snippet:```yaml    - uses: actions/setup-python@v4      with:        python-version: |            3.8            3.9            3.10```Besides, we changed logic with throwing the error for GHES if cache isunavailable to warn([https://github.com/actions/setup-python/pull/566](https://togithub.com/actions/setup-python/pull/566)).###[`v4.3.1`](https://togithub.com/actions/setup-python/releases/tag/v4.3.1):Improve error handling and messages[CompareSource](https://togithub.com/actions/setup-python/compare/v4.3.0...v4.3.1)In scope of this release we added improved error message to putoperating system and its version in the logs([https://github.com/actions/setup-python/pull/559](https://togithub.com/actions/setup-python/pull/559)).Besides, the release- fixes issue about [specifying architecture for pypy-nightly onWindows](https://togithub.com/actions/setup-python/issues/518) withrelated [pullrequest](https://togithub.com/actions/setup-python/pull/520).- improves error handling for Http Errors([https://github.com/actions/setup-python/pull/511](https://togithub.com/actions/setup-python/pull/511)).- updates minimatch([https://github.com/actions/setup-python/pull/558](https://togithub.com/actions/setup-python/pull/558)).###[`v4.3.0`](https://togithub.com/actions/setup-python/releases/tag/v4.3.0)[CompareSource](https://togithub.com/actions/setup-python/compare/v4.2.0...v4.3.0)- Update [@&#8203;actions/core](https://togithub.com/actions/core) to1.10.0 version[#&#8203;517](https://togithub.com/actions/setup-python/issues/517)- Update [@&#8203;actions/cache](https://togithub.com/actions/cache) to3.0.4 version[#&#8203;499](https://togithub.com/actions/setup-python/issues/499)- Only use github.token on github.com[#&#8203;443](https://togithub.com/actions/setup-python/issues/443)- Improvement of documentation[#&#8203;477](https://togithub.com/actions/setup-python/issues/477)[#&#8203;479](https://togithub.com/actions/setup-python/issues/479)[#&#8203;491](https://togithub.com/actions/setup-python/issues/491)[#&#8203;492](https://togithub.com/actions/setup-python/issues/492)###[`v4.2.0`](https://togithub.com/actions/setup-python/releases/tag/v4.2.0):Add check-latest input and bug fixes[CompareSource](https://togithub.com/actions/setup-python/compare/v4.1.0...v4.2.0)In scope of this release we addthe [check-latest](https://togithub.com/actions/setup-python/pull/406) input.If check-latest is set to true, the action first checks if the cachedversion is the latest one. If the locally cached version is not the mostup-to-date, the version will then be downloadedfrom [python-versions](https://togithub.com/actions/python-versions) repository.By default check-latest is set to false. For PyPy it will to try toreachhttps://downloads.python.org/pypy/versions.json##### Example of usage:```yamlsteps:  - uses: actions/checkout@v3  - uses: actions/setup-python@v4    with:      python-version: '3.9'      check-latest: true  - run: python --version```Besides, it includes such changes as- Resolved logs for python-version and file inputs:[https://github.com/actions/setup-python/pull/465](https://togithub.com/actions/setup-python/pull/465)- Added linux os release info to primary key:[https://github.com/actions/setup-python/pull/467](https://togithub.com/actions/setup-python/pull/467)- Added fix to change Python versions for poetry:[https://github.com/actions/setup-python/pull/445](https://togithub.com/actions/setup-python/pull/445)- Fix Tool Path handling for self-hosted runners:[https://github.com/actions/setup-python/pull/466](https://togithub.com/actions/setup-python/pull/466)###[`v4.1.0`](https://togithub.com/actions/setup-python/releases/tag/v4.1.0)[CompareSource](https://togithub.com/actions/setup-python/compare/v4.0.0...v4.1.0)In scope of this pull request we updated `actions/cache` package as thenew version contains fixes for [caching errorhandling](https://togithub.com/actions/setup-python/pull/448). Moreover,we added a new input[update-environment](https://togithub.com/actions/setup-python/pull/411).This option allows to specify if the action shall update environmentvariables (default) or not.##### Update-environment input```yaml    - name: setup-python 3.9      uses: actions/setup-python@v4      with:        python-version: 3.9        update-environment: false```**Besides, we added such changes as:**- Allow python-version-file to be a relative path:[https://github.com/actions/setup-python/pull/431](https://togithub.com/actions/setup-python/pull/431)- Added new environment variables for `Cmake`:[https://github.com/actions/setup-python/pull/440](https://togithub.com/actions/setup-python/pull/440)- Updated error message for resolveVersion:[https://github.com/actions/setup-python/pull/450](https://togithub.com/actions/setup-python/pull/450)- Assign default value of `AGENT_TOOLSDIRECTORY` if not set:[https://github.com/actions/setup-python/pull/394](https://togithub.com/actions/setup-python/pull/394)###[`v4.0.0`](https://togithub.com/actions/setup-python/releases/tag/v4.0.0)[CompareSource](https://togithub.com/actions/setup-python/compare/v3.1.4...v4.0.0)##### What's Changed- Support for `python-version-file` input:[#&#8203;336](https://togithub.com/actions/setup-python/issues/336)Example of usage:```yaml- uses: actions/setup-python@v4  with:    python-version-file: '.python-version' # Read python version from a file- run: python my_script.py```There is no default python version for this `setup-python` majorversion, the action requires to specify either `python-version` input or`python-version-file` input. If the `python-version` input is notspecified the action will try to read required version from file from`python-version-file` input.- Use pypyX.Y for PyPy `python-version` input:[#&#8203;349](https://togithub.com/actions/setup-python/issues/349)Example of usage:```yaml- uses: actions/setup-python@v4  with:    python-version: 'pypy3.9' # pypy-X.Y kept for backward compatibility- run: python my_script.py```- `RUNNER_TOOL_CACHE` environment variable is equal`AGENT_TOOLSDIRECTORY`:[#&#8203;338](https://togithub.com/actions/setup-python/issues/338)- Bugfix: create missing `pypyX.Y` symlinks:[#&#8203;347](https://togithub.com/actions/setup-python/issues/347)- `PKG_CONFIG_PATH` environment variable:[#&#8203;400](https://togithub.com/actions/setup-python/issues/400)- Added `python-path` output:[#&#8203;405](https://togithub.com/actions/setup-python/issues/405)    `python-path` output contains Python executable path.- Updated `zeit/ncc` to `vercel/ncc` package:[#&#8203;393](https://togithub.com/actions/setup-python/issues/393)- Bugfix: fixed output for prerelease version of poetry:[#&#8203;409](https://togithub.com/actions/setup-python/issues/409)- Made `pythonLocation` environment variable consistent for Python andPyPy:[#&#8203;418](https://togithub.com/actions/setup-python/issues/418)- Bugfix for `3.x-dev` syntax:[#&#8203;417](https://togithub.com/actions/setup-python/issues/417)- Other improvements:[#&#8203;318](https://togithub.com/actions/setup-python/issues/318)[#&#8203;396](https://togithub.com/actions/setup-python/issues/396)[#&#8203;384](https://togithub.com/actions/setup-python/issues/384)[#&#8203;387](https://togithub.com/actions/setup-python/issues/387)[#&#8203;388](https://togithub.com/actions/setup-python/issues/388)###[`v3.1.4`](https://togithub.com/actions/setup-python/releases/tag/v3.1.4)[CompareSource](https://togithub.com/actions/setup-python/compare/v3.1.3...v3.1.4)#### What's ChangedIn the scope of this patch release, the warning for deprecating Python2.x was added in[https://github.com/actions/setup-python/pull/674](https://togithub.com/actions/setup-python/pull/674)by [@&#8203;dmitry-shibanov](https://togithub.com/dmitry-shibanov)For more information, check out[https://github.com/actions/setup-python/issues/672](https://togithub.com/actions/setup-python/issues/672)**Full Changelog**:actions/setup-python@v3...v3.1.4###[`v3.1.3`](https://togithub.com/actions/setup-python/releases/tag/v3.1.3):Update actions/core to 1.10.0 for v3[CompareSource](https://togithub.com/actions/setup-python/compare/v3.1.2...v3.1.3)In scope of this release we update actions/core to 1.10.0 for v3 majortag:[https://github.com/actions/setup-python/pull/624](https://togithub.com/actions/setup-python/pull/624)###[`v3.1.2`](https://togithub.com/actions/setup-python/releases/tag/v3.1.2):Update actions/cache version to 2.0.2[CompareSource](https://togithub.com/actions/setup-python/compare/v3.1.1...v3.1.2)In scope of this release we updated `actions/cache` package as the newversion contains fixes related to GHES 3.5([https://github.com/actions/setup-python/pull/382](https://togithub.com/actions/setup-python/pull/382))###[`v3.1.1`](https://togithub.com/actions/setup-python/releases/tag/v3.1.1):Add &quot;cache-hit&quot; output and fix &quot;python-version&quot;output for PyPy[CompareSource](https://togithub.com/actions/setup-python/compare/v3.1.0...v3.1.1)This release introduces new output cache-hit([https://github.com/actions/setup-python/pull/373](https://togithub.com/actions/setup-python/pull/373))and fix python-version output for PyPy([https://github.com/actions/setup-python/pull/365](https://togithub.com/actions/setup-python/pull/365))The cache-hit output contains boolean value indicating that an exactmatch was found for the key. It shows that the action uses alreadyexisting cache or not. The output is available only if cache is enabled.The python-version contains version of Python or PyPy.###[`v3.1.0`](https://togithub.com/actions/setup-python/releases/tag/v3.1.0):Support caching poetry dependencies and caching on GHES 3.5[CompareSource](https://togithub.com/actions/setup-python/compare/v3.0.0...v3.1.0)- In the scope of this release, we added [support for caching from GHES3.5](https://togithub.com/actions/setup-python/issues/362) and fixed thedownload issue for files > 2GB during restore.-   Caching poetry dependencies```yamlsteps:- uses: actions/checkout@v3- name: Install poetry  run: pipx install poetry- uses: actions/setup-python@v3  with:    python-version: '3.9'    cache: 'poetry'- run: poetry install- run: poetry run pytest```###[`v3.0.0`](https://togithub.com/actions/setup-python/releases/tag/v3.0.0)[CompareSource](https://togithub.com/actions/setup-python/compare/v2.3.4...v3.0.0)#### What's Changed- Update default runtime to node16([https://github.com/actions/setup-python/pull/340](https://togithub.com/actions/setup-python/pull/340))- Update `package-lock.json` file version to 2, `@types/node` to16.11.25 and `typescript` to 4.2.3([https://github.com/actions/setup-python/pull/341](https://togithub.com/actions/setup-python/pull/341))- Remove legacy `pypy2` and `pypy3` keywords([https://github.com/actions/setup-python/pull/342](https://togithub.com/actions/setup-python/pull/342))##### Breaking ChangesWith the update to Node 16, all scripts will now be run with Node 16rather than Node 12.This new major release removes support of legacy `pypy2` and `pypy3`keywords. Please use more specific and flexible syntax to specify a PyPyversion:```yamljobs:  build:    runs-on: ubuntu-latest    strategy:      matrix:        python-version:        - 'pypy-2.7' # the latest available version of PyPy that supports Python 2.7        - 'pypy-3.8' # the latest available version of PyPy that supports Python 3.8        - 'pypy-3.8-v7.3.8' # Python 3.8 and PyPy 7.3.8    steps:    - uses: actions/checkout@v2    - uses: actions/setup-python@v3      with:        python-version: ${{ matrix.python-version }}```See more usage examples in the[documentation](https://togithub.com/actions/setup-python#specifying-a-pypy-version)###[`v2.3.4`](https://togithub.com/actions/setup-python/releases/tag/v2.3.4)[CompareSource](https://togithub.com/actions/setup-python/compare/v2.3.3...v2.3.4)#### What's ChangedIn the scope of this patch release, the warning for deprecating Python2.x was added in[https://github.com/actions/setup-python/pull/675](https://togithub.com/actions/setup-python/pull/675)by [@&#8203;dmitry-shibanov](https://togithub.com/dmitry-shibanov)For more information, check out[https://github.com/actions/setup-python/issues/672](https://togithub.com/actions/setup-python/issues/672)**Full Changelog**:actions/setup-python@v2...v2.3.4###[`v2.3.3`](https://togithub.com/actions/setup-python/releases/tag/v2.3.3):Update actions/core to 1.10.0 for v2[CompareSource](https://togithub.com/actions/setup-python/compare/v2.3.2...v2.3.3)In scope of this release we update actions/core to 1.10.0 for v2 majortag:[https://github.com/actions/setup-python/pull/533](https://togithub.com/actions/setup-python/pull/533).###[`v2.3.2`](https://togithub.com/actions/setup-python/releases/tag/v2.3.2):Update primary and restore keys for pip[CompareSource](https://togithub.com/actions/setup-python/compare/v2.3.1...v2.3.2)In scope of this release we [include a version of python in restore andprimary cache keys forpip](https://togithub.com/actions/setup-python/pull/303). Besides, weadd temporary fix for Windows caching[issue](https://togithub.com/actions/setup-python/pull/332), that the`pip cache dir` command returns non zero exit code or writes to stderr.Moreover we updated [node-fetchdependency](https://togithub.com/actions/setup-python/pull/327).###[`v2.3.1`](https://togithub.com/actions/setup-python/releases/tag/v2.3.1):Update actions/cache version to 1.0.8[CompareSource](https://togithub.com/actions/setup-python/compare/v2.3.0...v2.3.1)We haveupdated [actions/cache](https://togithub.com/actions/toolkit/blob/main/packages/cache/RELEASES.md#108) dependencyversion to 1.0.8 to support 10GB cache upload###[`v2.3.0`](https://togithub.com/actions/setup-python/releases/tag/v2.3.0):Support caching dependencies[CompareSource](https://togithub.com/actions/setup-python/compare/v2.2.2...v2.3.0)This release introduces dependency caching support([https://github.com/actions/setup-python/pull/266](https://togithub.com/actions/setup-python/pull/266))#### Caching dependencies.The action has a built-in functionality for caching and restoringpip/pipenv dependencies. The `cache` input is optional, and caching isturned off by default.Besides, this release introduces dependency caching support for monorepos and repositories with complex structure.By default, the action searches for the dependency file(requirements.txt for pip or Pipfile.lock for pipenv) in the wholerepository. Use the `cache-dependency-path` input for cases when youwant to override current behaviour and use different file for hashgeneration (for example requirements-dev.txt). This input supportswildcards or a list of file names for caching multiple dependencies.##### Caching pip dependencies:    steps:    - uses: actions/checkout@v2    - uses: actions/setup-python@v2      with:        python-version: '3.9'        cache: 'pip'    - run: pip install -r requirements.txt    - run: pip test##### Caching pipenv dependencies:    steps:    - uses: actions/checkout@v2    - name: Install pipenv      run: pipx install pipenv    - uses: actions/setup-python@v2      with:        python-version: '3.9'        cache: 'pipenv'    - run: pipenv install    - run: pipenv test##### Change dependency file:    steps:    - uses: actions/checkout@v2    - uses: actions/setup-python@v2      with:        python-version: '3.9'        cache: 'pip'        cache-dependency-path: '**/requirements-dev.txt'    - run: pip install -r subdirectory/requirements-dev.txt    - run: pip test</details><details><summary>canonical/data-platform-workflows(canonical/data-platform-workflows)</summary>###[`v4`](https://togithub.com/canonical/data-platform-workflows/compare/v3...v4)[CompareSource](https://togithub.com/canonical/data-platform-workflows/compare/v3...v4)###[`v3`](https://togithub.com/canonical/data-platform-workflows/compare/v2...v3)[CompareSource](https://togithub.com/canonical/data-platform-workflows/compare/v2...v3)</details>---### Configuration📅 **Schedule**: Branch creation - "after 1am and before 2am on saturday"in timezone Etc/UTC, Automerge - At any time (no schedule defined).🚦 **Automerge**: Disabled by config. Please merge this manually once youare satisfied.♻ **Rebasing**: Whenever PR becomes conflicted, or you tick therebase/retry checkbox.🔕 **Ignore**: Close this PR and you won't be reminded about theseupdates again.---- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, checkthis box---This PR has been generated by [MendRenovate](https://www.mend.io/free-developer-tools/renovate/). Viewrepository job log[here](https://developer.mend.io/github/canonical/spark-k8s-toolkit-py).<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi40MC4zIiwidXBkYXRlZEluVmVyIjoiMzYuNDAuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@zoj613
Copy link

This seems like a great addition and should eliminate the need to specify

matrix:python-version:[ ... ]

Usually I usepython-version to help name a workflow step like so:Python version - ${{ matrix.python-version }} - ${{ matrix.os }}. Is there a way to get this supported using information frompyproject.toml without having to keep the above snippet in the workflow file?

@dariocurr
Copy link
ContributorAuthor

We could add an output value to use in the following steps

zoj613 reacted with thumbs up emoji

tdfacer pushed a commit to ifit/setup-python that referenced this pull requestOct 7, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@dmitry-shibanovdmitry-shibanovdmitry-shibanov approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@dariocurr@dmitry-shibanov@BrandonLWhite@zoj613

[8]ページ先頭

©2009-2025 Movatter.jp