llama-github 0.1.6__tar.gz → 0.1.7__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.6 → llama_github-0.1.7}/CHANGELOG.md +5 -0
  2. {llama_github-0.1.6/llama_github.egg-info → llama_github-0.1.7}/PKG-INFO +6 -1
  3. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/data_retrieval/github_entities.py +63 -28
  4. llama_github-0.1.7/llama_github/version.py +1 -0
  5. {llama_github-0.1.6 → llama_github-0.1.7/llama_github.egg-info}/PKG-INFO +6 -1
  6. {llama_github-0.1.6 → llama_github-0.1.7}/setup.cfg +1 -1
  7. llama_github-0.1.6/llama_github/version.py +0 -1
  8. {llama_github-0.1.6 → llama_github-0.1.7}/LICENSE +0 -0
  9. {llama_github-0.1.6 → llama_github-0.1.7}/MANIFEST.in +0 -0
  10. {llama_github-0.1.6 → llama_github-0.1.7}/README.md +0 -0
  11. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/__init__.py +0 -0
  12. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/config/__init__.py +0 -0
  13. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/config/config.json +0 -0
  14. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/config/config.py +0 -0
  15. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/data_retrieval/__init__.py +0 -0
  16. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/data_retrieval/github_api.py +0 -0
  17. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/features/__init__.py +0 -0
  18. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/features/feature_flags.py +0 -0
  19. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/features/insider_features.py +0 -0
  20. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/github_integration/__init__.py +0 -0
  21. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/github_integration/github_auth_manager.py +0 -0
  22. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/github_rag.py +0 -0
  23. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/llm_integration/__init__.py +0 -0
  24. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/llm_integration/initial_load.py +0 -0
  25. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/llm_integration/llm_handler.py +0 -0
  26. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/logger.py +0 -0
  27. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/rag_processing/__init__.py +0 -0
  28. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/rag_processing/rag_processor.py +0 -0
  29. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github/utils.py +0 -0
  30. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github.egg-info/SOURCES.txt +0 -0
  31. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github.egg-info/dependency_links.txt +0 -0
  32. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github.egg-info/requires.txt +0 -0
  33. {llama_github-0.1.6 → llama_github-0.1.7}/llama_github.egg-info/top_level.txt +0 -0
  34. {llama_github-0.1.6 → llama_github-0.1.7}/setup.py +0 -0
  35. {llama_github-0.1.6 → llama_github-0.1.7}/tests/test_data_retrieval.py +0 -0
  36. {llama_github-0.1.6 → llama_github-0.1.7}/tests/test_github_auth_manager.py +0 -0
  37. {llama_github-0.1.6 → llama_github-0.1.7}/tests/test_initial_load.py +0 -0
  38. {llama_github-0.1.6 → llama_github-0.1.7}/tests/test_llm_handler.py +0 -0
  39. {llama_github-0.1.6 → llama_github-0.1.7}/tests/test_logger.py +0 -0
  40. {llama_github-0.1.6 → llama_github-0.1.7}/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.1.7] - 2024-10-31
9
+
10
+ ### Optimized
11
+ - fix bugs for get pr content
12
+
8
13
  ## [0.1.6] - 2024-10-30
9
14
 
10
15
  ### New Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-github
3
- Version: 0.1.6
3
+ Version: 0.1.7
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
@@ -140,6 +140,11 @@ All notable changes to this project will be documented in this file.
140
140
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
141
141
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
142
142
 
143
+ ## [0.1.7] - 2024-10-31
144
+
145
+ ### Optimized
146
+ - fix bugs for get pr content
147
+
143
148
  ## [0.1.6] - 2024-10-30
144
149
 
145
150
  ### New Features
@@ -13,6 +13,7 @@ import json
13
13
  from dateutil import parser
14
14
  from datetime import timezone
15
15
  import base64
16
+ import requests
16
17
 
17
18
  from llama_github.utils import DiffGenerator, CodeAnalyzer
18
19
 
@@ -153,6 +154,16 @@ class Repository:
153
154
  """
154
155
  file_key = f"{file_path}/{sha}" if sha is not None else file_path
155
156
 
157
+ # Skip binary and system files
158
+ 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}")
165
+ return None
166
+
156
167
  if file_key not in self._file_contents: # Check if file content has already been fetched
157
168
  with self._file_contents_lock: # Locking for thread-safe write action
158
169
  if file_key not in self._file_contents: # Double-check after acquiring the lock
@@ -162,9 +173,26 @@ class Repository:
162
173
  else:
163
174
  file_content = self.repo.get_contents(file_path)
164
175
 
176
+ # Handle directory case
177
+ if isinstance(file_content, list):
178
+ logger.debug(f"Path {file_path} is a directory")
179
+ return None
180
+
165
181
  # Improved encoding handling
166
182
  if file_content.encoding == 'base64':
167
183
  decoded_content = base64.b64decode(file_content.content).decode('utf-8')
184
+ elif (file_content.encoding is None or file_content.encoding == 'none') and hasattr(file_content, 'download_url') and file_content.download_url:
185
+ try:
186
+ response = requests.get(
187
+ file_content.download_url,
188
+ timeout=30,
189
+ headers={'Accept': 'application/vnd.github.v3.raw'}
190
+ )
191
+ response.raise_for_status()
192
+ decoded_content = response.text
193
+ except requests.RequestException as e:
194
+ logger.error(f"Failed to download file {file_path}: {str(e)}")
195
+ return None
168
196
  else:
169
197
  decoded_content = file_content.decoded_content.decode('utf-8')
170
198
 
@@ -180,7 +208,8 @@ class Repository:
180
208
 
181
209
  self.update_last_read_time()
182
210
  return self._file_contents.get(file_key)
183
-
211
+
212
+
184
213
  def get_issue_content(self, number, issue=None) -> str:
185
214
  """
