greenmining 0.1.10__py3-none-any.whl → 0.1.12__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 +42 -1
- greenmining/cli.py +9 -3
- greenmining/controllers/repository_controller.py +10 -3
- greenmining/gsf_patterns.py +795 -2
- {greenmining-0.1.10.dist-info → greenmining-0.1.12.dist-info}/METADATA +174 -38
- {greenmining-0.1.10.dist-info → greenmining-0.1.12.dist-info}/RECORD +10 -10
- {greenmining-0.1.10.dist-info → greenmining-0.1.12.dist-info}/WHEEL +0 -0
- {greenmining-0.1.10.dist-info → greenmining-0.1.12.dist-info}/entry_points.txt +0 -0
- {greenmining-0.1.10.dist-info → greenmining-0.1.12.dist-info}/licenses/LICENSE +0 -0
- {greenmining-0.1.10.dist-info → greenmining-0.1.12.dist-info}/top_level.txt +0 -0
greenmining/__init__.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Green Microservices Mining - GSF Pattern Analysis Tool."""
|
|
2
2
|
|
|
3
3
|
from greenmining.config import Config
|
|
4
|
+
from greenmining.controllers.repository_controller import RepositoryController
|
|
4
5
|
from greenmining.gsf_patterns import (
|
|
5
6
|
GREEN_KEYWORDS,
|
|
6
7
|
GSF_PATTERNS,
|
|
@@ -8,7 +9,46 @@ from greenmining.gsf_patterns import (
|
|
|
8
9
|
is_green_aware,
|
|
9
10
|
)
|
|
10
11
|
|
|
11
|
-
__version__ = "0.1.
|
|
12
|
+
__version__ = "0.1.12"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def fetch_repositories(
|
|
16
|
+
github_token: str,
|
|
17
|
+
max_repos: int = 100,
|
|
18
|
+
min_stars: int = 100,
|
|
19
|
+
languages: list = None,
|
|
20
|
+
keywords: str = "microservices",
|
|
21
|
+
):
|
|
22
|
+
"""Fetch repositories from GitHub with custom search keywords.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
github_token: GitHub personal access token
|
|
26
|
+
max_repos: Maximum number of repositories to fetch (default: 100)
|
|
27
|
+
min_stars: Minimum GitHub stars required (default: 100)
|
|
28
|
+
languages: List of programming languages to filter (default: ["Python", "Java", "Go", "JavaScript", "TypeScript"])
|
|
29
|
+
keywords: Search keywords (default: "microservices")
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
List of Repository model instances
|
|
33
|
+
|
|
34
|
+
Example:
|
|
35
|
+
>>> from greenmining import fetch_repositories
|
|
36
|
+
>>> repos = fetch_repositories(
|
|
37
|
+
... github_token="your_token",
|
|
38
|
+
... max_repos=50,
|
|
39
|
+
... keywords="kubernetes cloud-native",
|
|
40
|
+
... min_stars=500
|
|
41
|
+
... )
|
|
42
|
+
>>> print(f"Found {len(repos)} repositories")
|
|
43
|
+
"""
|
|
44
|
+
config = Config()
|
|
45
|
+
config.GITHUB_TOKEN = github_token
|
|
46
|
+
controller = RepositoryController(config)
|
|
47
|
+
|
|
48
|
+
return controller.fetch_repositories(
|
|
49
|
+
max_repos=max_repos, min_stars=min_stars, languages=languages, keywords=keywords
|
|
50
|
+
)
|
|
51
|
+
|
|
12
52
|
|
|
13
53
|
__all__ = [
|
|
14
54
|
"Config",
|
|
@@ -16,5 +56,6 @@ __all__ = [
|
|
|
16
56
|
"GREEN_KEYWORDS",
|
|
17
57
|
"is_green_aware",
|
|
18
58
|
"get_pattern_by_keywords",
|
|
59
|
+
"fetch_repositories",
|
|
19
60
|
"__version__",
|
|
20
61
|
]
|
greenmining/cli.py
CHANGED
|
@@ -29,8 +29,14 @@ def cli(config_file, verbose):
|
|
|
29
29
|
@click.option(
|
|
30
30
|
"--languages", default="Python,Java,Go,JavaScript,TypeScript", help="Comma-separated languages"
|
|
31
31
|
)
|
|
32
|
-
|
|
33
|
-
""
|
|
32
|
+
@click.option(
|
|
33
|
+
"--keywords",
|
|
34
|
+
default="microservices",
|
|
35
|
+
type=str,
|
|
36
|
+
help="Search keywords (e.g., 'kubernetes', 'docker', 'cloud-native')",
|
|
37
|
+
)
|
|
38
|
+
def fetch(max_repos, min_stars, languages, keywords):
|
|
39
|
+
"""Fetch repositories from GitHub based on custom search keywords."""
|
|
34
40
|
presenter.show_banner()
|
|
35
41
|
colored_print(f"\n🎯 Target: {max_repos} repositories\n", "cyan")
|
|
36
42
|
|
|
@@ -39,7 +45,7 @@ def fetch(max_repos, min_stars, languages):
|
|
|
39
45
|
|
|
40
46
|
try:
|
|
41
47
|
repositories = controller.fetch_repositories(
|
|
42
|
-
max_repos=max_repos, min_stars=min_stars, languages=lang_list
|
|
48
|
+
max_repos=max_repos, min_stars=min_stars, languages=lang_list, keywords=keywords
|
|
43
49
|
)
|
|
44
50
|
|
|
45
51
|
# Show results
|
|
@@ -17,7 +17,11 @@ class RepositoryController:
|
|
|
17
17
|
self.github = Github(config.GITHUB_TOKEN)
|
|
18
18
|
|
|
19
19
|
def fetch_repositories(
|
|
20
|
-
self,
|
|
20
|
+
self,
|
|
21
|
+
max_repos: int = None,
|
|
22
|
+
min_stars: int = None,
|
|
23
|
+
languages: list[str] = None,
|
|
24
|
+
keywords: str = None,
|
|
21
25
|
) -> list[Repository]:
|
|
22
26
|
"""Fetch repositories from GitHub.
|
|
23
27
|
|
|
@@ -25,6 +29,7 @@ class RepositoryController:
|
|
|
25
29
|
max_repos: Maximum number of repositories to fetch
|
|
26
30
|
min_stars: Minimum stars filter
|
|
27
31
|
languages: List of programming languages to filter
|
|
32
|
+
keywords: Custom search keywords (default: "microservices")
|
|
28
33
|
|
|
29
34
|
Returns:
|
|
30
35
|
List of Repository model instances
|
|
@@ -32,12 +37,14 @@ class RepositoryController:
|
|
|
32
37
|
max_repos = max_repos or self.config.MAX_REPOS
|
|
33
38
|
min_stars = min_stars or self.config.MIN_STARS
|
|
34
39
|
languages = languages or self.config.SUPPORTED_LANGUAGES
|
|
40
|
+
keywords = keywords or "microservices"
|
|
35
41
|
|
|
36
42
|
colored_print(f"🔍 Fetching up to {max_repos} repositories...", "cyan")
|
|
43
|
+
colored_print(f" Keywords: {keywords}", "cyan")
|
|
37
44
|
colored_print(f" Filters: min_stars={min_stars}", "cyan")
|
|
38
45
|
|
|
39
|
-
# Build search query
|
|
40
|
-
query = f"
|
|
46
|
+
# Build search query with custom keywords
|
|
47
|
+
query = f"{keywords} stars:>={min_stars}"
|
|
41
48
|
|
|
42
49
|
try:
|
|
43
50
|
# Execute search
|