Skip to content

Upgrade Python runtime to 3.12 - #554

Merged
jrhoads merged 2 commits into
devfrom
upgrade-python312
Sep 17, 2026
Merged

jrhoads merged 2 commits into
devfrom
upgrade-python312

Conversation

@jrhoads

@jrhoads jrhoads commented Sep 17, 2026

Copy link
Copy Markdown
Member

Purpose

The purpose of this pull request is to upgrade the Python runtime environment from Python 3.10 to Python 3.12 across the project's Docker image, Passenger configuration, CI workflow, and dependencies. Additionally, this PR updates test suites to address deprecations in modern Python versions.

Approach

  • Updated the Docker base image to phusion/passenger-python312:3.2.0 and adjusted Passenger and build configurations to use Python 3.12.
  • Updated the GitHub Actions test workflow to run using Python 3.12.
  • Bumped pandas (to 2.2.3) and numpy (to 1.26.4) in requirements.txt to support Python 3.12.
  • Replaced deprecated assertEquals calls with assertEqual across integration and unit test files (since assertEquals was removed in Python 3.12).
  • Converted regex strings containing escape characters to raw strings (r'...') to eliminate Python 3.12 syntax/deprecation warnings.

Key Modifications

  • Docker & Server Configuration:
    • Dockerfile: Upgraded base image from phusion/passenger-python310:3.2.0 to phusion/passenger-python312:3.2.0 and updated documentation/comments.
    • vendor/docker/webapp.conf: Set passenger_python to /usr/bin/python3.12.
  • CI/CD Workflow:
    • .github/workflows/run_tests.yml: Set python-version to "3.12".
  • Dependencies:
    • requirements.txt: Updated pandas (1.4.1 -> 2.2.3) and numpy (1.22.4 -> 1.26.4).
  • Tests:
    • rorapi/tests/tests_integration/tests.py: Replaced assertEquals with assertEqual.
    • rorapi/tests/tests_integration/tests_search_v2.py: Replaced assertEquals with assertEqual.
    • rorapi/tests/tests_integration/tests_v2.py: Replaced assertEquals with assertEqual.
    • rorapi/tests/tests_unit/tests_matching_v2.py: Replaced assertEquals with assertEqual.
    • rorapi/tests/tests_unit/tests_queries_v2.py: Replaced assertEquals with assertEqual and prefixed escaped strings with r.
    • rorapi/tests/tests_unit/tests_views_v2.py: Replaced assertEquals with assertEqual.

Important Technical Details

  • Python 3.12 officially removes the long-deprecated TestCase.assertEquals alias in unittest, requiring all assertions to use TestCase.assertEqual.
  • Invalid escape sequences now raise SyntaxWarning (and in future versions SyntaxError) in Python 3.12, necessitating raw string literals (r'...') in regular expressions within tests_queries_v2.py.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

@jrhoads
jrhoads merged commit 3560e02 into dev Sep 17, 2026
2 checks passed
@jrhoads
jrhoads deleted the upgrade-python312 branch September 17, 2026 14:33
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.

1 participant