Skip to content

Add Python 3.7+ compatibility #100

Description

@proboscis

---\nMigrated from CyberAgentAILab/pinjected#55\nOriginally created by @app/devin-ai-integration on null\n\n---\n\n## Overview
Currently, pinjected requires Python 3.10+ due to the use of match-case syntax and ExceptionGroup handling.

Required Changes

To support Python 3.7+, the following changes are needed:

  1. Replace match-case syntax with if-elif chains

  2. Add compatibility layer for ExceptionGroup in Python versions < 3.11

  3. Update dependency constraints for Python version compatibility:

    • pandas: 1.3.5+ for Python 3.7.1+, 2.2.3+ for Python 3.9+
    • aiosqlite: 0.17.0+ for Python 3.7+, 0.21.0+ for Python 3.9+
    • filelock: 3.0.0+ for Python 3.7+, 3.16.1+ for Python 3.8+
    • pytest: 7.0.0+ for Python 3.7+, 8.1.1+ for Python 3.8+
    • pytest-xdist: 2.5.0+ for Python 3.7+, 3.6.1+ for Python 3.8+
    • json-repair: 0.30.0+ for Python 3.7+, 0.35.0+ for Python 3.9+
    • openai: 0.28.0+ for Python 3.7+, 1.61.0+ for Python 3.8+
    • tiktoken: Optional for Python 3.7+, required for Python 3.8+
    • anthropic: Optional for Python 3.7+, required for Python 3.8+
    • httpx: 0.23.0+ for Python 3.7+, 0.28.1+ for Python 3.8+
    • tenacity: 8.0.0+ for Python 3.7+, 9.0.0+ for Python 3.8+
  4. Add compatibility layers for optional dependencies:

    • tiktoken_compat.py for token counting
    • json_repair compatibility in openai_support
    • anthropic client compatibility

Testing

  • Add tests for compatibility layers
  • Verify functionality across Python 3.7.1+, 3.8+, 3.9+, 3.10+

Documentation

  • Update README.md to reflect new Python version requirements
  • Update badges to show Python 3.7+ support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions