argopy.utils.GreenCoding

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 Github to get PRs and release information for argopy.

Examples

Listing 27 GreenCoding API#
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()
Listing 28 Get metrics for another repo#
ac = GreenCoding()
ac.repo = 'argopy-status'
ac.workflows = [{'ID': '2724029', 'Name': 'API status'}]
ac.total_measurements()
__init__()[source]#

Methods

__init__()

footprint_all_releases()

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

owner

Github owner parameter, default to 'euroargodev'

repo

Github repo parameter, default to 'argopy'

workflows

List of github actions workflow parameters