mlco2 / mlco2/codecarbon

Too many variables when initializing the EmissionsTracker

Open
#404 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
Python
Stars
1.9k
Forks
323
Avg merge
1d 12h
Merged PRs (30d)
12

Description

Description

The BaseEmissionsTracker accepts 22 variables when initialized (and growing). This could lead to potential issues. And it is a known code smell.

What I Propose

Refactor the input variables to accept a config dict object as input.

So instead of

EmissionsTracker(project_name: "My project", measure_power_secs=10, output_dir="./temp")

codecarbon could do

config_options = {
    project_name: "My project",
    measure_power_secs=10,
    output_dir="./temp",
}
EmissionsTracker(config_options)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the BaseEmissionsTracker and EmissionsTracker initialization entry points and tracing how their current variables are passed through the library. Review existing initialization coverage before defining the configuration shape. Done means the initialization API consistently accepts the proposed configuration object and its behavior is covered without breaking supported options.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.