fix: update Python version to 3.11 and use latest setup-python action in workflows#317
fix: update Python version to 3.11 and use latest setup-python action in workflows#317ttak-apphelix wants to merge 12 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates CI workflows to run tests under Python 3.10 and modernizes the setup-python GitHub Action used to provision Python in those workflows.
Changes:
- Bump workflow matrix Python version from 3.9 to 3.10.
- Upgrade
actions/setup-pythonfromv1tov5in affected workflows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/syntax-test.yml | Moves Syntax Test workflow to Python 3.10 and updates setup-python action. |
| .github/workflows/playbook-test.yml | Moves Playbook Test workflow to Python 3.10 and updates setup-python action. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| max-parallel: 4 | ||
| matrix: | ||
| python-version: [3.9] | ||
| python-version: ['3.11'] |
There was a problem hiding this comment.
Should this be 3.12? (To match requirements file.)
There was a problem hiding this comment.
Yes, plan is to update this to 3.12. But current challenge is Ansible 9+ removed support for deprecated include syntax used in playbooks and lower version(ansible<9.0.0) is not supported on 3.12.
Plan is to create a separate PR which will require a SRE support where they can validate all the changes and update this to 3.12 with updated Ansible version.
There was a problem hiding this comment.
Makes sense, thanks! (Might be good to include this in the PR description, and the commit message when you squash.)
There was a problem hiding this comment.
- As discussed in meeting, renaming the file to
requirements3_11.txt(assuming we even need multiple requirements files), would help avoid some confusion. - We should update comments appropriately about the relationship between python and ansible versions, and deferring the ansible upgrade. We may want a new ticket to link to, but I think https://2u-internal.atlassian.net/browse/GSRE-2249?focusedCommentId=5530695 might be the closest one to this topic at this time, except it is focused on the ubuntu upgrade.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # pip 26 is incompatible with pip-tools hence causing failures during the build process | ||
| # Make upgrade command and all requirements upgrade jobs are broken due to this. | ||
| # The constraint can be removed once a release (pip-tools > 7.5.2) is available with support for pip 26 | ||
| # Issue to track this dependency and unpin later on: https://github.com/jazzband/pip-tools/issues/2319 | ||
| pip<26.0 |
| # using LTS django version | ||
| Django<5.0 | ||
| Django<6.0 |
robrap
left a comment
There was a problem hiding this comment.
Looks good. Minor comment update request.
@timmc-edx: Any concerns?
| # Ansible 9+ supports Python 3.11+ but removed the deprecated 'include' syntax causing playbook failures | ||
| # Ansible 8.7.0 is the latest version that supports both Python 3.11 AND the deprecated 'include' syntax | ||
| # The constraint can be removed once all 63 instances of 'include' are migrated to 'include_tasks' or 'import_tasks' | ||
| # Tracking: Configuration playbooks need migration before upgrading to Ansible 9+ |
There was a problem hiding this comment.
There should already be a ticket for this. We should link to it. Also, we should not in the ticket (if not already noted) that cleaning up edxapp ansible usage before upgrade should simplify it.
| # pip 26 is incompatible with pip-tools hence causing failures during the build process | ||
| # Make upgrade command and all requirements upgrade jobs are broken due to this. | ||
| # The constraint can be removed once a release (pip-tools > 7.5.2) is available with support for pip 26 | ||
| # Issue to track this dependency and unpin later on: https://github.com/jazzband/pip-tools/issues/2319 |
There was a problem hiding this comment.
Hmm... looks like that issue has closed. Can we use newer pip now? (But I'm fine with merging as is. It's not like we need a newer pip or pip-tools for this repo anyhow.)
|
No concerns. I did note one thing that we might be able to unpin, but it's not worth blocking this PR further. |
Description
Fixes GitHub Actions workflow failures caused by Python 3.9 being removed from hosted runners (EOL October 2025).
Changes
Workflows
3.9to'3.11'(quoted to prevent YAML float parsing)actions/setup-pythonfrom v1 to v52. Consolidated Requirements Structure (Reverting PR #175)
This PR reverts the approach taken in PR #175, which introduced separate
base3_12.infiles. Instead, we:requirements/base.into use Python 3.11+ compatible dependenciesrequirements/base3_12.inrequirements3_12.txtrequirements.txtMakefileto remove Python version-specific compilation stepsDependencies
requirements/base.inand generatedrequirements.txtwith Ansible 8.7.0includesyntax used in playbooksansible<9.0.0constraint torequirements/constraints.txtto prevent future upgradesFuture Migration to Python 3.12
Yes, the plan is to update to Python 3.12 in the future. However, the current challenge is that Ansible 9+ (which supports Python 3.12) removed support for the deprecated
includesyntax used throughout the playbooks, and Ansible versions < 9.0.0 are not supported on Python 3.12.The plan is to create a separate PR that will require SRE support to validate all the changes and update to Python 3.12 with an updated Ansible version. This will involve:
- include:syntax toinclude_tasks:orimport_tasks:ansible<9.0.0constraint fromrequirements/constraints.txtJIRA ticket
https://2u-internal.atlassian.net/browse/BOMS-408