Skip to content

Potential fix for #404 Too many variables when initializing the EmissionsTracker#1161

Open
Jmilk3 wants to merge 3 commits intomlco2:masterfrom
Jmilk3:master
Open

Potential fix for #404 Too many variables when initializing the EmissionsTracker#1161
Jmilk3 wants to merge 3 commits intomlco2:masterfrom
Jmilk3:master

Conversation

@Jmilk3
Copy link
Copy Markdown

@Jmilk3 Jmilk3 commented Apr 16, 2026

Description

Modifies EmissionsTracker init functions to use **kwargs to address the large number of input arguments as suggested in issue #404. The implementation seeks to avoid changing anything about how the code actually runs while clearing the code smell.

How Has This Been Tested?

All existing tests still pass with no modifications after the changes to EmissionsTracker were implemented. All pre-commit linters/autoformatters passed.

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

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

AI Usage Disclosure

  • 🟥 AI-vibecoded: You cannot explain the logic. Car analogy : the car drive by itself, you are outside it and just tell it where to go.
  • 🟠 AI-generated: Car analogy : the car drive by itself, you are inside and give instructions.
  • ⭐ AI-assisted. Car analogy : you drive the car, AI help you find your way.
  • ♻️ No AI used. Car analogy : you drive the car.

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • 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 docs/how-to/contributing.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Notes:

I am unsure if/how the documentation should be updated to reflect the changes made to the argument input format. I would be happy to make those changes if needed.

This is my first attempt at contributing to an open source project, so any feedback would be greatly appreciated!

@Jmilk3 Jmilk3 requested a review from a team as a code owner April 16, 2026 00:34
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2026

Codecov Report

❌ Patch coverage is 96.07843% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.85%. Comparing base (f7cb862) to head (7460355).

Files with missing lines Patch % Lines
codecarbon/emissions_tracker.py 96.07% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1161      +/-   ##
==========================================
- Coverage   88.85%   88.85%   -0.01%     
==========================================
  Files          45       45              
  Lines        4279     4287       +8     
==========================================
+ Hits         3802     3809       +7     
- Misses        477      478       +1     

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

1 participant