Skip to content
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

Drop Python 3.9 support #709

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Aug 22, 2024

Summary

  • Drop Python 3.9 support
  • Bump codecov action to v4

Copy link

coderabbitai bot commented Aug 22, 2024

Caution

Review failed

The head commit changed during the review from 0ce6045 to 7f261d8.

Walkthrough

The changes include updates to Python version requirements across multiple configuration files, enhancements to the GitHub Actions workflow, and formatting improvements in various test files. The workflow's Python version matrix was updated to support Python 3.10, and the Codecov action was upgraded from version 3 to version 4. Additionally, the minimum Python version in pyproject.toml was raised to 3.10, and the optional dependencies were consolidated. Variable names in test files were refactored for consistency, while no functional changes were made to the tests.

Changes

Files Change Summary
.github/workflows/test.yml Updated python-version matrix to include 3.10 and upgraded Codecov action from v3 to v4.
pyproject.toml Updated minimum Python version from >=3.9 to >=3.10, consolidated optional dependencies, and changed Black target version to py310.
tests/test_json.py Renamed variable TESTS_VERSION to tests_version; no changes to test logic or structure.

Possibly related PRs

  • Declare required and optional dependency #714: The changes in the pyproject.toml file regarding the addition of ruamel.yaml and numpy as required dependencies are directly related to the updates in the main PR, which also involves changes to the Python version requirements and dependencies.

