Skip to content

Upgrade Python from 3.9 to 3.10 and migrate deprecated APIs #24

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

gitar-bot-staging[bot]
Copy link

Upgrade Python version from 3.9 to 3.10 across the entire project

This PR comprehensively upgrades the project to Python 3.10, addressing all breaking changes and deprecations introduced in the new version.

Key Changes

  • 🔄 Migrate distutils to setuptools: Replace all deprecated distutils imports with setuptools equivalents and modern alternatives
  • 🔧 Update asyncio API calls: Remove deprecated loop parameters from high-level asyncio functions
  • 📝 Fix traceback parameter names: Update etype parameter to exc in traceback functions
  • 🐳 Update Docker base images: Upgrade from python:3.9 to python:3.10 in all Dockerfiles
  • 🔄 Update CI/CD workflows: Upgrade GitHub Actions workflows to use Python 3.10 and setup-python@v4
  • 📦 Update Python requirements: Update python_requires in setup.py files to support Python 3.10

Migration Details

🔗 distutils Migration
  • Replace from distutils.core importfrom setuptools import
  • Replace from distutils.extension import Extensionfrom setuptools import Extension
  • Replace distutils.util functions with equivalent implementations
  • Replace distutils.spawn.spawn()subprocess.run()
  • Replace distutils.version classes → packaging.version equivalents
  • Replace distutils.sysconfigsysconfig module
  • Remove deprecated formatter module usage
🔄 asyncio API Updates
  • Remove loop parameter from create_task(), gather(), shield(), wait_for(), wait(), as_completed(), and run_coroutine_threadsafe()
  • These functions now implicitly use the current thread's running event loop
📝 traceback API Updates
  • Update traceback.format_exception(etype, value, tb)traceback.format_exception(exc, value, tb)

Why This Upgrade?

Python 3.10 brings significant improvements and deprecates several modules that will be removed in Python 3.12. This upgrade ensures:

  • Future compatibility: Prepares the codebase for Python 3.12 when distutils is completely removed
  • Modern APIs: Uses current best practices for package management and async programming
  • Enhanced features: Takes advantage of Python 3.10's improved error handling and performance optimizations

Files Changed

  • 🔧 45 files updated across packages and services
  • 📦 13 setup.py files migrated from distutils to setuptools
  • 🐳 13 Dockerfiles updated to Python 3.10 base images
  • 🔄 3 CI/CD workflow files updated with Python 3.10 and modern actions

Related: Python 3.10 Release Notes | PEP 632 - distutils Deprecation


Link to run
Requested by: [email protected]

gitar-bot added 5 commits July 5, 2025 19:49
…eter from asyncio high-level API functions including `create_task()`, `gather()`, `shield()`, `wait_for()`, `wait()`, `as_completed()`, and `run_coroutine_threadsafe()`.
…e `traceback.format_exception(etype, value, tb)` parameter name `etype` with `exc` in traceback module function calls.
…tter` and `from formatter import` statements by migrating to string formatting methods or removing formatter module usage entirely.

Migrate distutils imports to setuptools: Replace `from distutils.core 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.
Update CI/CD Python version to 3.10: Update Python version specifications in CI/CD configuration files (GitHub Actions, GitLab CI, etc.) from `3.9` to `3.10`.
Update Docker Python base images to 3.10: Update Docker base images from `python:3.9` to `python:3.10` in Dockerfiles and docker-compose files.
Update Python Requirements to Support 3.10: Update `python_requires` in setup.py and pyproject.toml files to include Python 3.10 support (e.g., `>=3.8,<3.11` or `>=3.9`).
Update GitHub Actions setup-python to v4: Update GitHub Actions `setup-python` action versions to v4 or later for proper Python 3.10 support.

Co-Authored-By: [email protected]
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