argopy.utils.GreenCoding#
- class GreenCoding[source]#
GreenCoding API helper class for argopy carbon footprint
This class uses the Green-Coding Solutions API to retrieve CI tests energy consumption data.
This class also uses
Githubto get PRs and release information for argopy.Examples
from argopy.utils import GreenCoding GreenCoding().workflows GreenCoding().measurements(branch='master', start_date='2025-01-01') GreenCoding().measurements(branch='385/merge', start_date='2025-01-01') GreenCoding().total_measurements(branches=['master', '385/merge']) GreenCoding().footprint_for_release('v1.0.0') GreenCoding().footprint_since_last_release()
ac = GreenCoding() ac.repo = 'argopy-status' ac.workflows = [{'ID': '2724029', 'Name': 'API status'}] ac.total_measurements()
Methods
__init__()Footprint for all releases
footprint_baseline([start_date, end_date, ...])Compute the 'baseline' footprint
footprint_for_release([release, with_master])Compute total carbon footprint for a given release
footprint_since_last_release([with_master, ...])Compute total carbon footprint since the last release
measurements([branch, start_date, end_date, ...])Return measurements for a given branch and date period
shieldsio_badge(value[, label])Insert value in a Shields.io badge and return url
shieldsio_endpoint(value[, outfile, label])Insert value in a Shields.io json endpoint file
total_measurements([branches])Compute the cumulated measurements of gCO2eq for a list of branches and workflows
Attributes
ownerGithub owner parameter, default to 'euroargodev'
repoGithub repo parameter, default to 'argopy'
workflowsList of github actions workflow parameters