llama-github 0.1.9__tar.gz → 0.2.1__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.1.9 → llama_github-0.2.1}/CHANGELOG.md +11 -1
  2. {llama_github-0.1.9/llama_github.egg-info → llama_github-0.2.1}/PKG-INFO +28 -2
  3. {llama_github-0.1.9 → llama_github-0.2.1}/README.md +16 -0
  4. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/data_retrieval/github_entities.py +115 -20
  5. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/llm_integration/initial_load.py +1 -1
  6. llama_github-0.2.1/llama_github/version.py +1 -0
  7. {llama_github-0.1.9 → llama_github-0.2.1/llama_github.egg-info}/PKG-INFO +28 -2
  8. {llama_github-0.1.9 → llama_github-0.2.1}/setup.cfg +1 -1
  9. llama_github-0.1.9/llama_github/version.py +0 -1
  10. {llama_github-0.1.9 → llama_github-0.2.1}/LICENSE +0 -0
  11. {llama_github-0.1.9 → llama_github-0.2.1}/MANIFEST.in +0 -0
  12. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/__init__.py +0 -0
  13. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/config/__init__.py +0 -0
  14. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/config/config.json +0 -0
  15. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/config/config.py +0 -0
  16. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/data_retrieval/__init__.py +0 -0
  17. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/data_retrieval/github_api.py +0 -0
  18. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/features/__init__.py +0 -0
  19. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/features/feature_flags.py +0 -0
  20. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/features/insider_features.py +0 -0
  21. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/github_integration/__init__.py +0 -0
  22. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/github_integration/github_auth_manager.py +0 -0
  23. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/github_rag.py +0 -0
  24. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/llm_integration/__init__.py +0 -0
  25. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/llm_integration/llm_handler.py +0 -0
  26. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/logger.py +0 -0
  27. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/rag_processing/__init__.py +0 -0
  28. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/rag_processing/rag_processor.py +0 -0
  29. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github/utils.py +0 -0
  30. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github.egg-info/SOURCES.txt +0 -0
  31. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github.egg-info/dependency_links.txt +0 -0
  32. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github.egg-info/requires.txt +0 -0
  33. {llama_github-0.1.9 → llama_github-0.2.1}/llama_github.egg-info/top_level.txt +0 -0
  34. {llama_github-0.1.9 → llama_github-0.2.1}/setup.py +0 -0
  35. {llama_github-0.1.9 → llama_github-0.2.1}/tests/test_data_retrieval.py +0 -0
  36. {llama_github-0.1.9 → llama_github-0.2.1}/tests/test_github_auth_manager.py +0 -0
  37. {llama_github-0.1.9 → llama_github-0.2.1}/tests/test_initial_load.py +0 -0
  38. {llama_github-0.1.9 → llama_github-0.2.1}/tests/test_llm_handler.py +0 -0
  39. {llama_github-0.1.9 → llama_github-0.2.1}/tests/test_logger.py +0 -0
  40. {llama_github-0.1.9 → llama_github-0.2.1}/tests/test_rag_processor.py +0 -0
@@ -5,7 +5,17 @@ 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.1.9] - 2024-10-31
8
+ ## [0.2.1] - 2024-11-16
9
+
10
+ ### Optimized
11
+ - approperately handle more file types when calculate file changes in PR
12
+
13
+ ## [0.2.0] - 2024-11-16
14
+
15
+ ### Optimized
16
+ - fix bugs for generate repo from pool by using Github_install_id
17
+
18
+ ## [0.1.9] - 2024-11-04
9
19
 
10
20
  ### Optimized
