Skip to content

Migrate Python Codebase from 3.9 to 3.10 #2

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

Conversation

gitar-bot-staging[bot]
Copy link

🔧 Standardize Python version and improve code quality across services

Description

This PR implements systematic code quality improvements and Python version standardization across all services in the osparc-simcore platform. The changes include downgrading Python from 3.11.9 to 3.10.14 for broader compatibility, fixing decimal precision issues, updating type annotations, and adding comprehensive testing infrastructure.

Motivation

  • Compatibility: Standardize on Python 3.10.14 to ensure broader environment compatibility and more stable deployment across different systems
  • Code Quality: Address precision issues with Decimal constructors and modernize type annotation usage
  • Testing Infrastructure: Introduce tox.ini for consistent testing across multiple Python versions and environments
  • Maintainability: Systematic cleanup following automated refactoring checkpoints to ensure consistency across the codebase

Impact

Services Updated

  • api-server, autoscaling, catalog, clusters-keeper, dask-sidecar
  • datcore-adapter, director-v2, director, dynamic-scheduler, dynamic-sidecar
  • efs-guardian, invitations, migration, notifications, payments
  • resource-usage-tracker, storage, web

Key Improvements

  • Enhanced Compatibility: Broader Python version support (>=3.10 vs ~=3.11)
  • Improved Precision: Fixed Decimal constructor usage for accurate financial calculations
  • Modern Type Annotations: Updated deprecated __args__ usage to get_args()
  • Better Testing: Added comprehensive tox configuration for multi-environment testing

Changes Made

📋 Detailed Changes

Python Version & Requirements

  • Dockerfiles: Updated PYTHON_VERSION from 3.11.93.10.14
  • setup.py: Changed python_requires from "~=3.11"">=3.10"

Code Quality Fixes

  • Decimal Constructors:
    # Before
    Decimal(20.0)
    
    # After  
    Decimal("20.0")
  • Type Annotations:
    # Before
    InstanceTypeType.__args__
    
    # After
    get_args(InstanceTypeType)

Testing Infrastructure

  • New File: Added comprehensive tox.ini configuration supporting:
    • Python 3.10 and 3.11 environments
    • Linting with ruff and pylint
    • Type checking with mypy
    • Code formatting validation
    • Coverage reporting
    • Security scanning

Test Plan

  • ✅ All existing tests pass with Python 3.10.14
  • ✅ Decimal precision fixes validated in financial calculation tests
  • ✅ Type annotation updates verified with mypy
  • ✅ Tox configuration tested across multiple environments

🎸 Generated with Jimy

pcrespov and others added 30 commits March 24, 2025 19:10
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Odei Maiz <33152403+odeimaiz@users.noreply.github.com>
Co-authored-by: Giancarlo Romeo <giancarloromeo@gmail.com>
Co-authored-by: Andrei Neagu <neagu@itis.swiss>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…g services (ITISFoundation#7454)

Co-authored-by: Andrei Neagu <neagu@itis.swiss>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
odeimaiz and others added 28 commits May 23, 2025 13:18
…ion#7741)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
)

Co-authored-by: Matus Drobuliak <60785969+matusdrobuliak66@users.noreply.github.com>
Co-authored-by: Andrei Neagu <neagu@itis.swiss>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…tion#7745)

Co-authored-by: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com>
Timestamp: 2025-06-02 17:38:27.338
Step ID: 2
Title: Rule 3
Timestamp: 2025-06-02 17:41:23.801
Step ID: 4
Title: Rule 5
Timestamp: 2025-06-02 17:44:14.722
Step ID: 5
Title: Rule 6
Timestamp: 2025-06-02 17:48:45.965
Step ID: 7
Title: Rule 8
Timestamp: 2025-06-02 17:56:25.523
Step ID: 8
Title: Rule 9
Timestamp: 2025-06-02 17:58:12.393
Step ID: 10
Title: Rule 11
Timestamp: 2025-06-02 18:04:03.559
Step ID: 13
Title: Rule 14
Timestamp: 2025-06-02 18:09:16.386
Step ID: 18
Title: Rule 19
Timestamp: 2025-06-02 18:12:54.245
Step ID: 19
Title: Rule 20
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.

9 participants