{"id":13520931,"url":"https://github.com/mlco2/codecarbon","last_synced_at":"2025-04-23T21:00:18.351Z","repository":{"id":37273856,"uuid":"263364731","full_name":"mlco2/codecarbon","owner":"mlco2","description":"Track emissions from Compute and recommend ways to reduce their impact on the environment.","archived":false,"fork":false,"pushed_at":"2025-04-20T14:51:18.000Z","size":28960,"stargazers_count":1371,"open_issues_count":104,"forks_count":204,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-23T20:59:57.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://mlco2.github.io/codecarbon","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlco2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mlco2"}},"created_at":"2020-05-12T14:44:03.000Z","updated_at":"2025-04-23T19:53:35.000Z","dependencies_parsed_at":"2023-11-22T00:59:36.622Z","dependency_job_id":"f5ef07eb-596c-4aef-b31c-31867c93fa0b","html_url":"https://github.com/mlco2/codecarbon","commit_stats":{"total_commits":1678,"total_committers":82,"mean_commits":"20.463414634146343","dds":0.834326579261025,"last_synced_commit":"d3ac941202fcbb6c3d11f478c3be9802ab13a2dd"},"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlco2%2Fcodecarbon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlco2%2Fcodecarbon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlco2%2Fcodecarbon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlco2%2Fcodecarbon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlco2","download_url":"https://codeload.github.com/mlco2/codecarbon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514767,"owners_count":21443208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:00:24.561Z","updated_at":"2025-04-23T21:00:18.304Z","avatar_url":"https://github.com/mlco2.png","language":"Python","funding_links":["https://github.com/sponsors/mlco2"],"categories":["Python","Tools","Consumption","🛠 Tools","Resources","Measure power usage by software"],"sub_categories":["Sustainability","Computation and Communication","Monitoring Tools",":computer: Codebase \u0026 Model","GNU/Linux"],"readme":"![banner](docs/edit/images/banner.png)\n\nEstimate and track carbon emissions from your computer, quantify and analyze their impact.\n\n[**Documentation**](https://mlco2.github.io/codecarbon)\n\n\u003cbr/\u003e\n\n[![](https://anaconda.org/conda-forge/codecarbon/badges/version.svg)](https://anaconda.org/conda-forge/codecarbon)\n[![](https://anaconda.org/codecarbon/codecarbon/badges/version.svg)](https://anaconda.org/codecarbon/codecarbon)\n[![](https://img.shields.io/pypi/v/codecarbon?color=024758)](https://pypi.org/project/codecarbon/)\n[![DOI](https://zenodo.org/badge/263364731.svg)](https://zenodo.org/badge/latestdoi/263364731)\n[![Downloads](https://static.pepy.tech/badge/codecarbon/month)](https://pepy.tech/project/codecarbon)\n\n\n- [About CodeCarbon 💡](#about-codecarbon-)\n- [Quickstart 🚀](#quickstart-)\n    - [Installation 🔧](#installation-)\n    - [Start to estimate your impact 📏](#start-to-estimate-your-impact-)\n      - [Monitoring your whole machine](#monitoring-your-machine-)\n      - [In your python code](#in-your-python-code-)\n      - [Visualize](#visualize-)\n- [Contributing 🤝](#contributing-)\n- [How To Cite 📝](#how-to-cite-)\n- [Contact 📝](#contact-)\n\n# About CodeCarbon 💡\n\n**CodeCarbon** started with a quite simple question: \n\n**What is the carbon emission impact of my computer program? :shrug:**\n\nWe found some global data like \"computing currently represents roughly 0.5% of the world’s energy consumption\" but nothing on our individual/organisation level impact.\n\nAt **CodeCarbon**, we believe, along with Niels Bohr, that \"Nothing exists until it is measured\". So we found a way to estimate how much CO\u003csub\u003e2\u003c/sub\u003e we produce while running our code.\n\n*How?*\n\nWe 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.\n\n![calculation Summary](docs/edit/images/calculation.png)\n\nWe explain more about this calculation in the [**Methodology**](https://mlco2.github.io/codecarbon/methodology.html#) section of the documentation.\n\nOur hope is that this package will be used widely for estimating the carbon footprint of computing, and for establishing best practices with regards to the disclosure and reduction of this footprint.\n\n**So ready to \"change the world one run at a time\"? Let's start with a very quick set up.**\n\n# Quickstart 🚀\n\n## Installation 🔧\n\n**From PyPI repository**\n```python\npip install codecarbon\n```\n\n**From Conda repository**\n```python\nconda install -c codecarbon codecarbon\n```\nTo see more installation options please refer to the documentation: [**Installation**](https://mlco2.github.io/codecarbon/installation.html#)\n\n## Start to estimate your impact 📏\n\nTo get an experiment_id enter:\n```python\n! codecarbon init\n```\nYou can now store it in a **.codecarbon.config** at the root of your project \n```python\n[codecarbon]\nlog_level = DEBUG\nsave_to_api = True\nexperiment_id = 2bcbcbb8-850d-4692-af0d-76f6f36d79b2 #the experiment_id you get with init\n```\nNow you have 2 main options:\n\n### Monitoring your machine 💻\n\nIn your command prompt use:\n```codecarbon monitor```\nThe package will track your emissions independently from your code.\n\n### In your Python code 🐍\n```python\nfrom codecarbon import track_emissions\n@track_emissions()\ndef your_function_to_track():\n  # your code\n  ```\nThe package will track the emissions generated by the execution of your function.\n\nThere is other ways to use **codecarbon** package, please refer to the documentation to learn more about it:  [**Usage**](https://mlco2.github.io/codecarbon/usage.html#)\n\n## Visualize 📊\n\nYou can now visualize your experiment emissions on the [dashboard](https://dashboard.codecarbon.io/).\n![dashboard](docs/edit/images/dashboard.png)\n\n*Note that for now, all emissions data send to codecarbon API are public.*\n\n\u003e Hope you enjoy your first steps monitoring your carbon computing impact!\n\u003e Thanks to the incredible codecarbon community 💪🏼 a lot more options are available using *codecarbon* including:\n\u003e - offline mode\n\u003e - cloud mode\n\u003e - comet integration...\n\u003e\n\u003e Please explore the [**Documentation**](https://mlco2.github.io/codecarbon) to learn about it\n\u003e If ever what your are looking for is not yet implemented, let us know through the *issues* and even better become one of our 🦸🏼‍♀️🦸🏼‍♂️ contributors! more info 👇🏼\n\n\n# Contributing 🤝\n\nWe are hoping that the open-source community will help us edit the code and make it better!\n\nYou are welcome to open issues, even suggest solutions and better still contribute the fix/improvement! We can guide you if you're not sure where to start but want to help us out 🥇\n\nIn order to contribute a change to our code base, please submit a pull request (PR) via GitHub and someone from our team will go over it and accept it.\n\nCheck out our [contribution guidelines :arrow_upper_right:](https://github.com/mlco2/codecarbon/blob/master/CONTRIBUTING.md)\n\nContact [@vict0rsch](https://github.com/vict0rsch) to be added to our slack workspace if you want to contribute regularly!\n\n# How To Cite 📝\n\nIf you find CodeCarbon useful for your research, you can find a citation under a variety of formats on [Zenodo](https://zenodo.org/records/11171501).\n\nHere is a sample for BibTeX: \n```tex \n@software{benoit_courty_2024_11171501,\n  author       = {Benoit Courty and\n                  Victor Schmidt and\n                  Sasha Luccioni and\n                  Goyal-Kamal and\n                  MarionCoutarel and\n                  Boris Feld and\n                  Jérémy Lecourt and\n                  LiamConnell and\n                  Amine Saboni and\n                  Inimaz and\n                  supatomic and\n                  Mathilde Léval and\n                  Luis Blanche and\n                  Alexis Cruveiller and\n                  ouminasara and\n                  Franklin Zhao and\n                  Aditya Joshi and\n                  Alexis Bogroff and\n                  Hugues de Lavoreille and\n                  Niko Laskaris and\n                  Edoardo Abati and\n                  Douglas Blank and\n                  Ziyao Wang and\n                  Armin Catovic and\n                  Marc Alencon and\n                  Michał Stęchły and\n                  Christian Bauer and\n                  Lucas Otávio N. de Araújo and\n                  JPW and\n                  MinervaBooks},\n  title        = {mlco2/codecarbon: v2.4.1},\n  month        = may,\n  year         = 2024,\n  publisher    = {Zenodo},\n  version      = {v2.4.1},\n  doi          = {10.5281/zenodo.11171501},\n  url          = {https://doi.org/10.5281/zenodo.11171501}\n}\n```\n\n# Contact 📝\n\nMaintainers are [@vict0rsch](https://github.com/vict0rsch) [@benoit-cty](https://github.com/benoit-cty) and [@SaboniAmine](https://github.com/saboniamine). Codecarbon is developed by volunteers from [**Mila**](http://mila.quebec) and the [**DataForGoodFR**](https://twitter.com/dataforgood_fr) community alongside donated professional time of engineers at [**Comet.ml**](https://comet.ml) and [**BCG GAMMA**](https://www.bcg.com/en-nl/beyond-consulting/bcg-gamma/default).\n\n## Star History\n\nComparison of the number of stars accumulated by the different Python CO2 emissions projects:\n[![Star History Chart](https://api.star-history.com/svg?repos=mlco2/codecarbon,lfwa/carbontracker,sb-ai-lab/Eco2AI,fvaleye/tracarbon,Breakend/experiment-impact-tracker\u0026type=Date)](https://star-history.com/#mlco2/codecarbon\u0026lfwa/carbontracker\u0026sb-ai-lab/Eco2AI\u0026fvaleye/tracarbon\u0026Breakend/experiment-impact-tracker\u0026Date)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlco2%2Fcodecarbon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlco2%2Fcodecarbon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlco2%2Fcodecarbon/lists"}