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 17 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
  • Turn off fail-fast in CI test strategy
  • Make global variable all capital in unit test

For a follow up PR: remove numpy < 2 pin

  • Currently torch (latest 2.4.0) doesn't work well with numpy for some reason on windows (looks like some module doesn't support NP2 yet, need to figure out which):
============================================================================= warnings summary ==============================================================================
venv\Lib\site-packages\torch\_subclasses\functional_tensor.py:258
  D:\monty\venv\Lib\site-packages\torch\_subclasses\functional_tensor.py:258: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\utils\tensor_numpy.cpp:84.)
    cpu = _conversion_method_template(device=torch.device("cpu"))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================== short test summary info ========================================================================== 
FAILED tests/test_json.py::TestJson::test_torch - RuntimeError: Numpy is not available

To recreate:

import json

import torch

from monty.json import MontyEncoder


tensor = torch.tensor([0, 1, 2])
jsonstr = json.dumps(tensor, cls=MontyEncoder)

Copy link

coderabbitai bot commented Aug 22, 2024

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 fail-fast strategy was altered, and dependencies like numpy and pydantic were adjusted. Additionally, variable names in test files were refactored for consistency. Overall, these modifications refine compatibility with Python 3.10 and improve code organization.

Changes

Files Change Summary
.github/workflows/test.yml Updated python-version matrix to include 3.10, changed fail-fast to false, and upgraded Codecov action from v3 to v4.
README.md Revised supported Python version from 3.x to 3.10 and above.
pylintrc Changed Python version from 3.9 to 3.10.
pyproject.toml Updated minimum Python version from >=3.9 to >=3.10, changed Black target version to py310, modified numpy constraint, added pydantic as a new dependency.
tasks.py, tests/test_*.py Added blank lines for improved readability; no changes to functionality.
tests/test_shutil.py Refactored variable name from test_dir to TEST_DIR for clarity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant Codecov
    participant Python Environment

    User->>GitHub Actions: Trigger CI Workflow
    GitHub Actions->>Python Environment: Run Tests with Python 3.10
    Python Environment-->>GitHub Actions: Test Results
    GitHub Actions->>Codecov: Report Coverage
    Codecov-->>GitHub Actions: Coverage Report
    GitHub Actions-->>User: CI Results
Loading

🐇 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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.21%. Comparing base (1270c7b) to head (54697de).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #709      +/-   ##
==========================================
+ Coverage   81.02%   82.21%   +1.19%     
==========================================
  Files          27       27              
  Lines        1586     1586              
  Branches      361      361              
==========================================
+ Hits         1285     1304      +19     
+ Misses        236      217      -19     
  Partials       65       65              

☔ 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.

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.

1 participant