Skip to content

Conversation

Copy link

Copilot AI commented Nov 9, 2025

Summary of Changes

Fixes Python 3.8 and 3.9 compatibility by replacing PEP 604 type hint syntax (introduced in Python 3.10) with typing module equivalents.

Type hint changes:

  • list[T]List[T]
  • tuple[T, ...]Tuple[T, ...]
  • X | YUnion[X, Y] or Optional[Y]

Files modified:

  • pymars/_forward.py
  • pymars/_pruning.py
  • pymars/_record.py
  • pymars/earth.py

CI workflow updates:

  • Pinned actions/checkout@v4 and actions/setup-python@v4 for stability
  • Updated all workflow files

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing

  • Ran existing tests to ensure no regressions
  • Manual testing performed

All 107 tests pass locally on Python 3.12. CI will verify Python 3.8, 3.9, 3.10, 3.11, and 3.12.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Related Issues

Relates to #114

Additional Context

No importlib.metadata compatibility shim needed—not used in codebase. No dict union operator (|) in runtime code.

Original prompt

Create a branch, apply minimal compatibility fixes so the test suite and CI succeed on Python 3.8 and 3.9, and open a PR.

Summary of actions to perform:

  1. Create a new branch (name: fix/py38-39-ci-tests).
  2. Add a compatibility shim module at mars/_compat.py that provides importlib_metadata fallback.
    • Contents:
      try:
      import importlib.metadata as importlib_metadata
      except Exception:
      import importlib_metadata
      all = ("importlib_metadata",)
  3. Search the repository for occurrences of importlib.metadata and replace them to import from mars._compat import importlib_metadata, or update files to use the shim (only if import is in runtime code). Use minimal diffs.
  4. Search for dict union operator usage (a | b) and replace with {**a, **b} or a.copy(); a.update(b) where necessary for 3.8 compatibility.
  5. Add/Update .github/workflows/ci.yml to pin actions and ensure Python matrix includes 3.8 and 3.9. Use actions/checkout@v4 and actions/setup-python@v4, and install importlib-metadata for python<3.8 if needed.
  6. Run repository tests across the CI matrix and iterate until tests pass.
  7. Commit changes, push to the new branch, and open a pull request titled "Fix tests and CI for Python 3.8/3.9 compatibility" with description listing changes and referencing PR Fix Python 3.8/3.9 compatibility and action failures #114.

Acceptance criteria:

  • Tests pass on Python 3.8, 3.9, and 3.10 in CI.
  • PR created and linked to repository edithatogo/mars.

Notes:

  • Keep changes minimal; add pytest.skipif for tests that legitimately require newer Python behavior.
  • If encountering ambiguity or needed maintainer input, include TODO comments and explain in the PR description.

Please proceed to create the branch, apply changes, run CI, and open the PR. If any step fails or requires clarification, record details in the PR description and return logs in the PR.

This pull request was created as a result of the following prompt from Copilot chat.

Create a branch, apply minimal compatibility fixes so the test suite and CI succeed on Python 3.8 and 3.9, and open a PR.

Summary of actions to perform:

  1. Create a new branch (name: fix/py38-39-ci-tests).
  2. Add a compatibility shim module at mars/_compat.py that provides importlib_metadata fallback.
    • Contents:
      try:
      import importlib.metadata as importlib_metadata
      except Exception:
      import importlib_metadata
      all = ("importlib_metadata",)
  3. Search the repository for occurrences of importlib.metadata and replace them to import from mars._compat import importlib_metadata, or update files to use the shim (only if import is in runtime code). Use minimal diffs.
  4. Search for dict union operator usage (a | b) and replace with {**a, **b} or a.copy(); a.update(b) where necessary for 3.8 compatibility.
  5. Add/Update .github/workflows/ci.yml to pin actions and ensure Python matrix includes 3.8 and 3.9. Use actions/checkout@v4 and actions/setup-python@v4, and install importlib-metadata for python<3.8 if needed.
  6. Run repository tests across the CI matrix and iterate until tests pass.
  7. Commit changes, push to the new branch, and open a pull request titled "Fix tests and CI for Python 3.8/3.9 compatibility" with description listing changes and referencing PR Fix Python 3.8/3.9 compatibility and action failures #114.

Acceptance criteria:

  • Tests pass on Python 3.8, 3.9, and 3.10 in CI.
  • PR created and linked to repository edithatogo/mars.

Notes:

  • Keep changes minimal; add pytest.skipif for tests that legitimately require newer Python behavior.
  • If encountering ambiguity or needed maintainer input, include TODO comments and explain in the PR description.

Please proceed to create the branch, apply changes, run CI, and open the PR. If any step fails or requires clarification, record details in the PR description and return logs in the PR.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link

coderabbitai bot commented Nov 9, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits November 9, 2025 07:01
Copilot AI changed the title [WIP] Add compatibility fixes for Python 3.8 and 3.9 CI tests Fix Python 3.8/3.9 compatibility: replace PEP 604 type hints Nov 9, 2025
Copilot AI requested a review from edithatogo November 9, 2025 07:11
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.

2 participants