gitraze 0.3.0__tar.gz → 0.4.0__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.
- {gitraze-0.3.0 → gitraze-0.4.0}/PKG-INFO +28 -28
- {gitraze-0.3.0 → gitraze-0.4.0}/README.md +26 -26
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/__init__.py +1 -1
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/cli.py +7 -5
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/config.py +2 -4
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/core/api_rest.py +6 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/handlers/analyze.py +2 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/handlers/repo.py +4 -2
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/handlers/search.py +4 -2
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/handlers/user.py +4 -2
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/modules/repo.py +14 -3
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/modules/search.py +17 -5
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/modules/user.py +13 -3
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/utils/helpers.py +10 -4
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze.egg-info/PKG-INFO +28 -28
- {gitraze-0.3.0 → gitraze-0.4.0}/pyproject.toml +2 -2
- {gitraze-0.3.0 → gitraze-0.4.0}/LICENSE +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/core/__init__.py +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/handlers/__init__.py +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/modules/__init__.py +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/modules/analytics.py +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze/utils/__init__.py +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze.egg-info/SOURCES.txt +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze.egg-info/dependency_links.txt +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze.egg-info/entry_points.txt +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze.egg-info/requires.txt +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/gitraze.egg-info/top_level.txt +0 -0
- {gitraze-0.3.0 → gitraze-0.4.0}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitraze
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A CLI and Python library for GitHub
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: A CLI and Python library for GitHub exploration, search, and analysis
|
|
5
5
|
Author: AK Pandey
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/akpandey-dev/gitraze
|
|
@@ -17,9 +17,9 @@ Dynamic: license-file
|
|
|
17
17
|
|
|
18
18
|
# Gitraze
|
|
19
19
|
|
|
20
|
-
> A
|
|
20
|
+
> A CLI and Python library for GitHub exploration, search, and analysis
|
|
21
21
|
|
|
22
|
-
Gitraze is a
|
|
22
|
+
Gitraze is a CLI and Python library for exploring, analyzing, and extracting insights from GitHub through the REST API, with GraphQL planned.
|
|
23
23
|
|
|
24
24
|
⚠️ **Status:** Early development — expect bugs, missing features, and rapid changes. APIs and CLI may change without notice.
|
|
25
25
|
|
|
@@ -45,7 +45,7 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
45
45
|
**Gitraze is different:**
|
|
46
46
|
- Fast, minimal, no nonsense
|
|
47
47
|
- Built for developers who think in terminals
|
|
48
|
-
- Deep GitHub data access
|
|
48
|
+
- Deep GitHub data access through the REST API
|
|
49
49
|
- Modular and extensible architecture
|
|
50
50
|
|
|
51
51
|
---
|
|
@@ -54,7 +54,7 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
54
54
|
|
|
55
55
|
- Modular system (easy to extend and hack on)
|
|
56
56
|
- CLI-first workflow
|
|
57
|
-
- GitHub API integration
|
|
57
|
+
- GitHub API integration through REST; GraphQL planned
|
|
58
58
|
- Repository insights
|
|
59
59
|
- User analysis
|
|
60
60
|
- Filter PRs vs issues automatically
|
|
@@ -62,6 +62,7 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
62
62
|
- Cleaned descriptions (HTML stripped)
|
|
63
63
|
- Analytics modules (in progress)
|
|
64
64
|
- Search users, repos, issues, PRs, and topics
|
|
65
|
+
- Three data formats
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
---
|
|
@@ -74,12 +75,12 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
74
75
|
pip install gitraze
|
|
75
76
|
```
|
|
76
77
|
|
|
77
|
-
###
|
|
78
|
+
### From source code
|
|
78
79
|
|
|
79
80
|
> Read the `Development setup` section.
|
|
80
81
|
|
|
81
82
|
---
|
|
82
|
-
> There may be some
|
|
83
|
+
> There may be some gaps between releases on GitHub and PyPI, as multiple commits are sometimes clustered into a single release on PyPI.
|
|
83
84
|
|
|
84
85
|
|
|
85
86
|
## Usage
|
|
@@ -90,9 +91,9 @@ Example:
|
|
|
90
91
|
```bash
|
|
91
92
|
gitraze --version
|
|
92
93
|
gitraze --help
|
|
93
|
-
gitraze user octocat --format=raw
|
|
94
|
-
gitraze repo torvalds/linux --format=full
|
|
95
|
-
gitraze search repos "machine learning" -n 5 --format=compact
|
|
94
|
+
gitraze user octocat --data-format=raw
|
|
95
|
+
gitraze repo torvalds/linux --data-format=full
|
|
96
|
+
gitraze search repos "machine learning" -n 5 --data-format=compact
|
|
96
97
|
gitraze analyze <target> # Coming soon!
|
|
97
98
|
```
|
|
98
99
|
|
|
@@ -133,7 +134,7 @@ Twitter_username : None
|
|
|
133
134
|
```python
|
|
134
135
|
import gitraze as gz
|
|
135
136
|
|
|
136
|
-
user = gz.user("octocat",
|
|
137
|
+
user = gz.user("octocat", data_format="compact")
|
|
137
138
|
|
|
138
139
|
print(user["name"])
|
|
139
140
|
print(user["followers"])
|
|
@@ -143,7 +144,7 @@ print(user["followers"])
|
|
|
143
144
|
```python
|
|
144
145
|
import gitraze as gz
|
|
145
146
|
|
|
146
|
-
repo = gz.repo("torvalds", "linux",
|
|
147
|
+
repo = gz.repo("torvalds", "linux", data_format="full")
|
|
147
148
|
|
|
148
149
|
print(repo["name"])
|
|
149
150
|
print(repo["owner"])
|
|
@@ -156,29 +157,29 @@ print(repo["owner"])
|
|
|
156
157
|
```python
|
|
157
158
|
import gitraze as gz
|
|
158
159
|
|
|
159
|
-
results = gz.search(gz.REPOS, "machine learning", 3,
|
|
160
|
+
results = gz.search(gz.REPOS, "machine learning", 3, data_format="compact")
|
|
160
161
|
|
|
161
162
|
for repo in results:
|
|
162
163
|
print(repo["full_name"])
|
|
163
164
|
```
|
|
164
165
|
|
|
165
|
-
###
|
|
166
|
+
### Data Formats:
|
|
166
167
|
|
|
167
|
-
All three SDK functions support
|
|
168
|
+
All three SDK functions support different data formats:
|
|
168
169
|
|
|
169
170
|
```python
|
|
170
171
|
import gitraze as gz
|
|
171
172
|
|
|
172
|
-
user = gz.user("octocat",
|
|
173
|
-
repo = gz.repo("torvalds", "linux",
|
|
174
|
-
results = gz.search(gz.REPOS, "machine learning", 3,
|
|
173
|
+
user = gz.user("octocat", data_format="full")
|
|
174
|
+
repo = gz.repo("torvalds", "linux", data_format="raw")
|
|
175
|
+
results = gz.search(gz.REPOS, "machine learning", 3, data_format="full")
|
|
175
176
|
```
|
|
176
177
|
|
|
177
178
|
#### Available options are:
|
|
178
179
|
|
|
179
|
-
* `
|
|
180
|
-
* `
|
|
181
|
-
* `
|
|
180
|
+
* `data_format="compact"`: Returns a concise, human-friendly subset of the most useful fields.
|
|
181
|
+
* `data_format="full"`: Returns all available processed fields exposed by Gitraze.
|
|
182
|
+
* `data_format="raw"`: Returns the raw GitHub API response without filtering or formatting.
|
|
182
183
|
|
|
183
184
|
|
|
184
185
|
### Pretty-print results in terminal style:
|
|
@@ -218,9 +219,9 @@ Twitter_username : None
|
|
|
218
219
|
|
|
219
220
|
### Functions:
|
|
220
221
|
|
|
221
|
-
- `user(username,
|
|
222
|
-
- `repo(owner, repo,
|
|
223
|
-
- `search(category, query, limit=1,
|
|
222
|
+
- `user(username, data_format="compact")`
|
|
223
|
+
- `repo(owner, repo, data_format="compact")`
|
|
224
|
+
- `search(category, query, limit=1, data_format="compact")`
|
|
224
225
|
- `display(data)`
|
|
225
226
|
|
|
226
227
|
### Constants:
|
|
@@ -240,8 +241,7 @@ Twitter_username : None
|
|
|
240
241
|
|
|
241
242
|
Gitraze is built for speed, clarity, and control.
|
|
242
243
|
|
|
243
|
-
No
|
|
244
|
-
Just raw access to GitHub data — the way it should be.
|
|
244
|
+
No clutter, no distractions — just raw access to GitHub data, the way it should be.
|
|
245
245
|
|
|
246
246
|
If you live in the terminal, Gitraze lives with you.
|
|
247
247
|
|
|
@@ -262,7 +262,7 @@ Gitraze is in active development:
|
|
|
262
262
|
- Expect breaking changes
|
|
263
263
|
- Some commands may not work
|
|
264
264
|
- Features are being added rapidly
|
|
265
|
-
- GraphQL
|
|
265
|
+
- GraphQL is not implemented yet; Gitraze is REST-focused for now.
|
|
266
266
|
|
|
267
267
|
If you're here early — you're basically a beta tester.
|
|
268
268
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Gitraze
|
|
2
2
|
|
|
3
|
-
> A
|
|
3
|
+
> A CLI and Python library for GitHub exploration, search, and analysis
|
|
4
4
|
|
|
5
|
-
Gitraze is a
|
|
5
|
+
Gitraze is a CLI and Python library for exploring, analyzing, and extracting insights from GitHub through the REST API, with GraphQL planned.
|
|
6
6
|
|
|
7
7
|
⚠️ **Status:** Early development — expect bugs, missing features, and rapid changes. APIs and CLI may change without notice.
|
|
8
8
|
|
|
@@ -28,7 +28,7 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
28
28
|
**Gitraze is different:**
|
|
29
29
|
- Fast, minimal, no nonsense
|
|
30
30
|
- Built for developers who think in terminals
|
|
31
|
-
- Deep GitHub data access
|
|
31
|
+
- Deep GitHub data access through the REST API
|
|
32
32
|
- Modular and extensible architecture
|
|
33
33
|
|
|
34
34
|
---
|
|
@@ -37,7 +37,7 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
37
37
|
|
|
38
38
|
- Modular system (easy to extend and hack on)
|
|
39
39
|
- CLI-first workflow
|
|
40
|
-
- GitHub API integration
|
|
40
|
+
- GitHub API integration through REST; GraphQL planned
|
|
41
41
|
- Repository insights
|
|
42
42
|
- User analysis
|
|
43
43
|
- Filter PRs vs issues automatically
|
|
@@ -45,6 +45,7 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
45
45
|
- Cleaned descriptions (HTML stripped)
|
|
46
46
|
- Analytics modules (in progress)
|
|
47
47
|
- Search users, repos, issues, PRs, and topics
|
|
48
|
+
- Three data formats
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
---
|
|
@@ -57,12 +58,12 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
57
58
|
pip install gitraze
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
###
|
|
61
|
+
### From source code
|
|
61
62
|
|
|
62
63
|
> Read the `Development setup` section.
|
|
63
64
|
|
|
64
65
|
---
|
|
65
|
-
> There may be some
|
|
66
|
+
> There may be some gaps between releases on GitHub and PyPI, as multiple commits are sometimes clustered into a single release on PyPI.
|
|
66
67
|
|
|
67
68
|
|
|
68
69
|
## Usage
|
|
@@ -73,9 +74,9 @@ Example:
|
|
|
73
74
|
```bash
|
|
74
75
|
gitraze --version
|
|
75
76
|
gitraze --help
|
|
76
|
-
gitraze user octocat --format=raw
|
|
77
|
-
gitraze repo torvalds/linux --format=full
|
|
78
|
-
gitraze search repos "machine learning" -n 5 --format=compact
|
|
77
|
+
gitraze user octocat --data-format=raw
|
|
78
|
+
gitraze repo torvalds/linux --data-format=full
|
|
79
|
+
gitraze search repos "machine learning" -n 5 --data-format=compact
|
|
79
80
|
gitraze analyze <target> # Coming soon!
|
|
80
81
|
```
|
|
81
82
|
|
|
@@ -116,7 +117,7 @@ Twitter_username : None
|
|
|
116
117
|
```python
|
|
117
118
|
import gitraze as gz
|
|
118
119
|
|
|
119
|
-
user = gz.user("octocat",
|
|
120
|
+
user = gz.user("octocat", data_format="compact")
|
|
120
121
|
|
|
121
122
|
print(user["name"])
|
|
122
123
|
print(user["followers"])
|
|
@@ -126,7 +127,7 @@ print(user["followers"])
|
|
|
126
127
|
```python
|
|
127
128
|
import gitraze as gz
|
|
128
129
|
|
|
129
|
-
repo = gz.repo("torvalds", "linux",
|
|
130
|
+
repo = gz.repo("torvalds", "linux", data_format="full")
|
|
130
131
|
|
|
131
132
|
print(repo["name"])
|
|
132
133
|
print(repo["owner"])
|
|
@@ -139,29 +140,29 @@ print(repo["owner"])
|
|
|
139
140
|
```python
|
|
140
141
|
import gitraze as gz
|
|
141
142
|
|
|
142
|
-
results = gz.search(gz.REPOS, "machine learning", 3,
|
|
143
|
+
results = gz.search(gz.REPOS, "machine learning", 3, data_format="compact")
|
|
143
144
|
|
|
144
145
|
for repo in results:
|
|
145
146
|
print(repo["full_name"])
|
|
146
147
|
```
|
|
147
148
|
|
|
148
|
-
###
|
|
149
|
+
### Data Formats:
|
|
149
150
|
|
|
150
|
-
All three SDK functions support
|
|
151
|
+
All three SDK functions support different data formats:
|
|
151
152
|
|
|
152
153
|
```python
|
|
153
154
|
import gitraze as gz
|
|
154
155
|
|
|
155
|
-
user = gz.user("octocat",
|
|
156
|
-
repo = gz.repo("torvalds", "linux",
|
|
157
|
-
results = gz.search(gz.REPOS, "machine learning", 3,
|
|
156
|
+
user = gz.user("octocat", data_format="full")
|
|
157
|
+
repo = gz.repo("torvalds", "linux", data_format="raw")
|
|
158
|
+
results = gz.search(gz.REPOS, "machine learning", 3, data_format="full")
|
|
158
159
|
```
|
|
159
160
|
|
|
160
161
|
#### Available options are:
|
|
161
162
|
|
|
162
|
-
* `
|
|
163
|
-
* `
|
|
164
|
-
* `
|
|
163
|
+
* `data_format="compact"`: Returns a concise, human-friendly subset of the most useful fields.
|
|
164
|
+
* `data_format="full"`: Returns all available processed fields exposed by Gitraze.
|
|
165
|
+
* `data_format="raw"`: Returns the raw GitHub API response without filtering or formatting.
|
|
165
166
|
|
|
166
167
|
|
|
167
168
|
### Pretty-print results in terminal style:
|
|
@@ -201,9 +202,9 @@ Twitter_username : None
|
|
|
201
202
|
|
|
202
203
|
### Functions:
|
|
203
204
|
|
|
204
|
-
- `user(username,
|
|
205
|
-
- `repo(owner, repo,
|
|
206
|
-
- `search(category, query, limit=1,
|
|
205
|
+
- `user(username, data_format="compact")`
|
|
206
|
+
- `repo(owner, repo, data_format="compact")`
|
|
207
|
+
- `search(category, query, limit=1, data_format="compact")`
|
|
207
208
|
- `display(data)`
|
|
208
209
|
|
|
209
210
|
### Constants:
|
|
@@ -223,8 +224,7 @@ Twitter_username : None
|
|
|
223
224
|
|
|
224
225
|
Gitraze is built for speed, clarity, and control.
|
|
225
226
|
|
|
226
|
-
No
|
|
227
|
-
Just raw access to GitHub data — the way it should be.
|
|
227
|
+
No clutter, no distractions — just raw access to GitHub data, the way it should be.
|
|
228
228
|
|
|
229
229
|
If you live in the terminal, Gitraze lives with you.
|
|
230
230
|
|
|
@@ -245,7 +245,7 @@ Gitraze is in active development:
|
|
|
245
245
|
- Expect breaking changes
|
|
246
246
|
- Some commands may not work
|
|
247
247
|
- Features are being added rapidly
|
|
248
|
-
- GraphQL
|
|
248
|
+
- GraphQL is not implemented yet; Gitraze is REST-focused for now.
|
|
249
249
|
|
|
250
250
|
If you're here early — you're basically a beta tester.
|
|
251
251
|
|
|
@@ -6,16 +6,18 @@ from gitraze.handlers.analyze import handle_analysis
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def main():
|
|
9
|
+
"""Parse CLI arguments and dispatch the selected command."""
|
|
10
|
+
|
|
9
11
|
parser = argparse.ArgumentParser(
|
|
10
12
|
prog="gitraze",
|
|
11
|
-
description="
|
|
13
|
+
description="Gitraze CLI Tool"
|
|
12
14
|
)
|
|
13
15
|
|
|
14
16
|
# Global flag
|
|
15
17
|
parser.add_argument(
|
|
16
18
|
"--version",
|
|
17
19
|
action="version",
|
|
18
|
-
version="gitraze 0.
|
|
20
|
+
version="gitraze 0.4.0"
|
|
19
21
|
)
|
|
20
22
|
|
|
21
23
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
@@ -23,14 +25,14 @@ def main():
|
|
|
23
25
|
# USER
|
|
24
26
|
user_parser = subparsers.add_parser("user", help="Fetch user info (GitHub username)")
|
|
25
27
|
user_parser.add_argument("username", help="Format: username")
|
|
26
|
-
user_parser.add_argument("--format", choices=["compact", "full", "raw"], default="compact", help="
|
|
28
|
+
user_parser.add_argument("--data-format", choices=["compact", "full", "raw"], default="compact", help="Data format (default: compact)")
|
|
27
29
|
user_parser.set_defaults(func=handle_user)
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
# REPO
|
|
31
33
|
repo_parser = subparsers.add_parser("repo", help="Fetch repo info (Repository in owner/repo format)")
|
|
32
34
|
repo_parser.add_argument("repo", help="Format: owner/repo")
|
|
33
|
-
repo_parser.add_argument("--format", choices=["compact", "full", "raw"], default="compact", help="
|
|
35
|
+
repo_parser.add_argument("--data-format", choices=["compact", "full", "raw"], default="compact", help="Data format (default: compact)")
|
|
34
36
|
repo_parser.set_defaults(func=handle_repo)
|
|
35
37
|
|
|
36
38
|
|
|
@@ -39,7 +41,7 @@ def main():
|
|
|
39
41
|
search_parser.add_argument("category",choices=["repos", "users", "issues", "prs", "topics"],help="repos | users | issues | prs | topics")
|
|
40
42
|
search_parser.add_argument("query", nargs="+", help="Search category (repos, users, issues, topics)")
|
|
41
43
|
search_parser.add_argument("-n", "--limit", type=int, default=1, help="Number of results to show")
|
|
42
|
-
search_parser.add_argument("--format", choices=["compact", "full", "raw"], default="compact", help="
|
|
44
|
+
search_parser.add_argument("--data-format", choices=["compact", "full", "raw"], default="compact", help="Data format (default: compact)")
|
|
43
45
|
search_parser.set_defaults(func=handle_search)
|
|
44
46
|
|
|
45
47
|
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
# config.py
|
|
2
1
|
|
|
3
|
-
'''=============REST=============='''
|
|
4
2
|
|
|
5
|
-
#
|
|
3
|
+
# BASE CONFIGS
|
|
6
4
|
REST_BASE_URL = "https://api.github.com"
|
|
7
5
|
GRAPHQL_URL = "https://api.github.com/graphql"
|
|
8
6
|
DEFAULT_TIMEOUT = 10
|
|
9
7
|
DEFAULT_HEADERS = {
|
|
10
8
|
"Accept": "application/vnd.github+json"}
|
|
11
9
|
|
|
12
|
-
#
|
|
10
|
+
# SEARCH CATEGORIES CONFIG
|
|
13
11
|
SEARCH_MAP = {
|
|
14
12
|
"repos": "repositories",
|
|
15
13
|
"users": "users",
|
|
@@ -4,6 +4,8 @@ from gitraze.config import REST_BASE_URL, DEFAULT_HEADERS, DEFAULT_TIMEOUT
|
|
|
4
4
|
from gitraze.config import SEARCH_MAP
|
|
5
5
|
|
|
6
6
|
def get_user(username):
|
|
7
|
+
"""Fetch raw user data from the GitHub REST API."""
|
|
8
|
+
|
|
7
9
|
url = f"{REST_BASE_URL}/users/{username}"
|
|
8
10
|
|
|
9
11
|
try:
|
|
@@ -23,6 +25,8 @@ def get_user(username):
|
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
def get_repo(owner, repo):
|
|
28
|
+
"""Fetch raw repository data from the GitHub REST API."""
|
|
29
|
+
|
|
26
30
|
url = f"{REST_BASE_URL}/repos/{owner}/{repo}"
|
|
27
31
|
try:
|
|
28
32
|
response = requests.get(
|
|
@@ -40,6 +44,8 @@ def get_repo(owner, repo):
|
|
|
40
44
|
return {"error": f"Request failed: {str(e)}"}
|
|
41
45
|
|
|
42
46
|
def get_search(category, query):
|
|
47
|
+
"""Fetch raw search results from the GitHub REST API."""
|
|
48
|
+
|
|
43
49
|
url = f"{REST_BASE_URL}/search/{SEARCH_MAP.get(category)}"
|
|
44
50
|
|
|
45
51
|
filters = []
|
|
@@ -3,6 +3,8 @@ from gitraze.utils.helpers import pretty_print
|
|
|
3
3
|
from gitraze.modules.repo import get_repo_rest
|
|
4
4
|
|
|
5
5
|
def handle_repo(args):
|
|
6
|
+
"""Handle the repo CLI command."""
|
|
7
|
+
|
|
6
8
|
print("[+] Fetching repository data...")
|
|
7
9
|
parts = args.repo.split("/")
|
|
8
10
|
|
|
@@ -10,7 +12,7 @@ def handle_repo(args):
|
|
|
10
12
|
print("Invalid format. Use: owner/repo")
|
|
11
13
|
return
|
|
12
14
|
owner, repo = parts
|
|
13
|
-
data = get_repo_rest(owner, repo,
|
|
15
|
+
data = get_repo_rest(owner, repo, data_format=args.data_format)
|
|
14
16
|
|
|
15
17
|
if "error" in data:
|
|
16
18
|
print(data["error"])
|
|
@@ -18,7 +20,7 @@ def handle_repo(args):
|
|
|
18
20
|
|
|
19
21
|
print("[✓] Done")
|
|
20
22
|
|
|
21
|
-
if args.
|
|
23
|
+
if args.data_format == "raw":
|
|
22
24
|
print(json.dumps(data, indent=2))
|
|
23
25
|
return
|
|
24
26
|
pretty_print(data, title=f"User: {owner}, Repository: {repo}")
|
|
@@ -3,6 +3,8 @@ from gitraze.utils.helpers import pretty_print
|
|
|
3
3
|
from gitraze.modules.search import get_search_rest
|
|
4
4
|
|
|
5
5
|
def handle_search(args):
|
|
6
|
+
"""Handle the search CLI command."""
|
|
7
|
+
|
|
6
8
|
category = args.category
|
|
7
9
|
|
|
8
10
|
raw_query = " ".join(args.query)
|
|
@@ -12,7 +14,7 @@ def handle_search(args):
|
|
|
12
14
|
print(f"[+] Searching {category} for {query}...")
|
|
13
15
|
|
|
14
16
|
|
|
15
|
-
data = get_search_rest(category, query, args.limit,
|
|
17
|
+
data = get_search_rest(category, query, args.limit, data_format=args.data_format)
|
|
16
18
|
|
|
17
19
|
if "error" in data:
|
|
18
20
|
print(data["error"])
|
|
@@ -20,7 +22,7 @@ def handle_search(args):
|
|
|
20
22
|
|
|
21
23
|
print("[✓] Done")
|
|
22
24
|
|
|
23
|
-
if args.
|
|
25
|
+
if args.data_format == "raw":
|
|
24
26
|
print(json.dumps(data, indent=2))
|
|
25
27
|
return
|
|
26
28
|
|
|
@@ -3,8 +3,10 @@ from gitraze.utils.helpers import pretty_print
|
|
|
3
3
|
from gitraze.modules.user import get_user_rest
|
|
4
4
|
|
|
5
5
|
def handle_user(args):
|
|
6
|
+
"""Handle the user CLI command."""
|
|
7
|
+
|
|
6
8
|
print("[+] Fetching user data...")
|
|
7
|
-
data = get_user_rest(args.username,
|
|
9
|
+
data = get_user_rest(args.username, data_format=args.data_format)
|
|
8
10
|
|
|
9
11
|
if "error" in data:
|
|
10
12
|
print(data["error"])
|
|
@@ -12,7 +14,7 @@ def handle_user(args):
|
|
|
12
14
|
|
|
13
15
|
print("[✓] Done")
|
|
14
16
|
|
|
15
|
-
if args.
|
|
17
|
+
if args.data_format == "raw":
|
|
16
18
|
print(json.dumps(data, indent=2))
|
|
17
19
|
return
|
|
18
20
|
|
|
@@ -3,15 +3,26 @@ from gitraze.utils.helpers import format_date
|
|
|
3
3
|
from gitraze.utils.helpers import normalize_api_data
|
|
4
4
|
from gitraze.core.api_rest import get_repo as rest_get_repo
|
|
5
5
|
|
|
6
|
-
def get_repo_rest(owner, repo,
|
|
6
|
+
def get_repo_rest(owner, repo, data_format="compact"):
|
|
7
|
+
"""Fetch GitHub repository data in the requested data format.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
owner: GitHub repository owner's username or organization name.
|
|
11
|
+
repo: GitHub repository name.
|
|
12
|
+
data_format: Data format: "compact", "full", or "raw".
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
Repository data in the requested format, or an error dictionary.
|
|
16
|
+
"""
|
|
17
|
+
|
|
7
18
|
data = rest_get_repo(owner, repo)
|
|
8
19
|
|
|
9
20
|
if "error" in data:
|
|
10
21
|
return data
|
|
11
22
|
|
|
12
|
-
if
|
|
23
|
+
if data_format == "raw":
|
|
13
24
|
return data
|
|
14
|
-
if
|
|
25
|
+
if data_format == "full":
|
|
15
26
|
return normalize_api_data(data)
|
|
16
27
|
|
|
17
28
|
return {
|
|
@@ -5,11 +5,23 @@ from gitraze.utils.helpers import normalize_api_data
|
|
|
5
5
|
from gitraze.core.api_rest import get_search
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def get_search_rest(category, query, limit=1,
|
|
8
|
+
def get_search_rest(category, query, limit=1, data_format="compact"):
|
|
9
|
+
"""Search GitHub and return results in the requested data format.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
category: Search category: "repos", "users", "issues", "prs", or "topics".
|
|
13
|
+
query: Search query passed to GitHub.
|
|
14
|
+
limit: Maximum number of results to return.
|
|
15
|
+
data_format: Data format: "compact", "full", or "raw".
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
Search results in the requested format, or an error dictionary.
|
|
19
|
+
"""
|
|
20
|
+
|
|
9
21
|
if category not in ["repos", "users", "issues", "prs", "topics"]:
|
|
10
22
|
return {"error": "Invalid category"}
|
|
11
|
-
if
|
|
12
|
-
return {"error": "Invalid
|
|
23
|
+
if data_format not in ["compact", "full", "raw"]:
|
|
24
|
+
return {"error": "Invalid data format"}
|
|
13
25
|
|
|
14
26
|
data = get_search(category, query)
|
|
15
27
|
if "error" in data:
|
|
@@ -25,9 +37,9 @@ def get_search_rest(category, query, limit=1, output_format="compact"):
|
|
|
25
37
|
return {"error": "No results found"}
|
|
26
38
|
items = items[:limit]
|
|
27
39
|
|
|
28
|
-
if
|
|
40
|
+
if data_format == "raw":
|
|
29
41
|
return items
|
|
30
|
-
if
|
|
42
|
+
if data_format == "full":
|
|
31
43
|
return [normalize_api_data(item) for item in items]
|
|
32
44
|
|
|
33
45
|
results = []
|
|
@@ -3,16 +3,26 @@ from gitraze.utils.helpers import format_date
|
|
|
3
3
|
from gitraze.utils.helpers import normalize_api_data
|
|
4
4
|
from gitraze.core.api_rest import get_user as rest_get_user
|
|
5
5
|
|
|
6
|
-
def get_user_rest(username,
|
|
6
|
+
def get_user_rest(username, data_format="compact"):
|
|
7
|
+
"""Fetch GitHub user data in the requested data format.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
username: GitHub username to fetch.
|
|
11
|
+
data_format: Data format: "compact", "full", or "raw".
|
|
12
|
+
|
|
13
|
+
Returns:
|
|
14
|
+
User data in the requested format, or an error dictionary.
|
|
15
|
+
"""
|
|
16
|
+
|
|
7
17
|
data = rest_get_user(username)
|
|
8
18
|
|
|
9
19
|
if "error" in data:
|
|
10
20
|
return data
|
|
11
21
|
|
|
12
22
|
|
|
13
|
-
if
|
|
23
|
+
if data_format == "raw":
|
|
14
24
|
return data
|
|
15
|
-
if
|
|
25
|
+
if data_format == "full":
|
|
16
26
|
return normalize_api_data(data)
|
|
17
27
|
|
|
18
28
|
return {
|
|
@@ -7,6 +7,8 @@ init(autoreset=True)
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def pretty_print(data, title=None):
|
|
10
|
+
"""Print dictionary data as formatted key-value pairs."""
|
|
11
|
+
|
|
10
12
|
if not isinstance(data, dict):
|
|
11
13
|
print(Fore.RED + "Invalid data format")
|
|
12
14
|
return
|
|
@@ -31,7 +33,8 @@ def pretty_print(data, title=None):
|
|
|
31
33
|
print() # spacing
|
|
32
34
|
|
|
33
35
|
def display(data, title=None):
|
|
34
|
-
|
|
36
|
+
"""Display dictionary or list data in a formatted terminal layout."""
|
|
37
|
+
|
|
35
38
|
if isinstance(data, list):
|
|
36
39
|
|
|
37
40
|
if not data:
|
|
@@ -39,9 +42,7 @@ def display(data, title=None):
|
|
|
39
42
|
return
|
|
40
43
|
|
|
41
44
|
for i, item in enumerate(data, 1):
|
|
42
|
-
|
|
43
45
|
item_title = f"{title} [{i}]" if title else f"Result [{i}]"
|
|
44
|
-
|
|
45
46
|
pretty_print(item, title=item_title)
|
|
46
47
|
|
|
47
48
|
return
|
|
@@ -49,6 +50,8 @@ def display(data, title=None):
|
|
|
49
50
|
pretty_print(data, title=f"Result: ")
|
|
50
51
|
|
|
51
52
|
def format_date(date_str):
|
|
53
|
+
"""Format a GitHub API date string for display."""
|
|
54
|
+
|
|
52
55
|
if not date_str:
|
|
53
56
|
return None
|
|
54
57
|
|
|
@@ -58,11 +61,14 @@ def format_date(date_str):
|
|
|
58
61
|
return date_str # fallback (don’t crash)
|
|
59
62
|
|
|
60
63
|
def clean_html(text):
|
|
64
|
+
"""Remove HTML tags from text."""
|
|
65
|
+
|
|
61
66
|
return re.sub(r"<.*?>", "", text) if text else text
|
|
62
67
|
|
|
63
68
|
def normalize_api_data(data):
|
|
64
|
-
|
|
69
|
+
"""Normalize API data for human-readable output."""
|
|
65
70
|
|
|
71
|
+
cleaned = {}
|
|
66
72
|
for key, value in data.items():
|
|
67
73
|
|
|
68
74
|
if key.endswith("_at") and isinstance(value, str):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitraze
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A CLI and Python library for GitHub
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: A CLI and Python library for GitHub exploration, search, and analysis
|
|
5
5
|
Author: AK Pandey
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/akpandey-dev/gitraze
|
|
@@ -17,9 +17,9 @@ Dynamic: license-file
|
|
|
17
17
|
|
|
18
18
|
# Gitraze
|
|
19
19
|
|
|
20
|
-
> A
|
|
20
|
+
> A CLI and Python library for GitHub exploration, search, and analysis
|
|
21
21
|
|
|
22
|
-
Gitraze is a
|
|
22
|
+
Gitraze is a CLI and Python library for exploring, analyzing, and extracting insights from GitHub through the REST API, with GraphQL planned.
|
|
23
23
|
|
|
24
24
|
⚠️ **Status:** Early development — expect bugs, missing features, and rapid changes. APIs and CLI may change without notice.
|
|
25
25
|
|
|
@@ -45,7 +45,7 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
45
45
|
**Gitraze is different:**
|
|
46
46
|
- Fast, minimal, no nonsense
|
|
47
47
|
- Built for developers who think in terminals
|
|
48
|
-
- Deep GitHub data access
|
|
48
|
+
- Deep GitHub data access through the REST API
|
|
49
49
|
- Modular and extensible architecture
|
|
50
50
|
|
|
51
51
|
---
|
|
@@ -54,7 +54,7 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
54
54
|
|
|
55
55
|
- Modular system (easy to extend and hack on)
|
|
56
56
|
- CLI-first workflow
|
|
57
|
-
- GitHub API integration
|
|
57
|
+
- GitHub API integration through REST; GraphQL planned
|
|
58
58
|
- Repository insights
|
|
59
59
|
- User analysis
|
|
60
60
|
- Filter PRs vs issues automatically
|
|
@@ -62,6 +62,7 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
62
62
|
- Cleaned descriptions (HTML stripped)
|
|
63
63
|
- Analytics modules (in progress)
|
|
64
64
|
- Search users, repos, issues, PRs, and topics
|
|
65
|
+
- Three data formats
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
---
|
|
@@ -74,12 +75,12 @@ Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
|
74
75
|
pip install gitraze
|
|
75
76
|
```
|
|
76
77
|
|
|
77
|
-
###
|
|
78
|
+
### From source code
|
|
78
79
|
|
|
79
80
|
> Read the `Development setup` section.
|
|
80
81
|
|
|
81
82
|
---
|
|
82
|
-
> There may be some
|
|
83
|
+
> There may be some gaps between releases on GitHub and PyPI, as multiple commits are sometimes clustered into a single release on PyPI.
|
|
83
84
|
|
|
84
85
|
|
|
85
86
|
## Usage
|
|
@@ -90,9 +91,9 @@ Example:
|
|
|
90
91
|
```bash
|
|
91
92
|
gitraze --version
|
|
92
93
|
gitraze --help
|
|
93
|
-
gitraze user octocat --format=raw
|
|
94
|
-
gitraze repo torvalds/linux --format=full
|
|
95
|
-
gitraze search repos "machine learning" -n 5 --format=compact
|
|
94
|
+
gitraze user octocat --data-format=raw
|
|
95
|
+
gitraze repo torvalds/linux --data-format=full
|
|
96
|
+
gitraze search repos "machine learning" -n 5 --data-format=compact
|
|
96
97
|
gitraze analyze <target> # Coming soon!
|
|
97
98
|
```
|
|
98
99
|
|
|
@@ -133,7 +134,7 @@ Twitter_username : None
|
|
|
133
134
|
```python
|
|
134
135
|
import gitraze as gz
|
|
135
136
|
|
|
136
|
-
user = gz.user("octocat",
|
|
137
|
+
user = gz.user("octocat", data_format="compact")
|
|
137
138
|
|
|
138
139
|
print(user["name"])
|
|
139
140
|
print(user["followers"])
|
|
@@ -143,7 +144,7 @@ print(user["followers"])
|
|
|
143
144
|
```python
|
|
144
145
|
import gitraze as gz
|
|
145
146
|
|
|
146
|
-
repo = gz.repo("torvalds", "linux",
|
|
147
|
+
repo = gz.repo("torvalds", "linux", data_format="full")
|
|
147
148
|
|
|
148
149
|
print(repo["name"])
|
|
149
150
|
print(repo["owner"])
|
|
@@ -156,29 +157,29 @@ print(repo["owner"])
|
|
|
156
157
|
```python
|
|
157
158
|
import gitraze as gz
|
|
158
159
|
|
|
159
|
-
results = gz.search(gz.REPOS, "machine learning", 3,
|
|
160
|
+
results = gz.search(gz.REPOS, "machine learning", 3, data_format="compact")
|
|
160
161
|
|
|
161
162
|
for repo in results:
|
|
162
163
|
print(repo["full_name"])
|
|
163
164
|
```
|
|
164
165
|
|
|
165
|
-
###
|
|
166
|
+
### Data Formats:
|
|
166
167
|
|
|
167
|
-
All three SDK functions support
|
|
168
|
+
All three SDK functions support different data formats:
|
|
168
169
|
|
|
169
170
|
```python
|
|
170
171
|
import gitraze as gz
|
|
171
172
|
|
|
172
|
-
user = gz.user("octocat",
|
|
173
|
-
repo = gz.repo("torvalds", "linux",
|
|
174
|
-
results = gz.search(gz.REPOS, "machine learning", 3,
|
|
173
|
+
user = gz.user("octocat", data_format="full")
|
|
174
|
+
repo = gz.repo("torvalds", "linux", data_format="raw")
|
|
175
|
+
results = gz.search(gz.REPOS, "machine learning", 3, data_format="full")
|
|
175
176
|
```
|
|
176
177
|
|
|
177
178
|
#### Available options are:
|
|
178
179
|
|
|
179
|
-
* `
|
|
180
|
-
* `
|
|
181
|
-
* `
|
|
180
|
+
* `data_format="compact"`: Returns a concise, human-friendly subset of the most useful fields.
|
|
181
|
+
* `data_format="full"`: Returns all available processed fields exposed by Gitraze.
|
|
182
|
+
* `data_format="raw"`: Returns the raw GitHub API response without filtering or formatting.
|
|
182
183
|
|
|
183
184
|
|
|
184
185
|
### Pretty-print results in terminal style:
|
|
@@ -218,9 +219,9 @@ Twitter_username : None
|
|
|
218
219
|
|
|
219
220
|
### Functions:
|
|
220
221
|
|
|
221
|
-
- `user(username,
|
|
222
|
-
- `repo(owner, repo,
|
|
223
|
-
- `search(category, query, limit=1,
|
|
222
|
+
- `user(username, data_format="compact")`
|
|
223
|
+
- `repo(owner, repo, data_format="compact")`
|
|
224
|
+
- `search(category, query, limit=1, data_format="compact")`
|
|
224
225
|
- `display(data)`
|
|
225
226
|
|
|
226
227
|
### Constants:
|
|
@@ -240,8 +241,7 @@ Twitter_username : None
|
|
|
240
241
|
|
|
241
242
|
Gitraze is built for speed, clarity, and control.
|
|
242
243
|
|
|
243
|
-
No
|
|
244
|
-
Just raw access to GitHub data — the way it should be.
|
|
244
|
+
No clutter, no distractions — just raw access to GitHub data, the way it should be.
|
|
245
245
|
|
|
246
246
|
If you live in the terminal, Gitraze lives with you.
|
|
247
247
|
|
|
@@ -262,7 +262,7 @@ Gitraze is in active development:
|
|
|
262
262
|
- Expect breaking changes
|
|
263
263
|
- Some commands may not work
|
|
264
264
|
- Features are being added rapidly
|
|
265
|
-
- GraphQL
|
|
265
|
+
- GraphQL is not implemented yet; Gitraze is REST-focused for now.
|
|
266
266
|
|
|
267
267
|
If you're here early — you're basically a beta tester.
|
|
268
268
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "gitraze"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "A CLI and Python library for GitHub
|
|
3
|
+
version = "0.4.0"
|
|
4
|
+
description = "A CLI and Python library for GitHub exploration, search, and analysis"
|
|
5
5
|
authors = [{ name = "AK Pandey" }]
|
|
6
6
|
dependencies = ["requests", "colorama"]
|
|
7
7
|
readme = "README.md"
|
|
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
|