Skip to content

Conversation

@cclauss
Copy link
Contributor

@cclauss cclauss commented Aug 25, 2023

Ensure GitHub Actions are testing on the same version of Python as production.

      - uses: actions/setup-python@v4
        with:
          python-version-file: pyproject.toml

Arrgghh...

Run actions/setup-python@v4
  with:
    python-version-file: pyproject.toml
    check-latest: false
    token: ***
    update-environment: true
    allow-prereleases: false
Extracted ~=3.11.1 from pyproject.toml
Installed versions
  Successfully set up CPython (3.11.4)

@dariocurr I would like to leverage actions/setup-python#669 to set project.requires-python in pyproject.toml to exactly match 3.11.1 so that our GitHub Actions are testing on the same version of Python as production.

pyproject.toml seems to only be able to parse project.requires-python = "~=3.11.1" (see commits) which given the ~, allows the GitHub Action to upgrade to 3.11.4. Is there any way to force the Action to use 3.11.1?

@cclauss cclauss changed the title pyproject.toml: [project] requires-python = 3.11.1 pyproject.toml: project.requires-python = "~=3.11.1" Aug 25, 2023
@dariocurr
Copy link

I guess: project.requires-python = ">=3.11.1,<3.11.2" should do the trick

@cclauss cclauss changed the title pyproject.toml: project.requires-python = "~=3.11.1" pyproject.toml: project.requires-python = ">=3.11.1,<3.11.2" Aug 25, 2023
@cclauss cclauss requested review from cdrini and scottbarnes August 25, 2023 10:55
Copy link
Collaborator

@scottbarnes scottbarnes left a comment

Choose a reason for hiding this comment

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

I see this forces GitHub actions to use Python 3.11.1. Looks good to me!

@cclauss cclauss merged commit 64ca53e into master Aug 25, 2023
@cclauss cclauss deleted the pyproject.toml-project.requires-python branch August 25, 2023 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants