llama-github 0.3.2__tar.gz → 0.3.3__tar.gz

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.
Files changed (40) hide show
  1. {llama_github-0.3.2 → llama_github-0.3.3}/CHANGELOG.md +5 -0
  2. {llama_github-0.3.2/llama_github.egg-info → llama_github-0.3.3}/PKG-INFO +38 -1
  3. {llama_github-0.3.2 → llama_github-0.3.3}/README.md +32 -0
  4. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/utils.py +97 -6
  5. llama_github-0.3.3/llama_github/version.py +1 -0
  6. {llama_github-0.3.2 → llama_github-0.3.3/llama_github.egg-info}/PKG-INFO +38 -1
  7. {llama_github-0.3.2 → llama_github-0.3.3}/setup.cfg +1 -1
  8. llama_github-0.3.2/llama_github/version.py +0 -1
  9. {llama_github-0.3.2 → llama_github-0.3.3}/LICENSE +0 -0
  10. {llama_github-0.3.2 → llama_github-0.3.3}/MANIFEST.in +0 -0
  11. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/__init__.py +0 -0
  12. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/config/__init__.py +0 -0
  13. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/config/config.json +0 -0
  14. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/config/config.py +0 -0
  15. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/data_retrieval/__init__.py +0 -0
  16. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/data_retrieval/github_api.py +0 -0
  17. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/data_retrieval/github_entities.py +0 -0
  18. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/features/__init__.py +0 -0
  19. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/features/feature_flags.py +0 -0
  20. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/features/insider_features.py +0 -0
  21. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/github_integration/__init__.py +0 -0
  22. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/github_integration/github_auth_manager.py +0 -0
  23. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/github_rag.py +0 -0
  24. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/llm_integration/__init__.py +0 -0
  25. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/llm_integration/initial_load.py +0 -0
  26. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/llm_integration/llm_handler.py +0 -0
  27. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/logger.py +0 -0
  28. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/rag_processing/__init__.py +0 -0
  29. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github/rag_processing/rag_processor.py +0 -0
  30. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github.egg-info/SOURCES.txt +0 -0
  31. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github.egg-info/dependency_links.txt +0 -0
  32. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github.egg-info/requires.txt +0 -0
  33. {llama_github-0.3.2 → llama_github-0.3.3}/llama_github.egg-info/top_level.txt +0 -0
  34. {llama_github-0.3.2 → llama_github-0.3.3}/setup.py +0 -0
  35. {llama_github-0.3.2 → llama_github-0.3.3}/tests/test_data_retrieval.py +0 -0
  36. {llama_github-0.3.2 → llama_github-0.3.3}/tests/test_github_auth_manager.py +0 -0
  37. {llama_github-0.3.2 → llama_github-0.3.3}/tests/test_initial_load.py +0 -0
  38. {llama_github-0.3.2 → llama_github-0.3.3}/tests/test_llm_handler.py +0 -0
  39. {llama_github-0.3.2 → llama_github-0.3.3}/tests/test_logger.py +0 -0
  40. {llama_github-0.3.2 → llama_github-0.3.3}/tests/test_rag_processor.py +0 -0
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.3] - 2025-08-24
9
+
10
+ ### Optimized
11
+ - Enhance diff hunk header
12
+
8
13
  ## [0.3.2] - 2025-06-23
9
14
 
10
15
  ### Optimized
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llama-github
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Llama-github is an open-source Python library that empowers LLM Chatbots, AI Agents, and Auto-dev Agents to conduct Retrieval from actively selected GitHub public projects. It Augments through LLMs and Generates context for any coding question, in order to streamline the development of sophisticated AI-driven applications.
5
5
  Home-page: https://github.com/JetXu-LLM/llama-github
6
6
  Author: Jet Xu
@@ -32,6 +32,38 @@ Requires-Dist: flake8; extra == "dev"
32
32
  Dynamic: license-file
33
33
  Dynamic: requires-dist
34
34
 
