{"id":13520961,"url":"https://github.com/fvaleye/tracarbon","last_synced_at":"2026-01-04T13:08:55.683Z","repository":{"id":36958051,"uuid":"468889604","full_name":"fvaleye/tracarbon","owner":"fvaleye","description":"🌍 Tracarbon tracks your device's energy consumption and calculates your carbon emissions using your location.","archived":false,"fork":false,"pushed_at":"2024-10-28T08:35:51.000Z","size":5871,"stargazers_count":98,"open_issues_count":11,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-29T21:01:23.274Z","etag":null,"topics":["carbon-footprint","electricity-consumption","energy","energy-consumption","energy-efficiency","sustainability"],"latest_commit_sha":null,"homepage":"https://fvaleye.github.io/tracarbon/documentation/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fvaleye.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-11T20:22:45.000Z","updated_at":"2024-10-16T04:51:54.000Z","dependencies_parsed_at":"2024-01-19T06:13:41.402Z","dependency_job_id":"c3fb5caa-c6ab-4bd0-a482-91794db6bed9","html_url":"https://github.com/fvaleye/tracarbon","commit_stats":{"total_commits":301,"total_committers":4,"mean_commits":75.25,"dds":"0.23588039867109634","last_synced_commit":"3ce0b2eaa87066e703f21bda2709befee706d10d"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvaleye%2Ftracarbon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvaleye%2Ftracarbon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvaleye%2Ftracarbon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvaleye%2Ftracarbon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fvaleye","download_url":"https://codeload.github.com/fvaleye/tracarbon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245019967,"owners_count":20548151,"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":["carbon-footprint","electricity-consumption","energy","energy-consumption","energy-efficiency","sustainability"],"created_at":"2024-08-01T06:00:25.139Z","updated_at":"2026-01-04T13:08:55.677Z","avatar_url":"https://github.com/fvaleye.png","language":"Python","funding_links":[],"categories":["🛠 Tools","Green Software Awesome List","Consumption","Tools"],"sub_categories":["Code-Based Tools","Contents","Computation and Communication","Tools for measuring and quantifying footprint"],"readme":"![Tracarbon Logo](https://raw.githubusercontent.com/fvaleye/tracarbon/main/logo.png \"Tracarbon logo\")\n\n![example workflow](https://github.com/fvaleye/tracarbon/actions/workflows/build.yml/badge.svg)\n[![pypi](https://img.shields.io/pypi/v/tracarbon.svg?style=flat-square)](https://pypi.org/project/tracarbon/)\n[![doc](https://img.shields.io/badge/docs-python-blue.svg?style=for-the-badge)](https://fvaleye.github.io/tracarbon)\n[![licence](https://img.shields.io/badge/license-Apache--2.0-green)](https://github.com/fvaleye/tracarbon/blob/main/LICENSE.txt)\n\n## 📌 Overview\n\nTracarbon is a Python library that tracks your device's energy consumption and calculates your carbon emissions.\n\nIt detects your location and your device automatically before starting to export measurements to an exporter.\nIt could be used as a CLI with already defined metrics or programmatically with the API by defining the metrics that you want to have.\n\nRead more in this [article](https://medium.com/@florian.valeye/tracarbon-track-your-devices-carbon-footprint-fb051fcc9009).\n\n## 📦 Where to get it\n\n```sh\n# Install Tracarbon\npip install tracarbon\n```\n\n```sh\n# Install one or more exporters from the list\npip install 'tracarbon[datadog,prometheus,kubernetes]'\n```\n\n### 🔌 Devices: energy consumption\n\n| **Devices** |                                                                                                                                                           **Description**                                                                                                                                                            |\n| ----------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |\n| Mac         |                                                                                                                           ✅ Global energy consumption of your Mac (must be plugged into a wall adapter).                                                                                                                            |\n| Linux       | ⚠️ Only with [RAPL](https://web.eece.maine.edu/~vweaver/projects/rapl/). See [#1](https://github.com/fvaleye/tracarbon/issues/1). It works with containers on [Kubernetes](https://kubernetes.io/) using the [Metric API](https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/#metrics-api) if available. |\n| Windows     |                                                                                                                        ❌ Not yet implemented. See [#184](https://github.com/hubblo-org/scaphandre/pull/184).                                                                                                                        |\n\n| **Cloud Provider** |                                                                                              **Description**                                                                                              |\n| ------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |\n| AWS                | ✅ Use the hardware's usage with the EC2 instances carbon emissions datasets of [cloud-carbon-coefficients](https://github.com/cloud-carbon-footprint/ccf-coefficients/blob/main/data/aws-instances.csv). |\n| GCP                |                                                                                          ❌ Not yet implemented.                                                                                          |\n| Azure              |                                                                                          ❌ Not yet implemented.                                                                                          |\n\n## 📡 Exporters\n\n| **Exporter** |          **Description**          |\n| ------------ | :-------------------------------: |\n| Stdout       |   Print the metrics in Stdout.    |\n| JSON         | Write the metrics in a JSON file. |\n| Prometheus   |  Send the metrics to Prometheus.  |\n| Datadog      |   Send the metrics to Datadog.    |\n\n### 🗺️ Locations\n\n| **Location** |                                                                              **Description**                                                                               | **Source**                                                                                                                                                    |\n| ------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| Worldwide    | Get the latest co2g/kwh in near real-time using the CO2Signal or ElectricityMaps APIs. See [here](http://api.electricitymap.org/v3/zones) for the list of available zones. | [CO2Signal API](https://www.co2signal.com) or [ElectricityMaps](https://static.electricitymaps.com/api/docs/index.html)                                       |\n| Europe       |                                 Static file created from the European Environment Agency Emission for the co2g/kwh in European countries.                                  | [EEA website](https://www.eea.europa.eu/data-and-maps/daviz/co2-emission-intensity-9#tab-googlechartid_googlechartid_googlechartid_googlechartid_chart_11111) |\n| AWS          |                                                               Static file of the AWS Grid emissions factors.                                                               | [cloud-carbon-coefficients](https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/blob/main/data/grid-emissions-factors-aws.csv)                |\n\n### ⚙️ Configuration\n\nThe environment variables can be set from an environment file `.env`.\n\n| **Parameter**                 | **Description**                                                                                                                                                                                                                                                                  |\n| ----------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| TRACARBON_CO2SIGNAL_API_KEY   | The api key received from [CO2Signal](https://www.co2signal.com) or [ElectricityMaps](https://static.electricitymaps.com/api/docs/index.html).                                                                                                                                   |\n| TRACARBON_CO2SIGNAL_URL       | The url of [CO2Signal](https://docs.co2signal.com/#get-latest-by-country-code) is the default endpoint to retrieve the last known state of the zone, but it could be changed to [ElectricityMaps](https://static.electricitymaps.com/api/docs/index.html#live-carbon-intensity). |\n| TRACARBON_METRIC_PREFIX_NAME  | The prefix to use in all the metrics name.                                                                                                                                                                                                                                       |\n| TRACARBON_INTERVAL_IN_SECONDS | The interval in seconds to wait between the metrics evaluation.                                                                                                                                                                                                                  |\n| TRACARBON_LOG_LEVEL           | The level to use for displaying the logs.                                                                                                                                                                                                                                        |\n\n## 🔎 Usage\n\n**Request your API key**\n\n- Go to [CO2Signal](https://www.co2signal.com/) and get your free API key for non-commercial use, or go to [ElectricityMaps](https://static.electricitymaps.com/api/docs/index.html) for commercial use.\n- This API is used to retrieve the last known carbon intensity (in gCO2eq/kWh) of electricity consumed in your location.\n- Set your API key in the environment variables, in the `.env` file or directly in the configuration.\n- If you would like to start without an API key, it's possible, the carbon intensity will be loaded statistically from a file.\n- Launch Tracarbon 🚀\n\n**Command Line**\n\n```sh\ntracarbon run\n```\n\n**API**\n\n```python\nfrom tracarbon import TracarbonBuilder, TracarbonConfiguration\n\nconfiguration = TracarbonConfiguration() # Your configuration\ntracarbon = TracarbonBuilder(configuration=configuration).build()\ntracarbon.start()\n# Your code\ntracarbon.stop()\n\nwith tracarbon:\n    # Your code\n\nreport = tracarbon.report() # Get the report\n```\n\n## 💻 Development\n\n**Local: using uv**\n\n```sh\nmake init\nmake test-unit\n```\n\n## 🛡️ Licence\n\n[Apache License 2.0](https://raw.githubusercontent.com/fvaleye/tracarbon/main/LICENSE.txt)\n\n## 📚 Documentation\n\nThe documentation is hosted here: https://fvaleye.github.io/tracarbon/documentation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvaleye%2Ftracarbon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffvaleye%2Ftracarbon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvaleye%2Ftracarbon/lists"}