Skip to content

chore: drop Python 3.8 and 3.9 support#1091

Open
nightcityblade wants to merge 2 commits intomlco2:masterfrom
nightcityblade:fix/issue-1082
Open

chore: drop Python 3.8 and 3.9 support#1091
nightcityblade wants to merge 2 commits intomlco2:masterfrom
nightcityblade:fix/issue-1082

Conversation

@nightcityblade
Copy link

Description

Remove support for Python 3.8 and 3.9, both of which have reached end-of-life.

Changes:

  • Update requires-python from >=3.8 to >=3.10 in pyproject.toml
  • Remove Python 3.8 and 3.9 classifiers from pyproject.toml
  • Simplify codecarbon/input.py to use stdlib importlib.resources directly (available since Python 3.9) instead of conditionally falling back to the importlib_resources backport
  • Remove unused import sys from input.py

Related Issue

Fixes #1082

Motivation and Context

Python 3.8 reached EOL on 2024-10-07 and Python 3.9 reached EOL on 2025-10-05. Dropping support simplifies the codebase and allows using modern Python features.

How Has This Been Tested?

Verified that importlib.resources.files and importlib.resources.as_file are available in Python 3.10+ (they were added in Python 3.9).

Types of changes

  • 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 change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes. (N/A - removing code, not adding)
  • All new and existing tests passed.

@nightcityblade nightcityblade requested a review from a team as a code owner February 27, 2026 16:25
Copy link
Member

@SaboniAmine SaboniAmine left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!
The CONTRIBUTING.md might also need some update on python version.

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.22%. Comparing base (db0d749) to head (8157806).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1091      +/-   ##
==========================================
+ Coverage   78.19%   78.22%   +0.03%     
==========================================
  Files          38       38              
  Lines        3637     3633       -4     
==========================================
- Hits         2844     2842       -2     
+ Misses        793      791       -2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Remove support for Python 3.8 and Python 3.9

2 participants