11
21
  - fix bugs for get pr content
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-github
3
- Version: 0.1.9
3
+ Version: 0.2.1
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
@@ -96,6 +96,22 @@ For more advanced usage and examples, please refer to the [documentation](docs/u
96
96
 
97
97
  - **🛠️ Logging and Error Handling**: We understand the importance of smooth operations and easy troubleshooting. That's why llama-github comes equipped with comprehensive logging and error handling mechanisms. Gain deep insights into the library's behavior, quickly diagnose issues, and maintain a stable and reliable development workflow.
98
98
 
99
+ ## 🤖 Try Our AI-Powered PR Review Assistant: LlamaPReview
100
+
101
+ If you find llama-github useful, you might also be interested in our AI-powered GitHub PR review assistant, LlamaPReview. It's designed to complement your development workflow and further enhance code quality.
102
+
103
+ ### Key Features of LlamaPReview:
104
+ - 🚀 One-click installation, zero configuration required, fully auto-run
105
+ - 💯 Currently free to use - no credit card or payment info needed
106
+ - 🧠 AI-powered, automatic PR reviews with deep code understanding
107
+ - 🌐 Supports multiple programming languages
108
+
109
+ **LlamaPReview utilizes llama-github's advanced context retrieval and LLM-powered analysis** to provide intelligent, context-aware code reviews. It's like having a senior developer, armed with the full context of your repository, review every PR automatically!
110
+
111
+ 👉 [Install LlamaPReview Now](https://github.com/marketplace/llamapreview/) (Free)
112
+
113
+ By using llama-github for context retrieval and LlamaPReview for code reviews, you can create a powerful, AI-enhanced development environment.
114
+
99
115
  ## Vision and Roadmap
100
116
 
101
117
  ### Vision
@@ -140,7 +156,17 @@ All notable changes to this project will be documented in this file.
140
156
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
141
157
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
142
158
 
143
- ## [0.1.9] - 2024-10-31
159
+ ## [0.2.1] - 2024-11-16
160
+
161
+ ### Optimized
162
+ - approperately handle more file types when calculate file changes in PR
163
+
164
+ ## [0.2.0] - 2024-11-16
165
+
166
+ ### Optimized
167
+ - fix bugs for generate repo from pool by using Github_install_id
168
+
169
+ ## [0.1.9] - 2024-11-04
144
170
 
145
171
  ### Optimized
146
172
  - fix bugs for get pr content
@@ -60,6 +60,22 @@ For more advanced usage and examples, please refer to the [documentation](docs/u
60
60
 
61
61
  - **🛠️ Logging and Error Handling**: We understand the importance of smooth operations and easy troubleshooting. That's why llama-github comes equipped with comprehensive logging and error handling mechanisms. Gain deep insights into the library's behavior, quickly diagnose issues, and maintain a stable and reliable development workflow.
62
62
 
63
+ ## 🤖 Try Our AI-Powered PR Review Assistant: LlamaPReview
64
+
65
+ If you find llama-github useful, you might also be interested in our AI-powered GitHub PR review assistant, LlamaPReview. It's designed to complement your development workflow and further enhance code quality.
66
+
67
+ ### Key Features of LlamaPReview:
68
+ - 🚀 One-click installation, zero configuration required, fully auto-run
69
+ - 💯 Currently free to use - no credit card or payment info needed
70
+ - 🧠 AI-powered, automatic PR reviews with deep code understanding
71
+ - 🌐 Supports multiple programming languages
72
+
73
+ **LlamaPReview utilizes llama-github's advanced context retrieval and LLM-powered analysis** to provide intelligent, context-aware code reviews. It's like having a senior developer, armed with the full context of your repository, review every PR automatically!
74
+
75
+ 👉 [Install LlamaPReview Now](https://github.com/marketplace/llamapreview/) (Free)
76
+
77
+ By using llama-github for context retrieval and LlamaPReview for code reviews, you can create a powerful, AI-enhanced development environment.
78
+
63
79
  ## Vision and Roadmap
64
80
 
65
81
  ### Vision
@@ -98,6 +98,11 @@ class Repository:
98
98
  @property
99
99
  def repo(self):
100
100
  return self.get_repo()
101
+
102
+ def set_github(self, github_instance: ExtendedGithub):
103
+ self._github = github_instance
104
+ with self._repo_lock: # Locking for write action
105
+ self._repo = self._github.get_repo(self.full_name)
101
106
 
102
107
  def get_repo(self):
103
108
  """
@@ -118,8 +123,8 @@ class Repository:
118
123
  self.default_branch = self._repo.default_branch
119
124
  self.updated_at = self._repo.updated_at
120
125
  except GithubException as e:
121
- logger.exception(
122
- f"Error retrieving repository '{self.full_name}':")
126
+ logger.error(
127
+ f"Error retrieving repository '{self.full_name}':{str(e)}")
123
128
  return None
124
129
  self.update_last_read_time()
125
130
  return self._repo
@@ -154,14 +159,88 @@ class Repository:
154
159
  """
155
160
  file_key = f"{file_path}/{sha}" if sha is not None else file_path
156
161
 
157
- # Skip binary and system files
162
+ # Skip files that don't need processing
158
163
  if any(file_path.endswith(ext) for ext in [
159
- '.exe', '.dll', '.so', '.dylib', '.bin',
160
- '.png', '.jpg', '.jpeg', '.gif', '.ico',
161
- '.mp3', '.mp4', '.avi', '.mov', '.pdf',
162
- '.DS_Store'
163
- ]) or '/.' in file_path:
164
- logger.debug(f"Skipping binary or system file: {file_path}")
164
+ # Package manager and dependencies
165
+ '.lock', '.pnpm-lock.yaml', 'package-lock.json', 'Gemfile.lock',
166
+ 'poetry.lock', 'Cargo.lock', 'composer.lock',
167
+ '.pyc', '.pyo', 'requirements.txt',
168
+
169
+ # Binaries and compiled files
170
+ '.exe', '.dll', '.so', '.dylib', '.bin', '.obj', '.o', '.a',
171
+ '.lib', '.jar', '.war', '.ear', '.class', '.pdb', '.ilk', '.exp',
172
+ '.apk', '.aab', '.ipa', # Mobile apps
173
+ '.wasm', # WebAssembly
174
+
175
+ # Media and compressed files
176
+ '.png', '.jpg', '.jpeg', '.gif', '.ico', '.bmp', '.tiff', '.webp',
177
+ '.svg', '.eps', '.psd', '.ai', '.sketch',
178
+ '.mp3', '.mp4', '.wav', '.flac', '.ogg', '.m4a',
179
+ '.avi', '.mov', '.mkv', '.webm', '.wmv', '.flv',
180
+ '.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx',
181
+ '.zip', '.rar', '.7z', '.tar', '.gz', '.bz2', '.xz', '.tgz',
182
+
183
+ # System and hidden files
184
+ '.DS_Store', 'Thumbs.db', '.dockerignore',
185
+ '.gitattributes', '.gitmodules',
186
+
187
+ # Documentation and resource files
188
+ '.min.js', '.min.css', '.map', '.po', '.mo', '.pot',
189
+ '.ttf', '.otf', '.eot', '.woff', '.woff2', # Fonts
190
+
191
+ # Configuration and data files
192
+ '.conf', '.config', '.cfg', '.ini',
193
+ '.sqlite', '.db', '.mdb', '.sql',
194
+ '.pb', '.pbtxt', # Protocol buffers
195
+ '.ipynb', # Jupyter notebooks
196
+ '.pkl', '.pickle', # Python serialized objects
197
+ '.tfrecords', '.tf', # TensorFlow files
198
+ '.onnx', # ONNX models
199
+ '.h5', '.hdf5', # HDF5 files
200
+ '.npy', '.npz', # NumPy files
201
+
202
+ # Build outputs
203
+ '.min.js', '.min.css',
204
+ '.bundle.js', '.bundle.css',
205
+ '.chunk.js', '.chunk.css'
206
+
207
+ ]) or any(pattern in file_path for pattern in [
208
+ # Special directories
209
+ '/node_modules/',
210
+ '/__pycache__/',
211
+ '/.git/',
212
+ '/.idea/',
213
+ '/.vscode/',
214
+ '/.vs/',
215
+ '/.svn/',
216
+ '/.hg/',
217
+ '/dist/',
218
+ '/build/',
219
+ '/target/',
220
+ '/out/',
221
+ '/bin/',
222
+ '/obj/',
223
+ '/Debug/',
224
+ '/Release/',
225
+ '/.next/',
226
+ '/.nuxt/',
227
+ '/vendor/',
228
+ '/venv/',
229
+ '/.env',
230
+ '/coverage/',
231
+ '/logs/',
232
+ '/.github/',
233
+ '/assets/',
234
+ '/public/assets/',
235
+ '/static/assets/',
236
+ '/.pytest_cache/',
237
+ '/.sass-cache/',
238
+ '/.parcel-cache/',
239
+ '/.cache/',
240
+ '/tmp/',
241
+ '/temp/'
242
+ ]):
243
+ logger.debug(f"Skipping non-processable file: {file_path}")
165
244
  return None
166
245
 
167
246
  if file_key not in self._file_contents: # Check if file content has already been fetched
@@ -303,8 +382,8 @@ class Repository:
303
382
  # Full GitHub issue/PR URL pattern
304
383
  rf'(?:https?://)?github\.com/{re.escape(self.full_name)}/(?:issues|pull)/(\d+)',
305
384
 
306
- # Standard #123 reference with proper boundaries
307
- r'(?:^|[^\w/])#(\d+)(?=[^\w/]|$)',
385
+ # # Standard #123 reference with proper boundaries
386
+ # r'(?:^|[^\w/])#(\d+)(?=[^\w/]|$)',
308
387
 
309
388
  # Closing keywords (fixes #123)
310
389
  fr'(?:^|[^\w/])(?:{"|".join(closing_keywords)}):?\s+#(\d+)(?=[^\w/]|$)',
@@ -377,7 +456,7 @@ class Repository:
377
456
  return dt.astimezone(timezone.utc).replace(microsecond=0).isoformat().replace('+00:00', 'Z')
378
457
  return None
379
458
 
380
- def get_pr_content(self, number, pr=None, context_lines=10) -> Dict[str, Any]:
459
+ def get_pr_content(self, number, pr=None, context_lines=10, force_update=False) -> Dict[str, Any]:
381
460
  """
382
461
  Retrieves and processes the content of a pull request.
383
462
 
@@ -386,9 +465,9 @@ class Repository:
386
465
  :param context_lines: Number of context lines for diffs.
387
466
  :return: A dictionary containing detailed PR information.
388
467
  """
389
- if number not in self._prs: # Check if issue has already been fetched
468
+ if number not in self._prs or force_update: # Check if issue has already been fetched
390
469
  with self._pr_lock: # Locking for write action
391
- if number not in self._prs: # Check if issue has already been fetched after get lock
470
+ if number not in self._prs or force_update: # Check if issue has already been fetched after get lock
392
471
  try:
393
472
  logger.debug(f"Processing PR #{number}")
394
473
  if pr is None:
@@ -552,7 +631,7 @@ class Repository:
552
631
 
553
632
  # Generate custom diff with specified context lines
554
633
  if base_content is None and head_content is None:
555
- custom_diff = ''
634
+ custom_diff = '[SKIPPED] File type not suitable for diff analysis'
556
635
  else:
557
636
  custom_diff = DiffGenerator.generate_custom_diff(base_content, head_content, context_lines)
558
637
  if not custom_diff or custom_diff.strip() == '':
@@ -691,13 +770,29 @@ class RepositoryPool:
691
770
  self._locks_registry[full_name] = Lock()
692
771
  return self._locks_registry[full_name]
693
772
 
694
- def get_repository(self, full_name, **kwargs) -> Repository:
695
- """Retrieve a repository from the pool or create a new one if it doesn't exist."""
773
+ def get_repository(self, full_name, github_instance=None, **kwargs) -> Repository:
774
+ """
775
+ Retrieve a repository from the pool or create a new one if it doesn't exist.
776
+
777
+ If you are using github_install_id to generate a new repository object, you should pass new github_instance to the function.
778
+ Otherwise the default github_instance within the pool might not fit to the new repository object.
779
+ """
780
+
696
781
  if full_name in self._pool:
782
+ # repo = self._pool[full_name]
783
+ # repo.update_last_read_time()
784
+ # if github_instance is not None:
785
+ # repo.set_github(github_instance)
786
+ # return repo
697
787
  return self._pool[full_name]
788
+
698
789
  repo_lock = self._get_repo_lock(full_name)
699
790
  with repo_lock:
700
791
  if full_name not in self._pool:
701
- self._pool[full_name] = Repository(
702
- full_name, self.github_instance, **kwargs)
703
- return self._pool[full_name]
792
+ if github_instance is not None:
793
+ repo = Repository(full_name, github_instance, **kwargs)
794
+ else:
795
+ repo = Repository(full_name, self.github_instance, **kwargs)
796
+ self._pool[full_name] = repo
797
+
798
+ return self._pool[full_name]
@@ -69,7 +69,7 @@ class LLMManager:
69
69
  elif mistral_api_key is not None and mistral_api_key != "" and self.llm is None:
70
70
  logger.info("Initializing Mistral API...")
71
71
  self.llm = ChatMistralAI(mistral_api_key=mistral_api_key, model="mistral-large-latest")
72
- self.llm_simple = ChatMistralAI(mistral_api_key=mistral_api_key, model="open-mistral-nemo")
72
+ self.llm_simple = ChatMistralAI(mistral_api_key=mistral_api_key, model="open-codestral-mamba")
73
73
  self.model_type = "OpenAI"
74
74
  elif openai_api_key is not None and openai_api_key != "" and self.llm is None:
75
75
  logger.info("Initializing OpenAI API...")
@@ -0,0 +1 @@
1
+ __version__ = '0.2.1'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-github
3
- Version: 0.1.9
3
+ Version: 0.2.1
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
@@ -96,6 +96,22 @@ For more advanced usage and examples, please refer to the [documentation](docs/u
96
96
 
97
97
  - **🛠️ Logging and Error Handling**: We understand the importance of smooth operations and easy troubleshooting. That's why llama-github comes equipped with comprehensive logging and error handling mechanisms. Gain deep insights into the library's behavior, quickly diagnose issues, and maintain a stable and reliable development workflow.
98
98
 
99
+ ## 🤖 Try Our AI-Powered PR Review Assistant: LlamaPReview
100
+
101
+ If you find llama-github useful, you might also be interested in our AI-powered GitHub PR review assistant, LlamaPReview. It's designed to complement your development workflow and further enhance code quality.
102
+
103
+ ### Key Features of LlamaPReview:
104
+ - 🚀 One-click installation, zero configuration required, fully auto-run
105
+ - 💯 Currently free to use - no credit card or payment info needed
106
+ - 🧠 AI-powered, automatic PR reviews with deep code understanding
107
+ - 🌐 Supports multiple programming languages
108
+
109
+ **LlamaPReview utilizes llama-github's advanced context retrieval and LLM-powered analysis** to provide intelligent, context-aware code reviews. It's like having a senior developer, armed with the full context of your repository, review every PR automatically!
110
+
111
+ 👉 [Install LlamaPReview Now](https://github.com/marketplace/llamapreview/) (Free)
112
+
113
+ By using llama-github for context retrieval and LlamaPReview for code reviews, you can create a powerful, AI-enhanced development environment.
114
+
99
115
  ## Vision and Roadmap
100
116
 
101
117
  ### Vision
@@ -140,7 +156,17 @@ All notable changes to this project will be documented in this file.
140
156
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
141
157
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
142
158
 
143
- ## [0.1.9] - 2024-10-31
159
+ ## [0.2.1] - 2024-11-16
160
+
161
+ ### Optimized
162
+ - approperately handle more file types when calculate file changes in PR
163
+
164
+ ## [0.2.0] - 2024-11-16
165
+
166
+ ### Optimized
167
+ - fix bugs for generate repo from pool by using Github_install_id
168
+
169
+ ## [0.1.9] - 2024-11-04
144
170
 
145
171
  ### Optimized
146
172
  - fix bugs for get pr content
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = llama-github
3
- version = 0.1.9
3
+ version = 0.2.1
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.1.9'
File without changes
File without changes
File without changes