35
+
36
+ <div align="right">
37
+ <details>
38
+ <summary >🌐 Language</summary>
39
+ <div>
40
+ <div align="center">
41
+ <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=en">English</a>
42
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-CN">简体中文</a>
43
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-TW">繁體中文</a>
44
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ja">日本語</a>
45
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ko">한국어</a>
46
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=hi">हिन्दी</a>
47
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=th">ไทย</a>
48
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fr">Français</a>
49
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=de">Deutsch</a>
50
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=es">Español</a>
51
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=it">Italiano</a>
52
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ru">Русский</a>
53
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pt">Português</a>
54
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=nl">Nederlands</a>
55
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pl">Polski</a>
56
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ar">العربية</a>
57
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fa">فارسی</a>
58
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=tr">Türkçe</a>
59
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=vi">Tiếng Việt</a>
60
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=id">Bahasa Indonesia</a>
61
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=as">অসমীয়া</
62
+ </div>
63
+ </div>
64
+ </details>
65
+ </div>
66
+
35
67
  # llama-github
36
68
 
37
69
  [Detail Document] https://deepwiki.com/JetXu-LLM/llama-github
@@ -156,6 +188,11 @@ All notable changes to this project will be documented in this file.
156
188
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
157
189
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
158
190
 
191
+ ## [0.3.3] - 2025-08-24
192
+
193
+ ### Optimized
194
+ - Enhance diff hunk header
195
+
159
196
  ## [0.3.2] - 2025-06-23
160
197
 
161
198
  ### Optimized
@@ -1,3 +1,35 @@
1
+
2
+ <div align="right">
3
+ <details>
4
+ <summary >🌐 Language</summary>
5
+ <div>
6
+ <div align="center">
7
+ <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=en">English</a>
8
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-CN">简体中文</a>
9
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-TW">繁體中文</a>
10
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ja">日本語</a>
11
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ko">한국어</a>
12
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=hi">हिन्दी</a>
13
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=th">ไทย</a>
14
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fr">Français</a>
15
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=de">Deutsch</a>
16
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=es">Español</a>
17
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=it">Italiano</a>
18
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ru">Русский</a>
19
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pt">Português</a>
20
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=nl">Nederlands</a>
21
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pl">Polski</a>
22
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ar">العربية</a>
23
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fa">فارسی</a>
24
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=tr">Türkçe</a>
25
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=vi">Tiếng Việt</a>
26
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=id">Bahasa Indonesia</a>
27
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=as">অসমীয়া</
28
+ </div>
29
+ </div>
30
+ </details>
31
+ </div>
32
+
1
33
  # llama-github
2
34
 
3
35
  [Detail Document] https://deepwiki.com/JetXu-LLM/llama-github
@@ -11,12 +11,49 @@ import ast
11
11
  class DiffGenerator:
12
12
  """
13
13
  A class for generating custom diffs between two pieces of content.
14
+ It enhances the standard unified diff by adding function/class context to hunk headers,
15
+ similar to `git diff`, in a fail-safe manner.
14
16
  """
15
17
 
