llama-github 0.1.6__tar.gz → 0.1.8__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.
- {llama_github-0.1.6 → llama_github-0.1.8}/CHANGELOG.md +10 -0
- {llama_github-0.1.6/llama_github.egg-info → llama_github-0.1.8}/PKG-INFO +11 -1
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/data_retrieval/github_entities.py +77 -29
- llama_github-0.1.8/llama_github/version.py +1 -0
- {llama_github-0.1.6 → llama_github-0.1.8/llama_github.egg-info}/PKG-INFO +11 -1
- {llama_github-0.1.6 → llama_github-0.1.8}/setup.cfg +1 -1
- llama_github-0.1.6/llama_github/version.py +0 -1
- {llama_github-0.1.6 → llama_github-0.1.8}/LICENSE +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/MANIFEST.in +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/README.md +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/__init__.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/config/__init__.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/config/config.json +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/config/config.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/data_retrieval/__init__.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/data_retrieval/github_api.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/features/__init__.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/features/feature_flags.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/features/insider_features.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/github_integration/__init__.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/github_integration/github_auth_manager.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/github_rag.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/llm_integration/__init__.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/llm_integration/initial_load.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/llm_integration/llm_handler.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/logger.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/rag_processing/__init__.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/rag_processing/rag_processor.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github/utils.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github.egg-info/SOURCES.txt +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github.egg-info/dependency_links.txt +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github.egg-info/requires.txt +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/llama_github.egg-info/top_level.txt +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/setup.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/tests/test_data_retrieval.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/tests/test_github_auth_manager.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/tests/test_initial_load.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/tests/test_llm_handler.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/tests/test_logger.py +0 -0
- {llama_github-0.1.6 → llama_github-0.1.8}/tests/test_rag_processor.py +0 -0
|
@@ -5,6 +5,16 @@ 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.8] - 2024-11-03
|
|
9
|
+
|
|
10
|
+
### Optimized
|
|
11
|
+
- fix bugs for get pr content file diff calculate logic
|
|
12
|
+
|
|
13
|
+
## [0.1.7] - 2024-10-31
|
|
14
|
+
|
|
15
|
+
### Optimized
|
|
16
|
+
- fix bugs for get pr content
|
|
17
|
+
|
|
8
18
|
## [0.1.6] - 2024-10-30
|
|
9
19
|
|
|
10
20
|
### New Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: llama-github
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
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,16 @@ 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.8] - 2024-11-03
|
|
144
|
+
|
|
145
|
+
### Optimized
|
|
146
|
+
- fix bugs for get pr content file diff calculate logic
|
|
147
|
+
|
|
148
|
+
## [0.1.7] - 2024-10-31
|
|
149
|
+
|
|
150
|
+
### Optimized
|
|
151
|
+
- fix bugs for get pr content
|
|
152
|
+
|
|
143
153
|
## [0.1.6] - 2024-10-30
|
|
144
154
|
|
|
145
155
|
### 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
|
|
|
@@ -122,7 +123,7 @@ class Repository:
|
|
|
122
123
|
return None
|
|
123
124
|
self.update_last_read_time()
|
|
124
125
|
return self._repo
|
|
125
|
-
|
|
126
|
+
|
|
126
127
|
def get_structure(self, path="/") -> dict:
|
|
127
128
|
"""
|
|
128
129
|
Retrieves the structure of the repository using a singleton design pattern.
|
|
@@ -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,28 @@ 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
|
+
logger.debug(f"Downloading file {file_path} from {file_content.download_url}")
|
|
187
|
+
# Use requests to download the file content
|
|
188
|
+
response = requests.get(
|
|
189
|
+
file_content.download_url,
|
|
190
|
+
timeout=30,
|
|
191
|
+
headers={'Accept': 'application/vnd.github.v3.raw'}
|
|
192
|
+
)
|
|
193
|
+
response.raise_for_status()
|
|
194
|
+
decoded_content = response.text
|
|
195
|
+
except requests.RequestException as e:
|
|
196
|
+
logger.error(f"Failed to download file {file_path}: {str(e)}")
|
|
197
|
+
return None
|
|
168
198
|
else:
|
|
169
199
|
decoded_content = file_content.decoded_content.decode('utf-8')
|
|
170
200
|
|
|
@@ -180,7 +210,8 @@ class Repository:
|
|
|
180
210
|
|
|
181
211
|
self.update_last_read_time()
|
|
182
212
|
return self._file_contents.get(file_key)
|
|
183
|
-
|
|
213
|
+
|
|
214
|
+
|
|
184
215
|
def get_issue_content(self, number, issue=None) -> str:
|
|
185
216
|
"""
|
|
186
217
|
Retrieves the content of a issue using a singleton design pattern.
|
|
@@ -200,8 +231,8 @@ class Repository:
|
|
|
200
231
|
"\nComment amount: " + \
|
|
201
232
|
str(comments_amount) + \
|
|
202
233
|
"\nIssue body:\n" + \
|
|
203
|
-
re.sub(r'\n+\s*\n+', '\n',
|
|
204
|
-
|
|
234
|
+
(re.sub(r'\n+\s*\n+', '\n',
|
|
235
|
+
(issue.body or "").replace('\r', '\n').strip()) if issue.body else "No issue body provided")
|
|
205
236
|
else:
|
|
206
237
|
comments_amount = issue['comments']
|
|
207
238
|
body_content = "This is a Github Issue related to repo \"" + (self.full_name or "") + "\". Repo description:" + (self.description or "") +\
|
|
@@ -236,6 +267,9 @@ class Repository:
|
|
|
236
267
|
logger.exception(
|
|
237
268
|
f"Error getting issue content for {number} in repository {self.full_name}:")
|
|
238
269
|
return None
|
|
270
|
+
except Exception as e:
|
|
271
|
+
logger.error(f"Unexpected error processing : {str(e)}")
|
|
272
|
+
return None
|
|
239
273
|
self.update_last_read_time()
|
|
240
274
|
return self._issues[number]
|
|
241
275
|
|
|
@@ -384,27 +418,9 @@ class Repository:
|
|
|
384
418
|
"interactions": []
|
|
385
419
|
}
|
|
386
420
|
|
|
387
|
-
#
|
|
388
|
-
|
|
389
|
-
|
|
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"] = {}
|
|
421
|
+
# Extract related issues from PR description and comments
|
|
422
|
+
related_issues = self.extract_related_issues(pr_data)
|
|
423
|
+
pr_data['related_issues'] = self.get_issue_contents(related_issues, pr.number)
|
|
408
424
|
|
|
409
425
|
# Fetch CI/CD results
|
|
410
426
|
try:
|
|
@@ -489,11 +505,30 @@ class Repository:
|
|
|
489
505
|
pr_interactions.sort(key=lambda x: parser.isoparse(x["created_at"]))
|
|
490
506
|
pr_data["interactions"] = pr_interactions
|
|
491
507
|
|
|
492
|
-
#
|
|
493
|
-
|
|
494
|
-
|
|
508
|
+
# Fetch and process commits
|
|
509
|
+
try:
|
|
510
|
+
commits = pr.get_commits()
|
|
511
|
+
for commit in commits:
|
|
512
|
+
commit_data = {
|
|
513
|
+
"sha": commit.sha,
|
|
514
|
+
"message": commit.commit.message,
|
|
515
|
+
"author": commit.commit.author.name,
|
|
516
|
+
"date": self.to_isoformat(commit.commit.author.date),
|
|
517
|
+
"stats": {
|
|
518
|
+
"additions": commit.stats.additions,
|
|
519
|
+
"deletions": commit.stats.deletions,
|
|
520
|
+
"total": commit.stats.total
|
|
521
|
+
},
|
|
522
|
+
"files": [f.filename for f in commit.files] # Just keep changed file names
|
|
523
|
+
}
|
|
524
|
+
pr_data["commits"].append(commit_data)
|
|
525
|
+
except GithubException as e:
|
|
526
|
+
logger.exception(f"Error fetching commits for PR #{number}")
|
|
527
|
+
pr_data["commits"] = []
|
|
528
|
+
pr_data["commit_stats"] = {}
|
|
495
529
|
|
|
496
530
|
# Process file changes
|
|
531
|
+
comparison = None
|
|
497
532
|
dependency_files = ['requirements.txt', 'Pipfile', 'Pipfile.lock', 'setup.py']
|
|
498
533
|
config_files = ['.env', 'settings.py', 'config.yaml', 'config.yml', 'config.json']
|
|
499
534
|
for file in pr_files:
|
|
@@ -516,7 +551,20 @@ class Repository:
|
|
|
516
551
|
head_content = self.get_file_content(file_path=file_path, sha=pr.head.sha)
|
|
517
552
|
|
|
518
553
|
# Generate custom diff with specified context lines
|
|
519
|
-
|
|
554
|
+
if base_content is None and head_content is None:
|
|
555
|
+
custom_diff = ''
|
|
556
|
+
else:
|
|
557
|
+
custom_diff = DiffGenerator.generate_custom_diff(base_content, head_content, context_lines)
|
|
558
|
+
if not custom_diff or custom_diff.strip() == '':
|
|
559
|
+
try:
|
|
560
|
+
#use compare API if custom diff is empty
|
|
561
|
+
if not comparison:
|
|
562
|
+
comparison = self.repo.compare(pr.base.sha, pr.head.sha)
|
|
563
|
+
patches = [f.patch for f in comparison.files if f.filename == file_path]
|
|
564
|
+
custom_diff = patches[0] if patches else None
|
|
565
|
+
except Exception as e:
|
|
566
|
+
logger.exception(f"Error fetching file diff for PR #{number}")
|
|
567
|
+
custom_diff = ''
|
|
520
568
|
|
|
521
569
|
# Categorize code changes
|
|
522
570
|
change_categories = CodeAnalyzer.categorize_change(custom_diff)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.1.8'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: llama-github
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
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,16 @@ 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.8] - 2024-11-03
|
|
144
|
+
|
|
145
|
+
### Optimized
|
|
146
|
+
- fix bugs for get pr content file diff calculate logic
|
|
147
|
+
|
|
148
|
+
## [0.1.7] - 2024-10-31
|
|
149
|
+
|
|
150
|
+
### Optimized
|
|
151
|
+
- fix bugs for get pr content
|
|
152
|
+
|
|
143
153
|
## [0.1.6] - 2024-10-30
|
|
144
154
|
|
|
145
155
|
### New Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = llama-github
|
|
3
|
-
version = 0.1.
|
|
3
|
+
version = 0.1.8
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llama_github-0.1.6 → llama_github-0.1.8}/llama_github/github_integration/github_auth_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|