greenmining 1.1.3__py3-none-any.whl → 1.1.5__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 CHANGED
@@ -9,7 +9,7 @@ from greenmining.gsf_patterns import (
9
9
  is_green_aware,
10
10
  )
11
11
 
12
- __version__ = "1.1.3"
12
+ __version__ = "1.1.5"
13
13
 
14
14
 
15
15
  def fetch_repositories(
@@ -51,6 +51,8 @@ def analyze_repositories(
51
51
  include_source_code: bool = False,
52
52
  ssh_key_path: str = None,
53
53
  github_token: str = None,
54
+ since_date: str = None,
55
+ to_date: str = None,
54
56
  ):
55
57
  # Analyze multiple repositories from URLs.
56
58
  # Args:
@@ -64,8 +66,20 @@ def analyze_repositories(
64
66
  # include_source_code: Include source code before/after in results
65
67
  # ssh_key_path: SSH key path for private repositories
66
68
  # github_token: GitHub token for private HTTPS repositories
69
+ # since_date: Analyze commits from this date (YYYY-MM-DD string)
70
+ # to_date: Analyze commits up to this date (YYYY-MM-DD string)
67
71
  from greenmining.services.local_repo_analyzer import LocalRepoAnalyzer
68
72
 
73
+ kwargs = {}
74
+ if since_date:
75
+ from datetime import datetime
76
+
77
+ kwargs["since_date"] = datetime.strptime(since_date, "%Y-%m-%d")
78
+ if to_date:
79
+ from datetime import datetime
80
+
81
+ kwargs["to_date"] = datetime.strptime(to_date, "%Y-%m-%d")
82
+
69
83
  analyzer = LocalRepoAnalyzer(
70
84
  max_commits=max_commits,
71
85
  energy_tracking=energy_tracking,
@@ -74,6 +88,7 @@ def analyze_repositories(
74
88
  include_source_code=include_source_code,
75
89
  ssh_key_path=ssh_key_path,
76
90
  github_token=github_token,
91
+ **kwargs,
77
92
  )
78
93
 
79
94
  return analyzer.analyze_repositories(
@@ -204,6 +204,8 @@ class LocalRepoAnalyzer:
204
204
  method_level_analysis: bool = False,
205
205
  include_source_code: bool = False,
206
206
  process_metrics: str = "standard",
207
+ since_date: Optional[datetime] = None,
208
+ to_date: Optional[datetime] = None,
207
209
  ):
208
210
  # Initialize the local repository analyzer.
209
211
  # Args:
@@ -224,6 +226,8 @@ class LocalRepoAnalyzer:
224
226
  self.clone_path.mkdir(parents=True, exist_ok=True)
225
227
  self.max_commits = max_commits
226
228
  self.days_back = days_back
229
+ self.since_date = since_date
230
+ self.to_date = to_date
227
231
  self.skip_merges = skip_merges
228
232
  self.compute_process_metrics = compute_process_metrics
229
233
  self.cleanup_after = cleanup_after
@@ -446,7 +450,7 @@ class LocalRepoAnalyzer:
446
450
  auth_url = self._prepare_auth_url(url)
447
451
 
448
452
  # Calculate date range
449
- since_date = datetime.now() - timedelta(days=self.days_back)
453
+ since_date = self.since_date or (datetime.now() - timedelta(days=self.days_back))
450
454
 
451
455
  # Configure PyDriller Repository
452
456
  repo_config = {
@@ -454,6 +458,8 @@ class LocalRepoAnalyzer:
454
458
  "since": since_date,
455
459
  "only_no_merge": self.skip_merges,
456
460
  }
461
+ if self.to_date:
462
+ repo_config["to"] = self.to_date
457
463
 
458
464
  # Clone to specific path if needed
459
465
  local_path = self.clone_path / repo_name
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: greenmining
3
- Version: 1.1.3
3
+ Version: 1.1.5
4
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
8
8
  Project-URL: Documentation, https://github.com/adam-bouafia/greenmining#readme
9
+ Project-URL: Linkedin, https://www.linkedin.com/in/adam-bouafia/
9
10
  Project-URL: Repository, https://github.com/adam-bouafia/greenmining
10
11
  Project-URL: Issues, https://github.com/adam-bouafia/greenmining/issues
11
12
  Project-URL: Changelog, https://github.com/adam-bouafia/greenmining/blob/main/CHANGELOG.md
@@ -26,34 +27,34 @@ Classifier: Operating System :: OS Independent
26
27
  Requires-Python: >=3.9
27
28
  Description-Content-Type: text/markdown
28
29
  License-File: LICENSE
29
- Requires-Dist: PyGithub>=2.1.1
30
- Requires-Dist: PyDriller>=2.5
31
- Requires-Dist: pandas>=2.2.0
32
- Requires-Dist: colorama>=0.4.6
33
- Requires-Dist: tabulate>=0.9.0
34
- Requires-Dist: tqdm>=4.66.0
35
- Requires-Dist: matplotlib>=3.8.0
36
- Requires-Dist: plotly>=5.18.0
37
- Requires-Dist: python-dotenv>=1.0.0
38
- Requires-Dist: requests>=2.31.0
30
+ Requires-Dist: PyGithub
31
+ Requires-Dist: PyDriller
32
+ Requires-Dist: pandas
33
+ Requires-Dist: colorama
34
+ Requires-Dist: tabulate
35
+ Requires-Dist: tqdm
36
+ Requires-Dist: matplotlib
37
+ Requires-Dist: plotly
38
+ Requires-Dist: python-dotenv
39
+ Requires-Dist: requests
39
40
  Provides-Extra: dev
40
- Requires-Dist: pytest>=7.4.0; extra == "dev"
41
- Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
42
- Requires-Dist: pytest-mock>=3.12.0; extra == "dev"
43
- Requires-Dist: black>=23.12.0; extra == "dev"
44
- Requires-Dist: ruff>=0.1.9; extra == "dev"
45
- Requires-Dist: mypy>=1.8.0; extra == "dev"
46
- Requires-Dist: build>=1.0.5; extra == "dev"
47
- Requires-Dist: twine>=4.0.2; extra == "dev"
41
+ Requires-Dist: pytest; extra == "dev"
42
+ Requires-Dist: pytest-cov; extra == "dev"
43
+ Requires-Dist: pytest-mock; extra == "dev"
44
+ Requires-Dist: black; extra == "dev"
45
+ Requires-Dist: ruff; extra == "dev"
46
+ Requires-Dist: mypy; extra == "dev"
47
+ Requires-Dist: build; extra == "dev"
48
+ Requires-Dist: twine; extra == "dev"
48
49
  Provides-Extra: energy
49
- Requires-Dist: psutil>=5.9.0; extra == "energy"
50
- Requires-Dist: codecarbon>=2.3.0; extra == "energy"
50
+ Requires-Dist: psutil; extra == "energy"
51
+ Requires-Dist: codecarbon; extra == "energy"
51
52
  Provides-Extra: dashboard
52
- Requires-Dist: flask>=3.0.0; extra == "dashboard"
53
+ Requires-Dist: flask; extra == "dashboard"
53
54
  Provides-Extra: docs
54
- Requires-Dist: sphinx>=7.2.0; extra == "docs"
55
- Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == "docs"
56
- Requires-Dist: myst-parser>=2.0.0; extra == "docs"
55
+ Requires-Dist: sphinx; extra == "docs"
56
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
57
+ Requires-Dist: myst-parser; extra == "docs"
57
58
  Dynamic: license-file
58
59
 
59
60
  # greenmining
@@ -72,7 +73,7 @@ An empirical Python library for Mining Software Repositories (MSR) in Green IT r
72
73
  - **Mine repositories at scale** - Fetch and analyze GitHub repositories via GraphQL API with configurable filters
73
74
  - **Batch analysis with parallelism** - Analyze multiple repositories concurrently with configurable worker pools
74
75
  - **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
+ - **Analyze any repository by URL** - Direct Git-based analysis with support for private repositories
76
77
  - **Measure energy consumption** - RAPL, CodeCarbon, and CPU Energy Meter backends for power profiling
77
78
  - **Carbon footprint reporting** - CO2 emissions calculation with 20+ country profiles and cloud region support
78
79
  - **Power regression detection** - Identify commits that increased energy consumption
@@ -684,7 +685,7 @@ config = Config(
684
685
  - **Pattern Detection**: 122 sustainability patterns across 15 categories from the GSF catalog
685
686
  - **Keyword Analysis**: 321 green software detection keywords
686
687
  - **Repository Fetching**: GraphQL API with date, star, and language filters
687
- - **URL-Based Analysis**: Direct PyDriller analysis from GitHub URLs (HTTPS and SSH)
688
+ - **URL-Based Analysis**: Direct Git-based analysis from GitHub URLs (HTTPS and SSH)
688
689
  - **Batch Processing**: Parallel analysis of multiple repositories with configurable workers
689
690
  - **Private Repository Support**: Authentication via SSH keys or GitHub tokens
690
691
  - **Energy Measurement**: RAPL, CodeCarbon, and CPU Energy Meter backends
@@ -694,7 +695,7 @@ config = Config(
694
695
  - **Version Power Comparison**: Compare power consumption across software versions with trend detection
695
696
  - **Method-Level Analysis**: Per-method complexity metrics via Lizard integration
696
697
  - **Source Code Access**: Before/after source code for refactoring detection
697
- - **Full Process Metrics**: All 8 PyDriller process metrics (ChangeSet, CodeChurn, CommitsCount, ContributorsCount, ContributorsExperience, HistoryComplexity, HunksCount, LinesCount)
698
+ - **Full Process Metrics**: All 8 process metrics (ChangeSet, CodeChurn, CommitsCount, ContributorsCount, ContributorsExperience, HistoryComplexity, HunksCount, LinesCount)
698
699
  - **Statistical Analysis**: Correlations, effect sizes, and temporal trends
699
700
  - **Multi-format Output**: Markdown reports, CSV exports, JSON data
700
701
  - **Web Dashboard**: Flask-based interactive visualization (`pip install greenmining[dashboard]`)
@@ -848,7 +849,8 @@ ruff check greenmining/ tests/
848
849
 
849
850
  - Python 3.9+
850
851
  - PyGithub >= 2.1.1
851
- - PyDriller >= 2.5
852
+ - gitpython >= 3.1.0
853
+ - lizard >= 1.17.0
852
854
  - pandas >= 2.2.0
853
855
 
854
856
  **Optional dependencies:**
@@ -1,4 +1,4 @@
1
- greenmining/__init__.py,sha256=1dMcag7j4YJ2-7U8R0rKPDYw9aPiOEcZN2HE0UUoD-8,2909
1
+ greenmining/__init__.py,sha256=1TrBIx5HvQhay8_08G-PggpKeGe3zM061Y27Jy_fEcI,3390
2
2
  greenmining/__main__.py,sha256=NYOVS7D4w2XDLn6SyXHXPKE5GrNGOeoWSTb_KazgK5c,590
3
3
  greenmining/__version__.py,sha256=xZc02a8bS3vUJlzh8k9RoxemB1irQmq_SpVVj6Cg5M0,62
4
4
  greenmining/config.py,sha256=M4a7AwM1ErCmOY0n5Vmyoo9HPblSkTZ-HD3k2YHzs4A,8340
@@ -35,10 +35,10 @@ greenmining/services/data_aggregator.py,sha256=TsFT0oGOnnHk0QGZ1tT6ZhKGc5X1H1D1u
35
35
  greenmining/services/data_analyzer.py,sha256=f0nlJkPAclHHCzzTyQW5bjhYrgE0XXiR1x7_o3fJaDs,9732
36
36
  greenmining/services/github_fetcher.py,sha256=sdkS-LhHmX7mgMdlClCwEUVnZrItc0Pt6FVtlWk5iLU,106
37
37
  greenmining/services/github_graphql_fetcher.py,sha256=ZklXdEAc60KeFL83zRYMwW_-2OwMKpfPY7Wrifl0D50,11539
38
- greenmining/services/local_repo_analyzer.py,sha256=5DMN9RIyGXNdsOlIDV4Mp0fPavbB69oBA9us17P5cNo,24668
38
+ greenmining/services/local_repo_analyzer.py,sha256=N3QT7qLKT7ddvOhygJfUG5eMGcHIGeVevuleHB0oCN8,24918
39
39
  greenmining/services/reports.py,sha256=Vrw_pBNmVw2mTAf1dpcAqjBe6gXv-O4w_XweoVTt7L8,23392
40
- greenmining-1.1.3.dist-info/licenses/LICENSE,sha256=M7ma3JHGeiIZIs3ea0HTcFl_wLFPX2NZElUliYs4bCA,1083
41
- greenmining-1.1.3.dist-info/METADATA,sha256=sOT7LZIKKr1GtCg9BmFfoahQKeqzuNQ5ysgaYBKxc1U,30913
42
- greenmining-1.1.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
43
- greenmining-1.1.3.dist-info/top_level.txt,sha256=nreXgXxZIWI-42yQknQ0HXtUrFnzZ8N1ra4Mdy2KcsI,12
44
- greenmining-1.1.3.dist-info/RECORD,,
40
+ greenmining-1.1.5.dist-info/licenses/LICENSE,sha256=M7ma3JHGeiIZIs3ea0HTcFl_wLFPX2NZElUliYs4bCA,1083
41
+ greenmining-1.1.5.dist-info/METADATA,sha256=MMoin-BR4dQGdzPploVH2GIpCQY9NGnDT-I6X_C1mfw,30811
42
+ greenmining-1.1.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
43
+ greenmining-1.1.5.dist-info/top_level.txt,sha256=nreXgXxZIWI-42yQknQ0HXtUrFnzZ8N1ra4Mdy2KcsI,12
44
+ greenmining-1.1.5.dist-info/RECORD,,