File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99env :
1010 NODE_VERSION : " 25"
11+ PYTHON_VERSION : " 3.11"
1112
1213jobs :
1314 publish :
2324 with :
2425 node-version : ${{ env.NODE_VERSION }}
2526
27+ - name : Use Python
28+ uses : actions/setup-python@v6
29+ with :
30+ python-version : ${{ env.PYTHON_VERSION }}
31+
2632 - name : Install dependencies
2733 run : npm ci
2834
35+ - name : Install CodeCarbon
36+ run : python -m pip install --upgrade pip codecarbon
37+
2938 - name : Validate tag matches package version
3039 run : |
3140 TAG_VERSION="${GITHUB_REF_NAME#v}"
Original file line number Diff line number Diff line change 77import json
88import argparse
99import os
10- from codecarbon import EmissionsTracker
1110from metrics_utils import to_number
1211
1312
1615
1716def create_tracker (emissions_file_path = None ):
1817 """Create tracker in single-run mode, optionally overriding CSV destination."""
18+ try :
19+ from codecarbon import EmissionsTracker
20+ except ModuleNotFoundError :
21+ print ("CodeCarbon Python package is not installed. Run install/repair and try again." )
22+ sys .exit (1 )
23+
1924 if not emissions_file_path :
2025 return EmissionsTracker (allow_multiple_runs = False )
2126
You can’t perform that action at this time.
0 commit comments