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

breaking: drop python 3.7 #783

Merged
merged 4 commits into from
Jan 17, 2025
Merged

Conversation

wanghan-iapcm
Copy link
Contributor

@wanghan-iapcm wanghan-iapcm commented Jan 17, 2025

Summary by CodeRabbit

Release Notes

  • Python Version Support

    • Dropped support for Python 3.7
    • Now requires Python 3.8 or higher
  • Documentation

    • Updated installation instructions to reflect new Python version requirements
  • Code Maintenance

    • Simplified type imports and version-specific code handling
    • Removed legacy version compatibility checks
  • Build Configuration

    • Updated GitHub Actions workflow to test only Python 3.8 and 3.12

@wanghan-iapcm wanghan-iapcm requested a review from njzjz January 17, 2025 02:40
Copy link

coderabbitai bot commented Jan 17, 2025

📝 Walkthrough

Walkthrough

This pull request focuses on updating the project's Python version support from Python 3.7 to Python 3.8 and above. The changes span multiple files, including workflow configurations, documentation, and project configuration files. The modifications remove Python 3.7 support across GitHub Actions workflow, installation documentation, import statements, and project metadata. The changes ensure consistent Python version requirements and simplify type-related imports by leveraging Python 3.8+ features.

Changes

File Change Summary
.github/workflows/test.yml Removed Python 3.7 from version matrix, now testing on 3.8 and 3.12
docs/installation.md Updated Python version support description from "3.7 and above" to "3.8 and above"
docs/make_format.py Simplified Literal import, removed version-specific import logic
dpdata/stat.py Modified lru_cache() decorator to lru_cache
dpdata/system.py Updated Literal import from typing module
dpdata/utils.py Added Literal to imports
pyproject.toml Removed Python 3.7 classifier, updated Python version requirement to >=3.8
tests/plugin/pyproject.toml Updated Python version requirement to >=3.8

Possibly related PRs

Suggested reviewers

  • njzjz

Finishing Touches

  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

codspeed-hq bot commented Jan 17, 2025

CodSpeed Performance Report

Merging #783 will not alter performance

Comparing wanghan-iapcm:drop37 (53aba99) with devel (4e5ab18)

Summary

✅ 2 untouched benchmarks

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.13%. Comparing base (18ba98d) to head (53aba99).
Report is 6 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #783      +/-   ##
==========================================
- Coverage   85.16%   85.13%   -0.03%     
==========================================
  Files          81       81              
  Lines        7530     7535       +5     
==========================================
+ Hits         6413     6415       +2     
- Misses       1117     1120       +3     

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

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

🔭 Outside diff range comments (2)
pyproject.toml (2)

Line range hint 26-27: Clean up Python < 3.8 conditional dependencies.

Since Python 3.7 support is being dropped, these conditional dependencies for Python < 3.8 can be removed:

-    'importlib_metadata>=1.4; python_version < "3.8"',
-    'typing_extensions; python_version < "3.8"',

Line range hint 44-47: Clean up Python < 3.8 conditional dependency in amber extras.

Since Python 3.7 support is being dropped, this conditional dependency for Python < 3.8 can be simplified:

-    'parmed; python_version >= "3.8"',
-    'parmed<4; python_version < "3.8"',
+    'parmed',
🧹 Nitpick comments (2)
dpdata/stat.py (2)

119-119: Keep the explicit @lru_cache() form.

While both forms work in Python 3.8+, the explicit @lru_cache() form is more commonly used and makes it clear that this is a function call. Consider reverting this change:

-    @lru_cache
+    @lru_cache()

Also applies to: 127-127, 156-156, 169-169

🧰 Tools
🪛 Ruff (0.8.2)

119-119: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks

(B019)


119-119: Consider alternatives to @lru_cache on methods.

Using @lru_cache on instance methods can lead to memory leaks as the cache is tied to the instance lifetime. Consider these alternatives:

  1. Move the cache to class level using a shared cache pattern
  2. Use @property without caching if the computation is lightweight
  3. Implement manual caching with instance-level cache clearing

Would you like me to provide an example implementation of any of these alternatives?

Also applies to: 127-127, 156-156, 169-169

🧰 Tools
🪛 Ruff (0.8.2)

119-119: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks

(B019)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e5ab18 and 53aba99.

📒 Files selected for processing (8)
  • .github/workflows/test.yml (1 hunks)
  • docs/installation.md (1 hunks)
  • docs/make_format.py (1 hunks)
  • dpdata/stat.py (3 hunks)
  • dpdata/system.py (1 hunks)
  • dpdata/utils.py (1 hunks)
  • pyproject.toml (1 hunks)
  • tests/plugin/pyproject.toml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • dpdata/system.py
🧰 Additional context used
🪛 Ruff (0.8.2)
dpdata/stat.py

119-119: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks

(B019)


127-127: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks

(B019)


156-156: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks

(B019)


169-169: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks

(B019)

🔇 Additional comments (6)
dpdata/utils.py (1)

6-6: LGTM! Clean import update for Python 3.8+

The direct import of Literal from typing is appropriate as Python 3.8+ is now the minimum supported version.

docs/make_format.py (1)

7-7: LGTM! Simplified type import

Clean removal of version-specific imports now that Python 3.8+ is required.

tests/plugin/pyproject.toml (1)

14-14: LGTM! Updated Python version requirement

The Python version requirement has been correctly updated to align with the project's new minimum version requirement.

docs/installation.md (1)

3-3: LGTM! Documentation accurately updated

The documentation has been correctly updated to:

  1. Reflect the new minimum Python version requirement
  2. Fix the package name from "DP-GEN" to "dpdata"
.github/workflows/test.yml (1)

12-12: LGTM! Python version matrix updated correctly.

The Python version matrix has been properly updated to remove Python 3.7, aligning with the PR objective.

pyproject.toml (1)

30-30: LGTM! Python version requirement updated correctly.

The Python version requirement has been properly updated to ">=3.8", aligning with the PR objective.

@wanghan-iapcm wanghan-iapcm merged commit 961b591 into deepmodeling:devel Jan 17, 2025
12 checks passed
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