18
+ # A pre-compiled list of regex patterns to find function/class definitions.
19
+ # This is the core mechanism that mimics Git's `xfuncname` feature.
20
+ # It covers a wide range of common languages to provide broad, out-of-the-box support.
21
+ _FUNC_CONTEXT_PATTERNS = [
22
+ re.compile(r'^\s*(def|class)\s+.*', re.IGNORECASE), # Python
23
+ re.compile(r'^\s*(public|private|protected|static|final|native|synchronized|abstract|transient|volatile|strictfp|async|function|class|interface|enum|@|implements|extends)'), # Java, JS, TS, PHP, C#
24
+ re.compile(r'^\s*(func|fn|impl|trait|struct|enum|mod)\s+.*', re.IGNORECASE), # Go, Rust
25
+ re.compile(r'^\s*(def|class|module)\s+.*', re.IGNORECASE), # Ruby
26
+ re.compile(r'^\s*([a-zA-Z_][a-zA-Z0-9_]*\s+)*[a-zA-Z_][a-zA-Z0-9_]*\s*\(.*\)\s*\{'), # C, C++ style function definitions
27
+ re.compile(r'^sub\s+.*'), # Perl
28
+ ]
29
+
30
+ @staticmethod
31
+ def _find_context(line_index: int, lines: List[str]) -> str:
32
+ """
33
+ Search upwards from a given line index to find the nearest function/class context.
34
+
35
+ Args:
36
+ line_index (int): The 0-based index to start searching upwards from.
37
+ lines (List[str]): The content of the file, as a list of lines.
38
+
39
+ Returns:
40
+ str: The found context line, stripped of whitespace, or an empty string if not found.
41
+ """
42
+ # Search from the target line upwards to the beginning of the file.
43
+ for i in range(line_index, -1, -1):
44
+ line = lines[i]
45
+ # Check the line against all our predefined patterns.
46
+ for pattern in DiffGenerator._FUNC_CONTEXT_PATTERNS:
47
+ if pattern.search(line):
48
+ return line.strip()
49
+ return "" # Return empty string if no context is found.
50
+
16
51
  @staticmethod
17
52
  def generate_custom_diff(base_content: str, head_content: str, context_lines: int) -> str:
