Skip to content

docs: complete metadata, citation, troubleshooting and accuracy docs - #1302

Open
davidberenstein1957 wants to merge 30 commits into
masterfrom
docs/traction-batch
Open

docs: complete metadata, citation, troubleshooting and accuracy docs#1302
davidberenstein1957 wants to merge 30 commits into
masterfrom
docs/traction-batch

Conversation

@davidberenstein1957

@davidberenstein1957 davidberenstein1957 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Closes #1301.

Implements all twelve documentation and traction items. uv run task docs builds clean and the internal link check passes (5246 attributes); tests/test_cpu.py, test_emissions_tracker.py and the new link test pass (76 passed, 2 skipped). Ruff error count is unchanged from master.

What is in here

Packaging and citation

  • pyproject.toml: description, 15 keywords, 19 classifiers; Changelog URL now points at the docs. bumpver also patterns CITATION.cff.
  • New CITATION.cff and a rewritten README citation section using the Zenodo concept DOI 10.5281/zenodo.4658424, which tracks the latest release instead of pinning v2.4.1. docs/index.md citation link updated to the same DOI.

Discoverability

  • examples/README.md rewritten as a categorised index. Every filename checked against ls examples/, every symbol against codecarbon/__init__.py — no CO2Tracker, no @track_co2. The duplicated table in docs/how-to/examples.md is gone; that page now points at the canonical index. New tests/test_readme_links.py asserts relative links resolve.
  • The RAPL guide moves to a top-level how-to entry, retitled "Get accurate CPU measurements (Linux/RAPL)", with inbound links from the README, docs index, FAQ, installation and the quickstart. File path unchanged, so no redirect needed.
  • New docs/how-to/troubleshooting.md, keyed to log lines that were each grepped out of the current source. cpu.py now appends a docs URL to the RAPL-permission and unknown-CPU warnings via one shared constant, so the three call sites cannot drift apart. The two linked anchors are pinned with explicit { #... } ids.

Supporting our claims

  • New docs/explanation/alternatives.md and docs/explanation/accuracy.md. The accuracy figures are computed from CSVs already committed in this repo (codecarbon/data/hardware/cpu_load_profiling/) — the TDP estimate deviates from RAPL by up to roughly a factor of two in either direction depending on CPU and load. Per-backend accuracy and wall-socket validation are marked "not yet measured" rather than estimated. Competitor facts (licence, language, archive status) were pulled from the GitHub API; no maintenance judgements, and "peer-reviewed" softened to "accompanying academic paper" where the venue was not verified.
  • methodology.md gains a real bibliography (foundational work, hardware measurement, carbon-intensity sources, citing CodeCarbon). The personal blog post is demoted to a supporting walkthrough behind Khan et al. and Weaver; the open GitHub issue is relabelled as a tracked limitation, with Intel's own page cited for the Power Gadget discontinuation.

Contribution and release surface

  • Issue forms replace the four .md templates. The bug form requires codecarbon detect output (command verified to exist); config.yml disables blank issues and links Discord, troubleshooting, FAQ and docs.
  • contributing.md split into a 95-line contributor page, how-to/development.md, and maintaining.md. Nothing dropped — content moved. The stray </a> in four headings and the hand-maintained TOC markers are gone.
  • CHANGELOG.md at the repo root, holding both the user-facing changelog and the deprecations/migrations table; the Changelog project URL points at the GitHub releases page. No changelog or deprecations page in the docs site, and no blog surface — codecarbon.io already has one. Entries are sourced from gh release view bodies and git log; deprecation "since" versions from git log -S plus git tag --contains. release-drafter.yml now resolves the version instead of always bumping the patch.
  • Open Graph and Twitter Card tags via a small overrides/main.html (Zensical emits none, and supports custom_dir — no Cairo dependency, no workflow change), five footer links, and start()/stop()/flush()/task-tracking now rendering in the API reference. Two malformed :param: directives in track_task_emissions fixed, since griffe now publishes them.

Worth a maintainer's eye before merge

  • CITATION.cff author list. Names come from the existing README BibTeX with unresolved handles dropped, plus a collective "The CodeCarbon contributors" entry. This is a social decision, not a technical one — please confirm.
  • Two citations copied from the audit rather than verified against the papers: the Khan et al. RAPL in Action year/venue details, and the Henderson et al. JMLR volume/issue 21(248).
  • External links were not fetched — the link checker skips them by default. Worth one scripts/check_docs_links.py site --external run.
  • date-released in CITATION.cff still needs a manual touch at release time; bumpver only patterns the version line.
  • The release checklist in maintaining.md should gain a "move Unreleased under the new version" step; the changelog page is otherwise a manual artefact.

🤖 Generated with Claude Code

Implements the twelve documentation and traction items tracked in
updates/docs:

- PyPI metadata: description, keywords, expanded classifiers
- CITATION.cff plus an unpinned, DOI-based citation in the README
- Rewritten examples/README.md indexing the real examples and APIs
- New troubleshooting page keyed to actual log lines, linked from the
  README, FAQ, docs index and from RAPL warning strings in cpu.py
- RAPL setup guide promoted out of "Deployment" to a top-level how-to
- New alternatives comparison and accuracy/validation pages
- Methodology bibliography built out; blog-post and open-issue
  citations demoted or replaced
- GitHub issue forms that collect `codecarbon detect` output
- Contributing guide split into contributor / development / maintainer
  pages, stray `</a>` in headings removed
- CHANGELOG.md, changelog and deprecations reference pages, a blog
  surface, and release-drafter version resolution
- Open Graph tags, footer links, and start()/stop() in the API reference

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@davidberenstein1957
davidberenstein1957 requested a review from a team as a code owner August 12, 2026 14:14
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.77%. Comparing base (3ec31a0) to head (a3148a3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1302      +/-   ##
==========================================
+ Coverage   91.43%   91.77%   +0.33%     
==========================================
  Files          49       49              
  Lines        5057     5058       +1     
==========================================
+ Hits         4624     4642      +18     
+ Misses        433      416      -17     

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

davidberenstein1957 and others added 3 commits August 12, 2026 16:28
The changelog and deprecations reference pages stay; the release
announcement post belongs on codecarbon.io, not in the docs site.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Move the changelog and the deprecations table into the root
CHANGELOG.md, which GitHub renders, and drop the two reference pages.
The `Changelog` project URL now points at the releases page, and the
deprecation notices in the configuration and output docs link to the
deprecations section of CHANGELOG.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Docs build and the internal link check pass on the new version. 0.0.53
still emits no Open Graph tags of its own, so the `overrides/main.html`
template added in this branch stays necessary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
davidberenstein1957 and others added 18 commits August 12, 2026 16:40
The wheel-validation job runs the test suite against an installed
wheel without the rest of the repository, so `examples/README.md` does
not exist there and the check failed with FileNotFoundError.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Move the 165-line raw machine dumps in rapl.md into a clearly marked
appendix so the explanation reads end to end.

Retitle power-estimation.md to "From Energy Counters to Power" — the old
title promised the TDP estimation model and delivered counter-to-power
derivation. File path unchanged so external URLs keep working.

Relabel model-comparisons.md: the numbers come from Azure tooling, not
CodeCarbon. Provenance moved to a warning at the top and the nav entry
moved out of Explanation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every CSV column now states what produced it: hardware counter, model,
or config. Adds the four EmissionsData fields missing from the table
(experiment_id, water_consumed, pue, wue), documents that PUE inflates
the per-component energy columns, and corrects the lat/long precision
claim (rounding happens only on the API path).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The three worked examples asserted CodeCarbon "uses psys only", which
contradicted the Key Takeaways section on the same page. Verified against
core/cpu.py: rapl_prefer_psys defaults to False (:453) and psys is used
only when explicitly enabled (:694), with the else path logging "psys
domain detected but not used" (:727). Key Takeaways was right.

Each example now states the default package-domain behaviour and marks
the psys arithmetic as requiring rapl_prefer_psys=True. Also reworded the
open "we still have to investigate" note on DRAM as a stated limitation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The documented CPU fallback ladder did not match resource_tracker.py,
the equivalence constants were sourced to a file absent from the repo,
Electricity Maps was undocumented, and the RAM heuristic was presented
as empirically motivated. Rewrite methodology.md against the source and
split the bibliography and equivalences into their own pages.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tracking_mode silently swaps the power model on the estimation path:
cubic with a 10% floor in machine mode (hardware.py:287-288), linear
with no floor in process mode (hardware.py:346). Documenting only the
cubic invited readers to blame the divergence on attribution scope.

Also scope accuracy.md's deviation figures to machine mode, which is
what the profiling script actually measured.

Refs #1378

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Threadripper walkthrough presents a summed per-die figure as correct.
Whether the two package-X-die-Y domains are independent or mirror the same
counter is unresolved, so the page now links issue #1379 instead of
vouching for the result. Observed numbers left untouched as evidence.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The overview page states the formula PUE-inflated; this page stated
E x C and introduced PUE later, so the two read as disagreeing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The changelog duplicated the GitHub releases page, which both pyproject files
already declare as the canonical Changelog URL. Keeping it meant every PR
needed a bullet in a file that only existed on one branch.

The deprecations table was the one thing releases cannot carry, so it moves to
docs/reference/deprecations.md and the two docs pages that linked into the
changelog anchor now point there.

Also pin black and ruff to the versions CI's pre-commit hooks use, and set
black's target-version explicitly. The inferred target outran the interpreter,
so black was skipping its AST safety check and local formatting runs rewrote
~120 files that CI considered clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CodeQL reports py/weak-sensitive-data-hashing on generate_lookup_value. The
value is a database index, not a credential: authentication is bcrypt against
hashed_token, and the derivation cannot be changed because it is computed from
plaintext tokens that are never stored. Write that down so the alert is not
re-litigated, and correct get_api_key_hash's return annotation, which claimed
str while returning bcrypt's bytes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
#1369 removes the taskipy black/ruff tasks entirely, which is the root-cause
fix for the format drift: pinning a second toolchain to match pre-commit keeps
two copies of the same version truth in sync by hand. Take the deletion there
instead and leave these unpinned so the two branches do not conflict.

[tool.black] target-version stays: the pre-commit black hook reads pyproject
too, so that fix is orthogonal to #1369 and still wanted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The GPU row named only NVML, but AMD devices are read through AMDSMI
in codecarbon/core/gpu_amd.py.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The cpu_load row described only the process-mode linear model; the
default machine-mode model is cubic with a 10% TDP floor
(external/hardware.py:287-288). Move on_cloud after ram_used_gb to
match the EmissionsData field order the table claims to follow, and
widen the coordinate-rounding citation to cover both axes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Cut the preamble to one sentence, replace the numbered note lead-ins with
sub-headings, remove the em-dashes the page did not have, blank the
provenance cell for self-evident fields, and defer the carbon intensity
fallback chain to the methodology page. Note that powermetrics is
effectively unreachable on Apple Silicon because the cpu_load path is
selected first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
force_cpu_power does not report a flat constant. With psutil installed --
a hard dependency -- control reaches _setup_fallback_tracking and selects
cpu_load mode with the given value as the TDP, so machine mode reports
value * (0.1 + 0.9 * load**3). Fix the backend table row and the bullet
below it.

troubleshooting.md still described powermetrics as the Apple Silicon
backend and pointed at sudoers instructions the rewrite had deleted.
Rewrite that section: on Apple Silicon the cpu_load path wins before
powermetrics is tried, so passwordless sudo changes nothing; on Intel
Macs powermetrics is still reachable, and the sudoers recipe now lives
there.

Also cut over-rewriting: drop the opening preamble, the "Checking this
page" section and the repeated unsourced-constant notes, and restore the
original Windows EMI, CPU hardware and per-fuel table prose.

Carry over the four-term formula block and a References routing row from
the how-it-works draft, which is otherwise a duplicate of this page.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Key Takeaways block named the options prefer_psys and include_dram.
Neither exists; emissions_tracker.py:425-426 declares rapl_include_dram
and rapl_prefer_psys.

Revert the power-estimation.md title change and the three inbound link
edits it forced. The original title is more searchable; the info box
disambiguating it from the TDP path is kept.

Leave Model Comparisons under Explanation, where the file lives, and cut
the duplicated issue-tracker note in takeaways item 7 to one clause --
the full caveat is already in the appendix admonition.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
davidberenstein1957 and others added 4 commits August 19, 2026 11:09
- troubleshooting: allow_multiple_runs defaults to True
  (emissions_tracker.py:162), so the machine-wide lock is only taken when it
  is set to False. The page had it backwards.
- troubleshooting, enable-rapl: `docker --device` takes device nodes, not a
  sysfs directory; use a read-only bind mount, matching the Compose snippet.
- examples/README: api_call_debug.py uses measure_power_secs=2 and
  api_call_interval=2, i.e. every 4 seconds, not 20.
- troubleshooting: measure_power_secs is 15 in the Python API but 10 for
  `codecarbon monitor` (cli/main.py), with api_call_interval 30.
- deprecations: the carbonboard/viz-legacy split shipped in v3.2.1, not 3.3.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Delete the references and equivalences pages, trim the deprecations page to
its table, and cut the duplicated recaps from the alternatives, accuracy,
troubleshooting and development pages.

Fix commands that do not exist: `task lint` (removed from pyproject),
`uv run task local`, `uv run dashboard`, `uv run api.docker` and
`uv run api.local`. Move the orphaned accuracy paragraph out of the tools
comparison FAQ entry.

Revert the wrapped_fn rename and shorten the lookup-value docstring.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Docs and traction: fill the twelve gaps in packaging, citation, troubleshooting and accuracy docs

2 participants