🐇 In the meadow, we hop with glee,
Python's new version brings harmony!
With tests all polished, clear as a bell,
Our code is ready, all's well, all's well!
Dependencies updated, workflows refined,
Leap into coding, leave worries behind! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Aug 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.51%. Comparing base (1798d59) to head (7f261d8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #709      +/-   ##
==========================================
- Coverage   82.57%   82.51%   -0.07%     
==========================================
  Files          27       27              
  Lines        1584     1584              
  Branches      284      284              
==========================================
- Hits         1308     1307       -1     
- Misses        215      216       +1     
  Partials       61       61              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DanielYang59 DanielYang59 marked this pull request as ready for review August 22, 2024 14:49
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1270c7b and 54697de.

Files selected for processing (15)
  • .github/workflows/test.yml (2 hunks)
  • README.md (1 hunks)
  • pylintrc (1 hunks)
  • pyproject.toml (5 hunks)
  • tasks.py (1 hunks)
  • tests/test_collections.py (1 hunks)
  • tests/test_design_patterns.py (1 hunks)
  • tests/test_dev.py (1 hunks)
  • tests/test_fractions.py (1 hunks)
  • tests/test_functools.py (1 hunks)
  • tests/test_io.py (1 hunks)
  • tests/test_json.py (1 hunks)
  • tests/test_os.py (1 hunks)
  • tests/test_shutil.py (9 hunks)
  • tests/test_tempfile.py (1 hunks)
Files skipped from review due to trivial changes (13)
  • README.md
  • pylintrc
  • tasks.py
  • tests/test_collections.py
  • tests/test_design_patterns.py
  • tests/test_dev.py
  • tests/test_fractions.py
  • tests/test_functools.py
  • tests/test_io.py
  • tests/test_json.py
  • tests/test_os.py
  • tests/test_shutil.py
  • tests/test_tempfile.py
Additional comments not posted (7)
.github/workflows/test.yml (3)

8-8: Approved: fail-fast strategy set to false.

This change allows all jobs to run to completion, providing a complete picture of all test failures.


12-12: Approved: Updated Python version matrix.

The inclusion of Python 3.10 and removal of 3.9 aligns with the objective to drop Python 3.9 support.


33-33: Approved: Codecov action updated to v4.

Ensure to verify any changes in behavior or new features introduced by the new version.

pyproject.toml (4)

12-12: Approved: Updated minimum Python version to 3.10.

This change aligns with the objective to drop support for Python 3.9.


30-30: Approved: Simplified numpy version constraint.

The constraint numpy<2 ensures compatibility with versions below 2.0 while simplifying the versioning.


37-37: Approved: Added pydantic as a dependency.

This addition suggests enhanced data validation or settings management capabilities.


54-54: Approved: Updated black target version to py310.

This change aligns the formatting tools with the updated Python version requirement.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
.github/workflows/test.yml (2)

12-12: LGTM! Consider adding Python 3.11 to the test matrix.

The update to drop Python 3.9 support and use 3.10 as the minimum version is consistent with the PR objectives and other file updates. It's good to test against both the minimum (3.10) and latest (3.12) supported versions.

Consider adding Python 3.11 to the test matrix as well. This would provide better coverage across supported Python versions:

-        python-version: ["3.10", "3.12"]
+        python-version: ["3.10", "3.11", "3.12"]

Line range hint 1-35: Consider adding dependency caching to improve workflow efficiency.

While the current workflow configuration is good, you could further optimize it by implementing dependency caching. This can significantly reduce the time it takes to install dependencies, especially for larger projects.

Here's a suggestion to add caching:

    steps:
      - uses: actions/checkout@v4

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Cache pip packages
        uses: actions/cache@v3
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -e '.[ci]'

This change would cache the pip packages based on the contents of your requirements file, potentially speeding up subsequent runs.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 54697de and f2ca6a7.

📒 Files selected for processing (3)
  • .github/workflows/test.yml (2 hunks)
  • pyproject.toml (4 hunks)
  • tests/test_json.py (1 hunks)
🧰 Additional context used
🪛 Ruff
tests/test_json.py

50-50: Redefinition of unused pytest from line 12

Remove definition: pytest

(F811)


53-53: Redefinition of unused MontyDecoder from line 15

Remove definition: MontyDecoder

(F811)


54-54: Redefinition of unused MontyEncoder from line 16

Remove definition: MontyEncoder

(F811)


55-55: Redefinition of unused MSONable from line 17

Remove definition: MSONable

(F811)


56-56: Redefinition of unused _load_redirect from line 18

Remove definition: _load_redirect

(F811)


57-57: Redefinition of unused jsanitize from line 19

Remove definition: jsanitize

(F811)


58-58: Redefinition of unused load from line 20

Remove definition: load

(F811)


61-61: .__version__ imported but unused

Remove unused import: .__version__

(F401)

🔇 Additional comments (5)
.github/workflows/test.yml (1)

33-33: LGTM! Codecov action updated to v4.

The update of the Codecov action to version 4 is in line with the PR objectives and follows good practices of keeping GitHub Actions up to date.

pyproject.toml (4)

12-12: LGTM: Python version requirement updated correctly.

The change from >=3.9 to >=3.10 aligns with the PR objective of dropping Python 3.9 support and is consistent with the changes made in the GitHub Actions workflow configuration.


70-70: LGTM: Black configuration updated correctly.

The update of target-version from ['py39'] to ["py310"] in the Black configuration aligns with the new Python version requirement. This ensures that Black uses the appropriate Python version for formatting.


110-117: LGTM: Ruff configuration restructured correctly.

The Ruff configuration has been appropriately restructured:

  1. The [tool.ruff.lint] section with the select field has been added.
  2. The [tool.ruff.lint.isort] section now contains the required-imports and known-first-party fields.

This restructuring improves clarity and follows best practices for Ruff configuration while preserving the previous settings.


Line range hint 1-117: Overall changes look good, with a few points to address.

The pyproject.toml file has been successfully updated to reflect the new Python version requirement and improve project configuration. However, there are two main points that need attention:

  1. The NumPy version constraint (numpy<2) contradicts the PR objective of supporting NumPy 2.x. This needs to be adjusted.
  2. The addition of torch as an optional dependency, given the mentioned compatibility issues with NumPy on Windows, requires further investigation.

Please address these points to ensure the configuration aligns fully with the PR objectives and doesn't introduce new complications.

To investigate the PyTorch and NumPy compatibility issue on Windows, run the following script:

#!/bin/bash
# Description: Check for PyTorch and NumPy usage and potential compatibility issues

echo "PyTorch imports in the project:"
rg 'import.*torch'

echo "\nNumPy imports in the project:"
rg 'import.*numpy'

echo "\nFiles containing both PyTorch and NumPy imports:"
rg -l 'import.*torch' | xargs rg -l 'import.*numpy'

echo "\nPotential compatibility checks or warnings:"
rg -i 'compatibility|warning|numpy.*torch|torch.*numpy'

This script will help identify areas where PyTorch and NumPy are used together, potentially highlighting locations where compatibility issues might arise.

pyproject.toml Outdated Show resolved Hide resolved
@@ -85,26 +84,24 @@ branch = true
exclude_also = [
"@deprecated",
"def __repr__",
"if 0:",
"if __name__ == .__main__.:",
Copy link
Contributor Author

@DanielYang59 DanielYang59 Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find any of these across the code base, so assume safe to remove

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