Skip to content

Add support for Apple M4#1112

Merged
benoit-cty merged 4 commits intomasterfrom
copilot/add-support-for-apple-m4
Mar 18, 2026
Merged

Add support for Apple M4#1112
benoit-cty merged 4 commits intomasterfrom
copilot/add-support-for-apple-m4

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

Apple M4 chips were not recognized in the Apple Silicon detection logic, causing M4 users to receive incorrect install instructions when powermetrics wasn't configured.

Changes

  • codecarbon/core/resource_tracker.py: Added "M4" to the Apple Silicon chip check in _get_install_instructions. Also refactored the chained or conditions to use any() for maintainability:

    # Before
    if "M1" in cpu_model or "M2" in cpu_model or "M3" in cpu_model:
    
    # After
    if any(chip in cpu_model for chip in ("M1", "M2", "M3", "M4")):
  • docs/introduction/methodology.md: Updated Apple Silicon chip list from (M1, M2) to (M1, M2, M3, M4).

Note: The powermetrics-based power measurement itself already supports any Apple chip via a generic "Apple" prefix check — only the fallback messaging and docs needed updating.


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

Co-authored-by: benoit-cty <6603048+benoit-cty@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Apple M4 Add support for Apple M4 Mar 17, 2026
Copilot AI requested a review from benoit-cty March 17, 2026 08:51
@benoit-cty benoit-cty requested a review from SaboniAmine March 17, 2026 09:10
@benoit-cty benoit-cty marked this pull request as ready for review March 17, 2026 09:19
@benoit-cty benoit-cty requested a review from a team as a code owner March 17, 2026 09:19
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.

LGTM, thanks! You could also add the M5 reference too, as they are now available to the public.

@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.57%. Comparing base (a6de0ba) to head (7c4da32).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1112      +/-   ##
==========================================
+ Coverage   78.25%   78.57%   +0.31%     
==========================================
  Files          38       38              
  Lines        3638     3640       +2     
==========================================
+ Hits         2847     2860      +13     
+ Misses        791      780      -11     

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

@benoit-cty
Copy link
Contributor

Switched to a RegExp so M10 is already supported :D

@benoit-cty benoit-cty merged commit c2b8df8 into master Mar 18, 2026
11 checks passed
@benoit-cty benoit-cty deleted the copilot/add-support-for-apple-m4 branch March 18, 2026 08:28
@benoit-cty benoit-cty mentioned this pull request Mar 18, 2026
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.

3 participants