Skip to content

python version strategy

github-actions[bot] edited this page Jun 27, 2025 · 1 revision

Python Version Compatibility Strategy

Current Status Analysis

Supported Python Ecosystem (June 2025)

  • Python 3.10: Released Oct 2021, Active support until Oct 2026
  • Python 3.11: Released Oct 2022, Active support until Oct 2027
  • Python 3.12: Released Oct 2023, Active support until Oct 2028
  • Python 3.13: Released Oct 2024, Active support until Oct 2029

Recommended Strategy: 3.10+ with Strategic Testing

1. Version Support Policy

Primary Support (Full Testing)

  • Python 3.10 - Minimum version, guaranteed compatibility
  • Python 3.12 - Recommended version for performance

Secondary Support (Compatibility Testing)

  • Python 3.11 - Should work but not primary focus
  • Python 3.13 - Future-proofing, test when stable

Rationale

  • 3.10+ covers 95%+ of active Python installations in scientific computing
  • Skip 3.9 - End of life Oct 2025, security updates only
  • Focus resources on versions that matter most to users

2. Multi-Version CI/CD Strategy

GitHub Actions Matrix Testing

strategy:
  matrix:
    python-version: ["3.10", "3.12"]
    os: [ubuntu-latest, windows-latest, macos-latest]
  fail-fast: false

Testing Tiers

  1. Core Tests (All versions): Import, basic functionality
  2. Integration Tests (Primary versions): Full API testing
  3. Performance Tests (Latest version): Benchmarking

3. Dependency Compatibility Matrix

Critical Dependencies

  • requests: Supports 3.7+ (✅ Compatible)
  • backoff: Supports 3.6+ (✅ Compatible)
  • defusedxml: Supports 3.6+ (✅ Compatible)
  • typing-extensions: Supports 3.7+ (✅ Compatible)

Development Dependencies

  • pytest: Supports 3.8+ (✅ Compatible)
  • mypy: Supports 3.8+ (✅ Compatible)
  • ruff: Supports 3.7+ (✅ Compatible)

4. Testing Strategy

Automated Testing Levels

Level 1: Syntax & Import Testing

  • Verify code parses on all supported versions
  • Test all imports succeed
  • Check basic instantiation

Level 2: Unit Testing

  • Run full test suite on primary versions (3.10, 3.12)
  • Focus on core functionality
  • Test edge cases and error handling

Level 3: Integration Testing

  • Test against real Europe PMC API
  • Verify network operations
  • Test large data handling

Level 4: Performance Testing

  • Benchmark on latest Python version
  • Memory usage analysis
  • Regression testing

5. Version-Specific Considerations

Python 3.10 (Minimum)

  • Benefits: Stable, widely adopted, pattern matching
  • Focus: Ensure all features work reliably
  • Testing: Full test suite, all features

Python 3.12 (Recommended)

  • Benefits: 15% performance improvement, better error messages
  • Focus: Performance validation, future features
  • Testing: Full suite + performance benchmarks

Python 3.13+ (Future)

  • Benefits: Free-threaded Python (experimental), improved REPL
  • Focus: Compatibility testing, no feature development yet
  • Testing: Basic compatibility only

6. Implementation Roadmap

Phase 1: Foundation (Current)

  • Update pyproject.toml to support 3.10+
  • Create comprehensive CI/CD matrix
  • Add version-specific testing

Phase 2: Professional Testing

  • Implement multi-version GitHub Actions
  • Add compatibility testing framework
  • Create version support documentation

Phase 3: Advanced Features

  • Performance benchmarking across versions
  • Automated compatibility reporting
  • Version-specific optimizations

7. Quality Gates

Required for Release

  • ✅ All tests pass on Python 3.10
  • ✅ All tests pass on Python 3.12
  • ✅ Import tests pass on all supported versions
  • ✅ No deprecation warnings on any version

Recommended for Release

  • ✅ Performance benchmarks within 5% on 3.12 vs 3.10
  • ✅ Memory usage stable across versions
  • ✅ Full integration tests pass

8. User Communication

Documentation Strategy

  • Clearly state minimum version (3.10+)
  • Recommend Python 3.12 for best performance
  • Provide migration guide for users on older versions
  • Document version-specific benefits

Support Policy

  • Full Support: Python 3.10
  • Best Effort: Python 3.11, 3.12, 3.13
  • No Support: Python 3.9 and below

This strategy balances thorough testing with practical resource allocation.

Clone this wiki locally