greenmining 1.0.5__py3-none-any.whl → 1.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- greenmining/__init__.py +46 -2
- greenmining/analyzers/__init__.py +9 -0
- greenmining/analyzers/metrics_power_correlator.py +165 -0
- greenmining/analyzers/power_regression.py +212 -0
- greenmining/analyzers/version_power_analyzer.py +246 -0
- greenmining/config.py +46 -34
- greenmining/dashboard/__init__.py +5 -0
- greenmining/dashboard/app.py +200 -0
- greenmining/energy/__init__.py +8 -1
- greenmining/energy/base.py +45 -35
- greenmining/energy/carbon_reporter.py +242 -0
- greenmining/energy/codecarbon_meter.py +25 -24
- greenmining/energy/cpu_meter.py +144 -0
- greenmining/energy/rapl.py +30 -36
- greenmining/services/__init__.py +13 -3
- greenmining/services/commit_extractor.py +9 -5
- greenmining/services/local_repo_analyzer.py +325 -63
- greenmining/services/reports.py +5 -8
- {greenmining-1.0.5.dist-info → greenmining-1.0.6.dist-info}/METADATA +57 -32
- {greenmining-1.0.5.dist-info → greenmining-1.0.6.dist-info}/RECORD +23 -16
- {greenmining-1.0.5.dist-info → greenmining-1.0.6.dist-info}/WHEEL +0 -0
- {greenmining-1.0.5.dist-info → greenmining-1.0.6.dist-info}/licenses/LICENSE +0 -0
- {greenmining-1.0.5.dist-info → greenmining-1.0.6.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: greenmining
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 1.0.6
|
|
4
|
+
Summary: An empirical Python library for Mining Software Repositories (MSR) in Green IT research
|
|
5
5
|
Author-email: Adam Bouafia <a.bouafia@student.vu.nl>
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/adam-bouafia/greenmining
|
|
@@ -9,7 +9,7 @@ Project-URL: Documentation, https://github.com/adam-bouafia/greenmining#readme
|
|
|
9
9
|
Project-URL: Repository, https://github.com/adam-bouafia/greenmining
|
|
10
10
|
Project-URL: Issues, https://github.com/adam-bouafia/greenmining/issues
|
|
11
11
|
Project-URL: Changelog, https://github.com/adam-bouafia/greenmining/blob/main/CHANGELOG.md
|
|
12
|
-
Keywords: green-software,gsf,sustainability,carbon-footprint,
|
|
12
|
+
Keywords: green-software,gsf,msr,mining-software-repositories,green-it,sustainability,carbon-footprint,energy-efficiency,repository-analysis,github-analysis,pydriller,empirical-software-engineering
|
|
13
13
|
Classifier: Development Status :: 3 - Alpha
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -45,6 +45,11 @@ Requires-Dist: ruff>=0.1.9; extra == "dev"
|
|
|
45
45
|
Requires-Dist: mypy>=1.8.0; extra == "dev"
|
|
46
46
|
Requires-Dist: build>=1.0.5; extra == "dev"
|
|
47
47
|
Requires-Dist: twine>=4.0.2; extra == "dev"
|
|
48
|
+
Provides-Extra: energy
|
|
49
|
+
Requires-Dist: psutil>=5.9.0; extra == "energy"
|
|
50
|
+
Requires-Dist: codecarbon>=2.3.0; extra == "energy"
|
|
51
|
+
Provides-Extra: dashboard
|
|
52
|
+
Requires-Dist: flask>=3.0.0; extra == "dashboard"
|
|
48
53
|
Provides-Extra: docs
|
|
49
54
|
Requires-Dist: sphinx>=7.2.0; extra == "docs"
|
|
50
55
|
Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == "docs"
|
|
@@ -53,15 +58,30 @@ Dynamic: license-file
|
|
|
53
58
|
|
|
54
59
|
# greenmining
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
An empirical Python library for Mining Software Repositories (MSR) in Green IT research.
|
|
57
62
|
|
|
58
63
|
[](https://pypi.org/project/greenmining/)
|
|
59
64
|
[](https://pypi.org/project/greenmining/)
|
|
60
65
|
[](LICENSE)
|
|
66
|
+
[](https://greenmining.readthedocs.io/)
|
|
61
67
|
|
|
62
68
|
## Overview
|
|
63
69
|
|
|
64
|
-
`greenmining` is a Python library for
|
|
70
|
+
`greenmining` is a research-grade Python library designed for **empirical Mining Software Repositories (MSR)** studies in **Green IT**. It enables researchers and practitioners to:
|
|
71
|
+
|
|
72
|
+
- **Mine repositories at scale** - Fetch and analyze GitHub repositories via GraphQL API with configurable filters
|
|
73
|
+
- **Batch analysis with parallelism** - Analyze multiple repositories concurrently with configurable worker pools
|
|
74
|
+
- **Classify green commits** - Detect 122 sustainability patterns from the Green Software Foundation (GSF) catalog
|
|
75
|
+
- **Analyze any repository by URL** - Direct PyDriller-based analysis with support for private repositories
|
|
76
|
+
- **Measure energy consumption** - RAPL, CodeCarbon, and CPU Energy Meter backends for power profiling
|
|
77
|
+
- **Carbon footprint reporting** - CO2 emissions calculation with 20+ country profiles and cloud region support
|
|
78
|
+
- **Power regression detection** - Identify commits that increased energy consumption
|
|
79
|
+
- **Method-level analysis** - Per-method complexity and metrics via Lizard integration
|
|
80
|
+
- **Version power comparison** - Compare power consumption across software versions
|
|
81
|
+
- **Generate research datasets** - Statistical analysis, temporal trends, and publication-ready reports
|
|
82
|
+
- **Web dashboard** - Flask-based interactive visualization of analysis results
|
|
83
|
+
|
|
84
|
+
Whether you're conducting MSR research, analyzing green software adoption, or measuring the energy footprint of codebases, GreenMining provides the empirical toolkit you need.
|
|
65
85
|
|
|
66
86
|
## Installation
|
|
67
87
|
|
|
@@ -553,38 +573,44 @@ greenmining includes built-in energy measurement capabilities for tracking the c
|
|
|
553
573
|
|---------|----------|---------|--------------|
|
|
554
574
|
| **RAPL** | Linux (Intel/AMD) | CPU/RAM energy (Joules) | `/sys/class/powercap/` access |
|
|
555
575
|
| **CodeCarbon** | Cross-platform | Energy + Carbon emissions (gCO2) | `pip install codecarbon` |
|
|
576
|
+
| **CPU Meter** | All platforms | Estimated CPU energy (Joules) | Optional: `pip install psutil` |
|
|
577
|
+
| **Auto** | All platforms | Best available backend | Automatic detection |
|
|
556
578
|
|
|
557
579
|
#### Python API
|
|
558
580
|
|
|
559
581
|
```python
|
|
560
|
-
from greenmining.energy import RAPLEnergyMeter,
|
|
561
|
-
|
|
562
|
-
#
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
#
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
print(f"Energy: {result.energy_joules:.2f} J")
|
|
577
|
-
print(f"Carbon: {result.carbon_grams:.4f} gCO2")
|
|
582
|
+
from greenmining.energy import RAPLEnergyMeter, CPUEnergyMeter, get_energy_meter
|
|
583
|
+
|
|
584
|
+
# Auto-detect best backend
|
|
585
|
+
meter = get_energy_meter("auto")
|
|
586
|
+
meter.start()
|
|
587
|
+
# ... run analysis ...
|
|
588
|
+
result = meter.stop()
|
|
589
|
+
print(f"Energy: {result.joules:.2f} J")
|
|
590
|
+
print(f"Power: {result.watts_avg:.2f} W")
|
|
591
|
+
|
|
592
|
+
# Integrated energy tracking during analysis
|
|
593
|
+
from greenmining.services.local_repo_analyzer import LocalRepoAnalyzer
|
|
594
|
+
|
|
595
|
+
analyzer = LocalRepoAnalyzer(energy_tracking=True, energy_backend="auto")
|
|
596
|
+
result = analyzer.analyze_repository("https://github.com/pallets/flask")
|
|
597
|
+
print(f"Analysis energy: {result.energy_metrics['joules']:.2f} J")
|
|
578
598
|
```
|
|
579
599
|
|
|
580
|
-
####
|
|
600
|
+
#### Carbon Footprint Reporting
|
|
601
|
+
|
|
602
|
+
```python
|
|
603
|
+
from greenmining.energy import CarbonReporter
|
|
581
604
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
-
|
|
586
|
-
|
|
587
|
-
|
|
605
|
+
reporter = CarbonReporter(
|
|
606
|
+
country_iso="USA",
|
|
607
|
+
cloud_provider="aws",
|
|
608
|
+
region="us-east-1",
|
|
609
|
+
)
|
|
610
|
+
report = reporter.generate_report(total_joules=3600.0)
|
|
611
|
+
print(f"CO2: {report.total_emissions_kg * 1000:.4f} grams")
|
|
612
|
+
print(f"Equivalent: {report.tree_months:.2f} tree-months to offset")
|
|
613
|
+
```
|
|
588
614
|
|
|
589
615
|
### Pattern Database
|
|
590
616
|
|
|
@@ -686,8 +712,7 @@ ruff check greenmining/ tests/
|
|
|
686
712
|
- Python 3.9+
|
|
687
713
|
- PyGithub >= 2.1.1
|
|
688
714
|
- PyDriller >= 2.5
|
|
689
|
-
- pandas >= 2.2.0
|
|
690
|
-
- click >= 8.1.7
|
|
715
|
+
- pandas >= 2.2.0
|
|
691
716
|
- codecarbon >= 2.0.0 (optional, for cross-platform energy measurement)
|
|
692
717
|
|
|
693
718
|
## License
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
greenmining/__init__.py,sha256=
|
|
1
|
+
greenmining/__init__.py,sha256=wbMwJYwC1HKIPn4w5N6Ux8GV5fAohevW7iO_BYuFuA4,2637
|
|
2
2
|
greenmining/__main__.py,sha256=NYOVS7D4w2XDLn6SyXHXPKE5GrNGOeoWSTb_KazgK5c,590
|
|
3
3
|
greenmining/__version__.py,sha256=xZc02a8bS3vUJlzh8k9RoxemB1irQmq_SpVVj6Cg5M0,62
|
|
4
|
-
greenmining/config.py,sha256=
|
|
4
|
+
greenmining/config.py,sha256=M4a7AwM1ErCmOY0n5Vmyoo9HPblSkTZ-HD3k2YHzs4A,8340
|
|
5
5
|
greenmining/gsf_patterns.py,sha256=hnd9GuWB8GEflrusEib5hjvl8CD5TSbGcBtb0gfxFp4,54193
|
|
6
6
|
greenmining/utils.py,sha256=dSFwQzQwbS8rYZSgwLIxM_geLqbldwqVOIXMqEg08Qs,5609
|
|
7
|
-
greenmining/analyzers/__init__.py,sha256=
|
|
7
|
+
greenmining/analyzers/__init__.py,sha256=rTgpDfFE6za4QAHW59ncnS6TW02omn-TZMnYNVUIZp0,753
|
|
8
8
|
greenmining/analyzers/code_diff_analyzer.py,sha256=1dk68R3O0RZG8gx1cm9B_UlZ1Uwyb_Q3oScRbCVx4tM,10950
|
|
9
|
+
greenmining/analyzers/metrics_power_correlator.py,sha256=qMKr4hSTzT0Un3vsGZNkPCp9TxyzdFwrhjw5M1IKOgk,5964
|
|
10
|
+
greenmining/analyzers/power_regression.py,sha256=5pxs7IoTtGcwwX5KzGeM5hOm2I9Axr-0X4N_4007iMw,7387
|
|
9
11
|
greenmining/analyzers/qualitative_analyzer.py,sha256=RcjOMLj_DPH869ey9J0uI7JK_krCefMhNkPLOJUDFF8,15391
|
|
10
12
|
greenmining/analyzers/statistical_analyzer.py,sha256=DzWAcCyw42Ig3FIxTwPPBikgt2uzMdktxklonOYfnOk,7166
|
|
11
13
|
greenmining/analyzers/temporal_analyzer.py,sha256=JfTcAoI20oCFMehGrSRnDqhJTXI-RUbdCTMwDOTW9-g,14259
|
|
14
|
+
greenmining/analyzers/version_power_analyzer.py,sha256=2P6zOqBg-ButtIhF-4cutiwD2Q1geMY49VFUghHXXoI,8119
|
|
12
15
|
greenmining/controllers/__init__.py,sha256=UiAT6zBvC1z_9cJWfzq1cLA0I4r9b2vURHipj8oDczI,180
|
|
13
16
|
greenmining/controllers/repository_controller.py,sha256=fyL6Y8xpoixDplP4_rKWiwak42M2DaIihzyKVaBlivA,9680
|
|
14
|
-
greenmining/
|
|
15
|
-
greenmining/
|
|
16
|
-
greenmining/energy/
|
|
17
|
-
greenmining/energy/
|
|
17
|
+
greenmining/dashboard/__init__.py,sha256=Ig_291-hLrH9k3rV0whhQ1EkhiaRR8ciHiJ5s5OCBf4,141
|
|
18
|
+
greenmining/dashboard/app.py,sha256=Hk6_i2qmcg6SGW7UzxglEIvUBJiloRA-hMYI-YSORcA,8604
|
|
19
|
+
greenmining/energy/__init__.py,sha256=GoCYh7hitWBoPMtan1HF1yezCHi7o4sa_YUJgGkeJc8,558
|
|
20
|
+
greenmining/energy/base.py,sha256=mVdp-E04KWu3UnHFL61pzrI-OP-KsUshAmXHwgsJkRU,5749
|
|
21
|
+
greenmining/energy/carbon_reporter.py,sha256=bKIFlLhHfYzI4DBu_ff4GW1Psz4oSCAF4NmzQb-EShA,8298
|
|
22
|
+
greenmining/energy/codecarbon_meter.py,sha256=HyQptyEaS1ZMu_qdxg0Tyuly1PCmmbbNwwYX8qYsTs4,4927
|
|
23
|
+
greenmining/energy/cpu_meter.py,sha256=mhEG3Y7fjz3wV5lojcYeFXvCXXgmelGQaBfN2q7yTNc,5007
|
|
24
|
+
greenmining/energy/rapl.py,sha256=b63M1mS7uF9Uo0vFi0z7Qwdo56U1TqxIYQXINhYp9Jo,5292
|
|
18
25
|
greenmining/models/__init__.py,sha256=2hkB0quhMePvvA1AkYfj5uiF_HyGtXVxn0BU-5m_oSg,302
|
|
19
26
|
greenmining/models/aggregated_stats.py,sha256=N-ZGcQO7IJ33Joa8luMVjtHhKYzNe48VW8hFqs9a5Jc,1016
|
|
20
27
|
greenmining/models/analysis_result.py,sha256=YICTCEcrJxZ1R8Xaio3AZOjCGwMzC_62BMAL0J_XY1w,1509
|
|
@@ -22,16 +29,16 @@ greenmining/models/commit.py,sha256=mnRDWSiIyGtJeGXI8sav9hukWUyVFpoNe6GixRlZjY4,
|
|
|
22
29
|
greenmining/models/repository.py,sha256=SKjS01onOptpMioumtAPZxKpKheHAeVXnXyvatl7CfM,2856
|
|
23
30
|
greenmining/presenters/__init__.py,sha256=d1CMtqtUAHYHYNzigPyjtGOUtnH1drtUwf7-bFQq2B8,138
|
|
24
31
|
greenmining/presenters/console_presenter.py,sha256=XOahvlcr4qLbUdhk8cGq1ZWagvemEd3Wgriu8T5EI3s,4896
|
|
25
|
-
greenmining/services/__init__.py,sha256=
|
|
26
|
-
greenmining/services/commit_extractor.py,sha256=
|
|
32
|
+
greenmining/services/__init__.py,sha256=ZEMOVut0KRdume_vz58beSNps3YgeoGBXmUjEqNgIhc,690
|
|
33
|
+
greenmining/services/commit_extractor.py,sha256=Fz2WTWjIZ_vQhSfkJKnWpJnBpI2nm0KacA4qYAvCpSE,8451
|
|
27
34
|
greenmining/services/data_aggregator.py,sha256=TsFT0oGOnnHk0QGZ1tT6ZhKGc5X1H1D1u7-7OpiPo7Y,19566
|
|
28
35
|
greenmining/services/data_analyzer.py,sha256=f0nlJkPAclHHCzzTyQW5bjhYrgE0XXiR1x7_o3fJaDs,9732
|
|
29
36
|
greenmining/services/github_fetcher.py,sha256=mUcmQevhdDRYX72O-M7Vi-s3y4ZwNyKewleti838cqU,8285
|
|
30
37
|
greenmining/services/github_graphql_fetcher.py,sha256=p76vp5EgStzkmTcws__jb90za8m61toW0CBrwrm5Ew4,11972
|
|
31
|
-
greenmining/services/local_repo_analyzer.py,sha256=
|
|
32
|
-
greenmining/services/reports.py,sha256=
|
|
33
|
-
greenmining-1.0.
|
|
34
|
-
greenmining-1.0.
|
|
35
|
-
greenmining-1.0.
|
|
36
|
-
greenmining-1.0.
|
|
37
|
-
greenmining-1.0.
|
|
38
|
+
greenmining/services/local_repo_analyzer.py,sha256=5DMN9RIyGXNdsOlIDV4Mp0fPavbB69oBA9us17P5cNo,24668
|
|
39
|
+
greenmining/services/reports.py,sha256=Vrw_pBNmVw2mTAf1dpcAqjBe6gXv-O4w_XweoVTt7L8,23392
|
|
40
|
+
greenmining-1.0.6.dist-info/licenses/LICENSE,sha256=M7ma3JHGeiIZIs3ea0HTcFl_wLFPX2NZElUliYs4bCA,1083
|
|
41
|
+
greenmining-1.0.6.dist-info/METADATA,sha256=cd82RQon4bIBdJT85mcCeZuXL3evl4N9YkcqywDw41k,26920
|
|
42
|
+
greenmining-1.0.6.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
43
|
+
greenmining-1.0.6.dist-info/top_level.txt,sha256=nreXgXxZIWI-42yQknQ0HXtUrFnzZ8N1ra4Mdy2KcsI,12
|
|
44
|
+
greenmining-1.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|