186
215
  Retrieves the content of a issue using a singleton design pattern.
@@ -200,8 +229,8 @@ class Repository:
200
229
  "\nComment amount: " + \
201
230
  str(comments_amount) + \
202
231
  "\nIssue body:\n" + \
203
- re.sub(r'\n+\s*\n+', '\n',
204
- issue.body.replace('\r', '\n').strip())
232
+ (re.sub(r'\n+\s*\n+', '\n',
233
+ (issue.body or "").replace('\r', '\n').strip()) if issue.body else "No issue body provided")
205
234
  else:
206
235
  comments_amount = issue['comments']
207
236
  body_content = "This is a Github Issue related to repo \"" + (self.full_name or "") + "\". Repo description:" + (self.description or "") +\
@@ -236,6 +265,9 @@ class Repository:
236
265
  logger.exception(
237
266
  f"Error getting issue content for {number} in repository {self.full_name}:")
238
267
  return None
268
+ except Exception as e:
269
+ logger.error(f"Unexpected error processing : {str(e)}")
270
+ return None
239
271
  self.update_last_read_time()
240
272
  return self._issues[number]
241
273
 
@@ -384,27 +416,9 @@ class Repository:
384
416
  "interactions": []
385
417
  }
386
418
 
387
- # Fetch and process commits
388
- try:
389
- commits = pr.get_commits()
390
- for commit in commits:
391
- commit_data = {
392
- "sha": commit.sha,
393
- "message": commit.commit.message,
394
- "author": commit.commit.author.name,
395
- "date": self.to_isoformat(commit.commit.author.date),
396
- "stats": {
397
- "additions": commit.stats.additions,
398
- "deletions": commit.stats.deletions,
399
- "total": commit.stats.total
400
- },
401
- "files": [f.filename for f in commit.files] # Just keep changed file names
402
- }
403
- pr_data["commits"].append(commit_data)
404
- except GithubException as e:
405
- logger.exception(f"Error fetching commits for PR #{number}")
406
- pr_data["commits"] = []
407
- pr_data["commit_stats"] = {}
419
+ # Extract related issues from PR description and comments
420
+ related_issues = self.extract_related_issues(pr_data)
421
+ pr_data['related_issues'] = self.get_issue_contents(related_issues, pr.number)
408
422
 
409
423
  # Fetch CI/CD results
410
424
  try:
@@ -489,9 +503,27 @@ class Repository:
489
503
  pr_interactions.sort(key=lambda x: parser.isoparse(x["created_at"]))
490
504
  pr_data["interactions"] = pr_interactions
491
505
 
492
- # Extract related issues from PR description and comments
493
- related_issues = self.extract_related_issues(pr_data)
494
- pr_data['related_issues'] = self.get_issue_contents(related_issues, pr.number)
506
+ # Fetch and process commits
507
+ try:
508
+ commits = pr.get_commits()
509
+ for commit in commits:
510
+ commit_data = {
511
+ "sha": commit.sha,
512
+ "message": commit.commit.message,
513
+ "author": commit.commit.author.name,
514
+ "date": self.to_isoformat(commit.commit.author.date),
515
+ "stats": {
516
+ "additions": commit.stats.additions,
517
+ "deletions": commit.stats.deletions,
518
+ "total": commit.stats.total
519
+ },
520
+ "files": [f.filename for f in commit.files] # Just keep changed file names
521
+ }
522
+ pr_data["commits"].append(commit_data)
523
+ except GithubException as e:
524
+ logger.exception(f"Error fetching commits for PR #{number}")
525
+ pr_data["commits"] = []
526
+ pr_data["commit_stats"] = {}
495
527
 
496
528
  # Process file changes
497
529
  dependency_files = ['requirements.txt', 'Pipfile', 'Pipfile.lock', 'setup.py']
@@ -516,7 +548,10 @@ class Repository:
516
548
  head_content = self.get_file_content(file_path=file_path, sha=pr.head.sha)
517
549
 
518
550
  # Generate custom diff with specified context lines
519
- custom_diff = DiffGenerator.generate_custom_diff(base_content, head_content, context_lines)
551
+ if base_content is None and head_content is None:
552
+ custom_diff = ''
553
+ else:
554
+ custom_diff = DiffGenerator.generate_custom_diff(base_content, head_content, context_lines)
520
555
 
521
556
  # Categorize code changes
522
557
  change_categories = CodeAnalyzer.categorize_change(custom_diff)
@@ -0,0 +1 @@
1
+ __version__ = '0.1.7'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-github
3
- Version: 0.1.6
3
+ Version: 0.1.7
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
@@ -140,6 +140,11 @@ All notable changes to this project will be documented in this file.
140
140
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
141
141
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
142
142
 
143
+ ## [0.1.7] - 2024-10-31
144
+
145
+ ### Optimized
146
+ - fix bugs for get pr content
147
+
143
148
  ## [0.1.6] - 2024-10-30
144
149
 
145
150
  ### New Features
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = llama-github
3
- version = 0.1.6
3
+ version = 0.1.7
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.6'
File without changes
File without changes
File without changes
File without changes