Skip to content

docs: document missing CLI options, config keys and recent fixes - #1480

Open
davidberenstein1957 wants to merge 1 commit into
masterfrom
docs/fill-gaps
Open

davidberenstein1957 wants to merge 1 commit into
masterfrom
docs/fill-gaps

Conversation

@davidberenstein1957

@davidberenstein1957 davidberenstein1957 commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fill gaps between the code and the docs. Each change was checked against the code on master @ ab8627a.

  • docs/reference/cli.md
    • New "Global options" section for --version / -v (cli/main.py:99).
    • codecarbon monitor table: added --project-name (Add project name option to monitor command #1435), --measure-power-secs (default 10), --api-call-interval (default 30) and --region. --log-level now shows the real default error and includes critical. --country-iso-code is required in offline mode unless the config file sets it (main.py:488).
    • New sections for codecarbon get-token PROJECT_ID (main.py:203) and codecarbon test-api (main.py:152).
  • docs/how-to/configuration.md
    • The example used save_to_file=local-overwrite. That value no longer exists and is read as False. The examples now use output_methods.
    • New "Configuration keys" table: every key read through _set_from_conf with its default, and the CODECARBON_<KEY> environment variable rule (core/config.py:183).
  • docs/reference/api.md: the decorator does not accept force_mode_cpu_load or metadata as arguments. The page said it accepts the same parameters as EmissionsTracker.
  • codecarbon/emissions_tracker.py: track_emissions docstring only. api_call_interval and region now match the BaseEmissionsTracker docstring (default 8, -1; US States and Canada).
  • docs/how-to/slurm.md: warning about machine-mode trackers on SLURM local rank other than 0 counting the node twice (feat: warn when SLURM ranks double count a node #1390, core/slurm.py).
  • docs/how-to/logging.md: the example path codecarbon/examples/logging_demo.py does not exist. It now links to examples/logging_to_file.py and examples/logging_to_google_cloud.py.
  • docs/how-to/cloud-api.md: the API keeps sub-second durations; only a duration of zero or less is skipped (515dea6).
  • docs/explanation/methodology.md: a cloud region with no state falls back to the city (f416fcb).

Related Issue

N/A

Motivation and Context

Features from 3.3.x and later commits on master were missing from the reference pages, and one config example stopped working after the output_methods change.

How Has This Been Tested?

  • uv run zensical build -f mkdocs.yml --clean: exit 0. The 6 existing redirect warnings remain; the Zensical upgrade PR fixes them.
  • python scripts/check_docs_links.py site: passed, exit 0.
  • uv run codecarbon monitor --help: option names match the table. Defaults read from cli/main.py.
  • Config table defaults read from the _set_from_conf(...) calls in codecarbon/emissions_tracker.py.
  • pre-commit run --files <changed files>: autoflake, isort, black, flake8 passed.
  • pytest -k "track_emissions or decorator or docs" --ignore=tests/test_viz_data.py: 22 passed (test_viz_data.py needs dash, which the doc group does not install).
  • git diff codecarbon/emissions_tracker.py changes docstring lines only.

Screenshots (if appropriate):

N/A

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)

AI Usage Disclosure

Please refer to docs/how-to/ai-policy.md for detailed guidelines on how to disclose AI usage in your PR. Accurately completing this section is mandatory.

  • 🟥 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:

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

Commits

  • 49c0eaa docs: document missing CLI options, config keys and recent fixes

- cli.md: add --version, the four missing monitor options, the real
  --log-level default, and the get-token and test-api commands.
- configuration.md: replace the invalid save_to_file=local-overwrite
  example with output_methods, and add a table of all config keys with
  defaults and the CODECARBON_<KEY> environment variable rule.
- api.md and the track_emissions docstring: say the decorator does not
  accept force_mode_cpu_load or metadata, and align api_call_interval
  and region with the base tracker docstring.
- slurm.md: warn that machine-mode trackers on local rank > 0 count the
  node more than once.
- logging.md: link to the real logging examples.
- cloud-api.md and methodology.md: note sub-second API durations and the
  city fallback for cloud regions with no state.
@davidberenstein1957
davidberenstein1957 requested a review from a team as a code owner November 11, 2026 07:24
@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.86%. Comparing base (ab8627a) to head (49c0eaa).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1480   +/-   ##
=======================================
  Coverage   93.86%   93.86%           
=======================================
  Files          51       51           
  Lines        5734     5734           
=======================================
  Hits         5382     5382           
  Misses        352      352           

☔ View full report in Codecov by Harness.
📢 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant