Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
594bc3f
docs: port documentation to Markdown with Zensical theme
davidberenstein1957 Feb 21, 2026
9af956d
chore: update documentation and configuration for Zensical theme
davidberenstein1957 Feb 22, 2026
7cc4f50
fix: Cli OIDC fix (#1066)
prmths128 Feb 22, 2026
07d5c67
fix(api): logout flow in the dashboard (#1074)
inimaz Feb 22, 2026
b8487f1
Add i5-1335U
Feb 13, 2026
9584aa2
clean doc
Feb 13, 2026
6ab4d02
doc
Feb 13, 2026
38ec6f6
Fix You have a 13th Gen Intel(R) Core(TM) i5-1335U but we don't know it
Feb 13, 2026
cb27580
bump
Feb 13, 2026
f8bb890
Add more test
Feb 13, 2026
a5a08d1
coverage config
Feb 13, 2026
7f62740
doc rebase
Feb 22, 2026
527f5f2
Merge origin/master into docs/port-to-zensical
davidberenstein1957 Feb 22, 2026
49eeca4
fix(ci): resolve pre-commit isort and flaky test
davidberenstein1957 Feb 22, 2026
30c16a3
refactor(tests): format assertion for better readability in test_emis…
davidberenstein1957 Feb 22, 2026
ae58c82
docs: add standalone installer instructions for non-Python users
davidberenstein1957 Feb 25, 2026
fd4f7b4
ci: add GitHub Actions workflows for documentation build and deployment
davidberenstein1957 Feb 25, 2026
8b3ef28
ci: update deploy-docs workflow to include script path and fix pip co…
davidberenstein1957 Feb 25, 2026
0b1212e
ci: update deploy-docs workflow to include script path and fix pip co…
davidberenstein1957 Feb 25, 2026
d28d197
ci: refactor build-docs workflow to streamline documentation build pr…
davidberenstein1957 Feb 25, 2026
88aef32
ci: update workflows to enhance documentation build and deployment
davidberenstein1957 Feb 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Here's what you need to know to navigate and contribute effectively.
### Key Directories

- **tests/** - Unit tests for the core package
- **docs/** - Sphinx documentation (build with `uv run task docs`)
- **docs/** - Zensical documentation (build with `uv run task docs`)
- **examples/** - Usage examples and demos
- **deploy/** - Deployment configurations and scripts

Expand Down
8 changes: 1 addition & 7 deletions .github/pyproject_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_version_from_file(filepath: str, pattern: str) -> str:

def get_all_versions() -> dict:
"""
Read versions from all three files managed by bumpver.
Read versions from files managed by bumpver.

:return: Dict containing versions from all files
"""
Expand All @@ -60,11 +60,6 @@ def get_all_versions() -> dict:
"codecarbon/_version.py", r'^__version__\s*=\s*["\']([^"\']+)["\']'
)

# Get version from docs/edit/conf.py
versions["docs_conf"] = get_version_from_file(
"docs/edit/conf.py", r'^release\s*=\s*["\']([^"\']+)["\']'
)

return versions


Expand Down Expand Up @@ -95,7 +90,6 @@ def check_version_coherence(quiet=False) -> bool:
file_mapping = {
"pyproject_toml": "pyproject.toml [tool.bumpver] current_version",
"codecarbon_version": "codecarbon/_version.py __version__",
"docs_conf": "docs/edit/conf.py release",
}
logging.error(f" {file_mapping[file_key]}: {version}")
logging.error(
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build Documentation

permissions:
contents: read

on:
push:
branches: [master, docs/port-to-zensical]
paths:
- "docs/**"
- "mkdocs.yml"
pull_request:
branches: [master]
paths:
- "docs/**"
- "mkdocs.yml"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
with:
version: "latest"

- name: Set up Python
run: uv python install 3.11

- name: Install dependencies
run: uv sync --group doc

- name: Build docs
run: uv run zensical build -f mkdocs.yml --clean
69 changes: 69 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Deploys docs to GitHub Pages with versioning.
# Configure GitHub Pages: Settings > Pages > Source = "Deploy from a branch" > Branch = gh-pages

# Docs deploy to gh-pages with versioning. Set Pages: Settings > Pages > Source = gh-pages branch.

name: Deploy documentation

on:
push:
branches: [master]
paths:
- "docs/**"
- "mkdocs.yml"
- "scripts/deploy-docs.sh"
- "codecarbon/_version.py"
- "pyproject.toml"
release:
types: [published]

permissions:
contents: read

concurrency:
group: deploy-docs
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write # push to gh-pages
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
with:
version: "latest"

- name: Set up Python
run: uv python install 3.11

- name: Install dependencies
run: uv sync --group doc

- name: Get version
id: version
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"
else
VERSION=$(uv run python -c "from codecarbon._version import __version__; print(__version__)")
fi
echo "full=$VERSION" >> $GITHUB_OUTPUT

- name: Build docs
run: uv run zensical build -f mkdocs.yml --clean

- name: Deploy to GitHub Pages
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x scripts/deploy-docs.sh
scripts/deploy-docs.sh "${{ steps.version.outputs.full }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ venv.bak/

# mkdocs documentation
/site
/deploy

# mypy
.mypy_cache/
Expand Down
90 changes: 58 additions & 32 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,34 @@

<!-- TOC start (generated with https://github.com/derlin/bitdowntoc) -->

- [</a> Have a Question?](#have-a-question)
- [</a> Found a Bug?](#found-a-bug)
- [</a> Have a Feature Request?](#have-a-feature-request)
- [Alternative ways of contributing](#alternative-ways-of-contributing)
- [</a> Ready to Contribute!](#ready-to-contribute)
* [Installation](#installation)
* [Some UV commands](#some-uv-commands)
* [Tests](#tests)
* [Stress your computer](#stress-your-computer)
* [Update all dependancies](#update-all-dependancies)
* [Branching and Pull Requests](#branching-and-pull-requests)
* [Debug in VS Code](#debug-in-vs-code)
* [Coding style && Linting](#coding-style-linting)
* [Dependencies management](#dependencies-management)
* [Build Documentation 🖨️](#build-documentation)
* [Release process](#release-process)
+ [Test the build in Docker](#test-the-build-in-docker)
- [API and Dashboard](#api-and-dashboard)
* [CSV Dashboard](#csv-dashboard)
* [Web dashboard](#web-dashboard)
* [API](#api)
* [Test the API](#test-the-api)
* [Restore database from a production Backup](#restore-database-from-a-production-backup)
* [Deployment](#deployment)
+ [API](#api-1)
+ [Dashboard](#dashboard)
- [License](#license)
- [Contributing to Code Carbon](#contributing-to-code-carbon)
- [ Have a Question?](#-have-a-question)
- [ Found a Bug?](#-found-a-bug)
- [ Have a Feature Request?](#-have-a-feature-request)
- [Alternative ways of contributing](#alternative-ways-of-contributing)
- [ Ready to Contribute!](#-ready-to-contribute)
- [Installation](#installation)
- [Some UV commands](#some-uv-commands)
- [Tests](#tests)
- [Stress your computer](#stress-your-computer)
- [Update all dependancies](#update-all-dependancies)
- [Branching and Pull Requests](#branching-and-pull-requests)
- [Debug in VS Code](#debug-in-vs-code)
- [Coding style \&\& Linting](#coding-style--linting)
- [Dependencies management](#dependencies-management)
- [Build Documentation 🖨️](#build-documentation-️)
- [Release process](#release-process)
- [Test the build in Docker](#test-the-build-in-docker)
- [API and Dashboard](#api-and-dashboard)
- [CSV Dashboard](#csv-dashboard)
- [Web dashboard](#web-dashboard)
- [API](#api)
- [Test the API](#test-the-api)
- [Restore database from a production Backup](#restore-database-from-a-production-backup)
- [Deployment](#deployment)
- [API](#api-1)
- [Dashboard](#dashboard)
- [License](#license)

<!-- TOC end -->

Expand Down Expand Up @@ -225,7 +226,7 @@ Here is the launch.json to be able to debug examples and tests:

Then run opened test with this button:

![vscode_debug](docs/edit/images/vscode_debug.png)
![vscode_debug](docs/images/vscode_debug.png)


<!-- TOC --><a name="coding-style-linting"></a>
Expand Down Expand Up @@ -271,15 +272,40 @@ Dependencies are defined in different places:
### Build Documentation 🖨️

No software is complete without great documentation!
To make generating documentation easier, we use [`sphinx` package](https://www.sphinx-doc.org/en/master/usage/installation.html#installation-from-pypi).
To make generating documentation easier, we use [Zensical](https://zensical.org/).

In order to make changes, edit the `.rst` files that are in the `/docs/edit` folder, and then run in root folder:
In order to make changes, edit the `.md` files in the `/docs` folder, and then run in root folder:

```sh
uv run --only-group doc task docs
```

to regenerate the html files.
to regenerate the html files. For local preview with live reload, run `uv run --only-group doc task docs-serve`.

### Rebase your branch on master

Before creating a PR, please make sure to rebase your branch on master to avoid merge conflicts and make the review easier. You can do it with the following command:
```sh
# Be careful, this command will delete every local changes you have, make sure to commit or stash them before running it
TARGET_BRANCH=master
current_branch=$(git symbolic-ref --short HEAD)
git switch $TARGET_BRANCH && git pull
git switch $current_branch --force && git fetch origin $TARGET_BRANCH
git rebase $TARGET_BRANCH
```

In case of a conflict during a rebase, "incoming" refers to your branch, and "current" refers to master. This is because the commits from your branch are being applied to master, so they are incoming. In case of a merge, it's the opposite!

Check if everything is fine:

```sh
git status
```

Push force
```sh
git push --force-with-lease
```

### Rebase your branch on master

Expand Down Expand Up @@ -313,7 +339,7 @@ git push --force-with-lease
- Create a PR bumping the version with `uv run bumpver update --patch`. For a release candidate, use `uv run bumpver update --set-version 3.0.0_rc1`.
- Run `uv run python .github/pyproject_versions.py -c` to check version consistancy.
- Update the dependencies with `uv sync --upgrade`
- [Build Documentation](#documentation) with `uv run --only-group doc task docs`.
- [Build Documentation](#build-documentation) with `uv run --only-group doc task docs`.
- Push the changes.
- Merge the PR.
- Wait for the Github Action `ReleaseDrafter` to finish running on the merge commit.
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![banner](docs/edit/images/banner.png)
![banner](docs/images/banner.png)

Estimate and track carbon emissions from your computer, quantify and analyze their impact.

Expand All @@ -22,14 +22,18 @@ CodeCarbon websites:

- [About CodeCarbon 💡](#about-codecarbon-)
- [Quickstart 🚀](#quickstart-)
- [Installation 🔧](#installation-)
- [Start to estimate your impact 📏](#start-to-estimate-your-impact-)
- [Monitoring your whole machine](#monitoring-your-machine-)
- [In your python code](#in-your-python-code-)
- [Visualize](#visualize-)
- [Installation 🔧](#installation-)
- [Start to estimate your impact 📏](#start-to-estimate-your-impact-)
- [Without using the online dashboard](#without-using-the-online-dashboard)
- [With the online dashboard](#with-the-online-dashboard)
- [Monitoring your machine 💻](#monitoring-your-machine-)
- [Detecting your hardware 🔍](#detecting-your-hardware-)
- [In your Python code 🐍](#in-your-python-code-)
- [Visualize 📊](#visualize-)
- [Contributing 🤝](#contributing-)
- [How To Cite 📝](#how-to-cite-)
- [Contact 📝](#contact-)
- [Star History](#star-history)

# About CodeCarbon 💡

Expand All @@ -45,7 +49,7 @@ At **CodeCarbon**, we believe, along with Niels Bohr, that "Nothing exists until

We created a Python package that estimates your hardware electricity power consumption (GPU + CPU + RAM) and we apply to it the carbon intensity of the region where the computing is done.

![calculation Summary](docs/edit/images/calculation.png)
![calculation Summary](docs/images/calculation.png)

We explain more about this calculation in the [**Methodology**](https://mlco2.github.io/codecarbon/methodology.html#) section of the documentation.

Expand Down Expand Up @@ -128,7 +132,7 @@ There is other ways to use **codecarbon** package, please refer to the documenta
## Visualize 📊

You can now visualize your experiment emissions on the [dashboard](https://dashboard.codecarbon.io/).
![dashboard](docs/edit/images/dashboard.png)
![dashboard](docs/images/dashboard.png)


> Hope you enjoy your first steps monitoring your carbon computing impact!
Expand Down
4 changes: 0 additions & 4 deletions docs/.buildinfo

This file was deleted.

Binary file removed docs/_images/Experiment&run.png
Binary file not shown.
Loading
Loading