Skip to content

Upgrade Python version from 3.9 to 3.10 across project #26

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

gitar-bot-staging[bot]
Copy link

Description

This PR upgrades the entire project from Python 3.9 to Python 3.10, modernizing the codebase to take advantage of Python 3.10's improvements and maintaining compatibility with current Python standards.

Changes Made

  • Package Requirements: Updated python_requires from ~=3.9 to ~=3.10 across all setup.py files
  • Docker Images: Migrated Docker base images from python:3.9 to python:3.10
  • CI/CD Configuration: Updated GitHub Actions workflows to use Python 3.10 and setup-python@v4
  • Code Modernization: Migrated deprecated Python features and modules to their modern equivalents:
    • Replaced asyncio.coroutine decorator with native async def syntax
    • Migrated distutils imports to setuptools equivalents
    • Updated threading.Thread deprecated name methods
    • Replaced imp module with importlib equivalents
    • Fixed numeric literals followed by keywords spacing
    • Updated traceback.format_exception parameter names

Motivation

  • Security: Python 3.10 includes important security improvements and requires OpenSSL 1.1.1+
  • Performance: Python 3.10 provides performance optimizations across various components
  • Developer Experience: Better error messages, structural pattern matching, and improved type system features
  • Future-Proofing: Ensures compatibility with modern Python ecosystem and prepares for future upgrades

Python 3.10 Key Features

Python 3.10 introduces several important improvements including structural pattern matching, union types with | operator, better error messages, and enhanced debugging capabilities. Official Python 3.10 Release Notes

Impact

  • Files Modified: 33 files across packages, services, CI/CD, and scripts
  • Backwards Compatibility: Breaking change - requires Python 3.10+ runtime
  • Dependencies: All Python dependencies remain compatible with Python 3.10

Link to run
Requested by: [email protected]

gitar-bot and others added 6 commits July 5, 2025 23:43
…ions in CI/CD configuration files (GitHub Actions, GitLab CI, etc.) from `3.9` to `3.10`.

Update GitHub Actions setup-python to v4: Update GitHub Actions `setup-python` action versions to v4 or later for proper Python 3.10 support.
…rom `python:3.9` to `python:3.10` in Dockerfiles and docker-compose files.
…in setup.py and pyproject.toml files to include Python 3.10 support (e.g., `>=3.8,<3.11` or `>=3.9`).
… import` and `from distutils import` statements with `from setuptools import` equivalents, migrating setup.py files from distutils to setuptools.

Migrate distutils Extension to setuptools: Replace `from distutils.extension import Extension` with `from setuptools import Extension` and update related extension building code.
Migrate distutils.command imports to setuptools: Replace `from distutils.command import` imports with setuptools equivalents or custom command implementations.
Update distutils.util function calls with alternatives: Update `distutils.util` function calls like `strtobool()` and `convert_path()` with equivalent implementations or alternative libraries.
Replace distutils.spawn with subprocess.run calls: Replace `distutils.spawn.spawn()` calls with `subprocess.run()` or equivalent process execution methods.
Migrate distutils.version to packaging.version classes: Replace `distutils.version` classes like `LooseVersion` and `StrictVersion` with `packaging.version` equivalents.
Migrate distutils.sysconfig to sysconfig module: Replace `distutils.sysconfig` imports and function calls with `sysconfig` module equivalents for system configuration queries.
…eter from asyncio high-level API functions including `create_task()`, `gather()`, `shield()`, `wait_for()`, `wait()`, `as_completed()`, and `run_coroutine_threadsafe()`.
…ls immediately followed by keywords by adding whitespace between the number and keyword (e.g., `0in` becomes `0 in`).

Update traceback.format_exception parameter name etype to exc: Replace `traceback.format_exception(etype, value, tb)` parameter name `etype` with `exc` in traceback module function calls.
Migrate formatter imports to string formatting: Replace `import formatter` and `from formatter import` statements by migrating to string formatting methods or removing formatter module usage entirely.
Update threading.Thread deprecated name methods: Replace deprecated `threading.Thread.setName()` and `threading.Thread.getName()` with `threading.Thread.name` property access.
Migrate ssl.match_hostname() to ssl context verification: Replace deprecated `ssl.match_hostname()` function calls with equivalent hostname verification using ssl context or urllib3.
Replace importlib.abc.Loader.load_module with exec_module: Replace `importlib.abc.Loader.load_module()` calls with `importlib.abc.Loader.exec_module()` method implementations.
Update importlib module loading patterns: Replace deprecated `importlib.util.module_for_loader` decorator with updated importlib patterns for module loading.
Replace `imp` module with `importlib` equivalents: Replace deprecated `imp` module imports with `importlib` equivalents for dynamic module importing and loading.
Replace asyncio.coroutine with async def syntax: Replace `asyncio.coroutine` decorator with native `async def` function definitions for coroutine creation.

Co-authored-by: [email protected] <[email protected]>
@gitar-bot-staging
Copy link
Author

✅ Gitar will automatically:

  • Address comments that start with 'Gitar'.
  • Look at CI failures and help fix them

⚙️ Options:

  • Disable automatic comment and CI monitoring

🐛 (Staging) Report a Bug

If you notice any bugs or poor interactions with the bot, click these links to report them:

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