18
53
  """
19
- Generate a custom diff between two pieces of content with specified context lines.
54
+ Generate a custom diff between two pieces of content with specified context lines,
55
+ and automatically add function/class context to hunk headers, similar to `git diff`.
56
+ This method is designed to be fail-safe; if context addition fails, it returns the standard diff.
20
57
 
21
58
  Args:
22
59
  base_content (str): The original content.
@@ -24,7 +61,7 @@ class DiffGenerator:
24
61
  context_lines (int): The number of context lines to include in the diff.
25
62
 
26
63
  Returns:
27
- str: A string representation of the unified diff.
64
+ str: A string representation of the unified diff, preferably with hunk headers.
28
65
 
29
66
  Raises:
30
67
  ValueError: If context_lines is negative.
@@ -40,15 +77,69 @@ class DiffGenerator:
40
77
  # File is deleted
41
78
  return "".join(f"- {line}\n" for line in base_content.splitlines())
42
79
 
80
+ # Use empty strings for None content to ensure difflib handles them correctly
81
+ # as file additions or deletions. This is more robust and aligns with difflib's expectations.
82
+ base_content = base_content or ""
83
+ head_content = head_content or ""
84
+
43
85
  base_lines: List[str] = base_content.splitlines()
44
86
  head_lines: List[str] = head_content.splitlines()
45
87
 
88
+ # Generate the standard unified diff. This part is considered stable.
89
+ diff: List[str] = list(difflib.unified_diff(
90
+ base_lines,
91
+ head_lines,
92
+ n=context_lines,
93
+ lineterm=''
94
+ ))
95
+
96
+ if not diff:
97
+ return "" # No differences found, return early.
98
+
99
+ # --- Start of the fail-safe enhancement logic ---
100
+ # This entire block attempts to add context to hunk headers.
101
+ # If any exception occurs here, we catch it and return the original, un-enhanced diff.
102
+ # This ensures the function is always reliable (Pareto improvement).
46
103
  try:
47
- diff: List[str] = list(difflib.unified_diff(base_lines, head_lines, n=context_lines, lineterm=''))
48
- return '\n'.join(diff)
104
+ enhanced_diff = []
105
+ # Regex to parse the original line number from a hunk header.
106
+ # e.g., from "@@ -35,7 +35,7 @@" it captures "35".
107
+ hunk_header_re = re.compile(r'^@@ -(\d+)(?:,\d+)? .*')
108
+
109
+ for line in diff:
110
+ match = hunk_header_re.match(line)
111
+ if match:
112
+ # This is a hunk header line.
113
+ # The line number from the regex is 1-based.
114
+ start_line_num = int(match.group(1))
115
+
116
+ # The index is 0-based, so we subtract 1.
117
+ # We search from the line where the change starts, or the line before it.
118
+ context_line_index = max(0, start_line_num - 1)
119
+ context = DiffGenerator._find_context(context_line_index, base_lines)
120
+
121
+ if context:
122
+ # If context was found, append it to the hunk header.
123
+ enhanced_diff.append(f"{line} {context}")
124
+ else:
125
+ # Otherwise, use the original hunk header.
126
+ enhanced_diff.append(line)
127
+ else:
128
+ # This is not a hunk header, just a regular diff line (+, -, ' ').
129
+ enhanced_diff.append(line)
130
+
131
+ # If the enhancement process completes successfully, return the result.
132
+ return '\n'.join(enhanced_diff)
133
+
49
134
  except Exception as e:
50
- logger.exception(f"Error generating diff: {str(e)}")
51
- return ""
135
+ # If any error occurred during the enhancement, log a warning and fall back.
136
+ logger.warning(
137
+ f"Could not add hunk header context due to an unexpected error: {str(e)}. "
138
+ "Falling back to standard diff output."
139
+ )
140
+ # --- Fallback mechanism ---
141
+ # Return the original, unmodified diff generated by difflib.
142
+ return '\n'.join(diff)
52
143
 
53
144
 
54
145
  class DataAnonymizer:
@@ -0,0 +1 @@
1
+ __version__ = '0.3.3'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llama-github
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Llama-github is an open-source Python library that empowers LLM Chatbots, AI Agents, and Auto-dev Agents to conduct Retrieval from actively selected GitHub public projects. It Augments through LLMs and Generates context for any coding question, in order to streamline the development of sophisticated AI-driven applications.
5
5
  Home-page: https://github.com/JetXu-LLM/llama-github
6
6
  Author: Jet Xu
@@ -32,6 +32,38 @@ Requires-Dist: flake8; extra == "dev"
32
32
  Dynamic: license-file
33
33
  Dynamic: requires-dist
34
34
 
35
+
36
+ <div align="right">
37
+ <details>
38
+ <summary >🌐 Language</summary>
39
+ <div>
40
+ <div align="center">
41
+ <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=en">English</a>
42
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-CN">简体中文</a>
43
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-TW">繁體中文</a>
44
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ja">日本語</a>
45
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ko">한국어</a>
46
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=hi">हिन्दी</a>
47
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=th">ไทย</a>
48
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fr">Français</a>
49
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=de">Deutsch</a>
50
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=es">Español</a>
51
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=it">Italiano</a>
52
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ru">Русский</a>
53
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pt">Português</a>
54
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=nl">Nederlands</a>
55
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pl">Polski</a>
56
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ar">العربية</a>
57
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fa">فارسی</a>
58
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=tr">Türkçe</a>
59
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=vi">Tiếng Việt</a>
60
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=id">Bahasa Indonesia</a>
61
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=as">অসমীয়া</
62
+ </div>
63
+ </div>
64
+ </details>
65
+ </div>
66
+
35
67
  # llama-github
36
68
 
37
69
  [Detail Document] https://deepwiki.com/JetXu-LLM/llama-github
@@ -156,6 +188,11 @@ All notable changes to this project will be documented in this file.
156
188
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
157
189
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
158
190
 
191
+ ## [0.3.3] - 2025-08-24
192
+
193
+ ### Optimized
194
+ - Enhance diff hunk header
195
+
159
196
  ## [0.3.2] - 2025-06-23
160
197
 
161
198
  ### Optimized
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = llama-github
3
- version = 0.3.2
3
+ version = 0.3.3
4
4
  author = Jet Xu
5
5
  author_email = Voldemort.xu@foxmail.com
6
6
  description = Llama-github is an open-source Python library that empowers LLM Chatbots, AI Agents, and Auto-dev Agents to conduct Retrieval from actively selected GitHub public projects. It Augments through LLMs and Generates context for any coding question, in order to streamline the development of sophisticated AI-driven applications.
@@ -1 +0,0 @@
1
- __version__ = '0.3.2'
File without changes
File without changes
File without changes