Skip to content

Upgrade Python from 3.8 to 3.13#2

Open
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1753401292-upgrade-python-3.8-to-3.13
Open

Upgrade Python from 3.8 to 3.13#2
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1753401292-upgrade-python-3.8-to-3.13

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Upgrade Python from 3.8 to 3.13

Summary

This PR upgrades the OpenOA project from Python 3.8 to Python 3.13, following the provided playbook. The upgrade includes updating all configuration files, CI workflows, documentation, and fixing compatibility issues with newer versions of pandas/numpy.

Key Changes:

  • Updated pyproject.toml to require Python >=3.13,<3.14
  • Updated CI workflows (.github/workflows/) to use Python 3.13
  • Updated pre-commit hooks to use --py313-plus
  • Updated all documentation references from Python 3.8 to 3.13
  • Removed restrictive version constraints in requirements-py38.txt for Python 3.13 compatibility
  • Fixed np.Inf deprecation (replaced with np.inf) in tests
  • Fixed unresponsive_flag function compatibility with Python 3.13/pandas behavior changes
  • Added .python-version file for pyenv

Review & Testing Checklist for Human

  • End-to-end installation test: Create a fresh Python 3.13 environment, install OpenOA, and verify core functionality works
  • Dependency compatibility review: Check that all dependencies in requirements-py38.txt work correctly with Python 3.13 in production scenarios
  • CI pipeline verification: Ensure all CI checks pass and the deployment process works correctly with Python 3.13
  • Code fix validation: Test the unresponsive_flag function fix with real data to ensure it behaves correctly
  • Search for missed references: Double-check for any hardcoded Python version references in deployment scripts, Docker files, or infrastructure code

Recommended Test Plan:

  1. Install in fresh conda/venv environment with Python 3.13
  2. Run full test suite (unit + regression tests)
  3. Test actual wind plant analysis workflows
  4. Verify documentation builds correctly

Diagram

%%{ init : { "theme" : "default" }}%%
graph TB
    subgraph "Configuration Files"
        A["pyproject.toml"]:::major-edit
        B[".python-version"]:::major-edit
        C["requirements-py38.txt"]:::major-edit
        D[".pre-commit-config.yaml"]:::major-edit
    end
    
    subgraph "CI/CD"
        E[".github/workflows/ci-tests.yml"]:::major-edit
        F[".github/workflows/pypi-publish.yml"]:::major-edit
        G[".readthedocs.yaml"]:::major-edit
        H["runtime.txt"]:::major-edit
    end
    
    subgraph "Code Changes"
        I["openoa/utils/filters.py"]:::major-edit
        J["test/unit/test_timeseries_toolkit.py"]:::minor-edit
    end
    
    subgraph "Documentation"
        K["README.md"]:::minor-edit
        L["sphinx/index.md"]:::minor-edit
    end
    
    A --> E
    A --> F
    C --> I
    I --> J
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit
        L3[Context/No Edit]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

Critical Fix Details:

  • The unresponsive_flag function in openoa/utils/filters.py required a compatibility fix because np.any() behavior changed with Python 3.13/newer pandas versions. The fix replaces the problematic np.any() operation with manual OR operations across shifted flags.

Dependency Updates:

  • Removed restrictive version constraints (e.g., pandas<2.0, numpy<1.25) from requirements-py38.txt to allow Python 3.13 compatible versions
  • All dependencies were successfully installed and unit tests pass, but production testing is recommended

Session Info:

- Update pyproject.toml to require Python >=3.13,<3.14
- Update CI workflows to use Python 3.13
- Update pre-commit hooks to use --py313-plus
- Update documentation to reference Python 3.13
- Update dependency constraints in requirements-py38.txt for Python 3.13 compatibility
- Fix np.Inf deprecation in test_timeseries_toolkit.py (replaced with np.inf)
- Fix unresponsive_flag function compatibility with Python 3.13/pandas
- Add .python-version file for pyenv
- Update ReadTheDocs and runtime configurations

Co-Authored-By: Sam Fertig <sam.fertig@codeium.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

… wheels

Co-Authored-By: Sam Fertig <sam.fertig@codeium.com>
@sonarqubecloud

Copy link
Copy Markdown

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.

0 participants