gitraze 0.4.0__tar.gz → 0.5.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.5.0/PKG-INFO +176 -0
- gitraze-0.5.0/README.md +159 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/__init__.py +5 -1
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/cli.py +4 -1
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/handlers/repo.py +9 -4
- gitraze-0.5.0/gitraze/handlers/search.py +37 -0
- gitraze-0.5.0/gitraze/handlers/user.py +25 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/utils/helpers.py +29 -0
- gitraze-0.5.0/gitraze.egg-info/PKG-INFO +176 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/pyproject.toml +1 -1
- gitraze-0.4.0/PKG-INFO +0 -287
- gitraze-0.4.0/README.md +0 -270
- gitraze-0.4.0/gitraze/handlers/search.py +0 -33
- gitraze-0.4.0/gitraze/handlers/user.py +0 -21
- gitraze-0.4.0/gitraze.egg-info/PKG-INFO +0 -287
- {gitraze-0.4.0 → gitraze-0.5.0}/LICENSE +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/config.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/core/__init__.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/core/api_rest.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/handlers/__init__.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/handlers/analyze.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/modules/__init__.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/modules/analytics.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/modules/repo.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/modules/search.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/modules/user.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze/utils/__init__.py +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze.egg-info/SOURCES.txt +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze.egg-info/dependency_links.txt +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze.egg-info/entry_points.txt +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze.egg-info/requires.txt +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/gitraze.egg-info/top_level.txt +0 -0
- {gitraze-0.4.0 → gitraze-0.5.0}/setup.cfg +0 -0
gitraze-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitraze
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: A CLI and Python library for GitHub exploration, search, and analysis
|
|
5
|
+
Author: AK Pandey
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/akpandey-dev/gitraze
|
|
8
|
+
Keywords: github,cli,api,recon,search,github-user,repository
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: requests
|
|
15
|
+
Requires-Dist: colorama
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# Gitraze
|
|
19
|
+
|
|
20
|
+
> A CLI and Python library for GitHub exploration, search, and analysis
|
|
21
|
+
|
|
22
|
+
Gitraze is a CLI and Python library for exploring, analyzing, and extracting insights from GitHub through the REST API, with GraphQL planned.
|
|
23
|
+
|
|
24
|
+
**Status:** Early development — expect bugs, missing features, and rapid changes. APIs and CLI may change without notice.
|
|
25
|
+
|
|
26
|
+
> Built for developers who prefer terminals over tabs.
|
|
27
|
+
|
|
28
|
+
[](https://pypi.org/project/gitraze/)
|
|
29
|
+
[](https://pypi.org/project/gitraze/)
|
|
30
|
+
[](https://pypi.org/project/gitraze/)
|
|
31
|
+
[](https://github.com/akpandey-dev/gitraze/actions)
|
|
32
|
+
[](LICENSE)
|
|
33
|
+
[](https://github.com/akpandey-dev/gitraze/issues)
|
|
34
|
+
[](https://github.com/akpandey-dev/gitraze)
|
|
35
|
+
[](https://github.com/akpandey-dev/gitraze/commits/main)
|
|
36
|
+
[](https://github.com/akpandey-dev/gitraze/graphs/contributors)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Why Gitraze?
|
|
42
|
+
|
|
43
|
+
Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
44
|
+
|
|
45
|
+
Gitraze is built around a simpler approach:
|
|
46
|
+
|
|
47
|
+
* Fast, minimal, no nonsense
|
|
48
|
+
* Built for developers who think in terminals
|
|
49
|
+
* Deep GitHub data access through the REST API
|
|
50
|
+
* Modular and extensible architecture
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
* Modular system
|
|
57
|
+
* GitHub REST API integration
|
|
58
|
+
* CLI-first workflow
|
|
59
|
+
* SDK support
|
|
60
|
+
* Repository insights
|
|
61
|
+
* User analysis
|
|
62
|
+
* Search users, repositories, issues, pull requests, and topics
|
|
63
|
+
* Automatic filtering of pull requests and issues
|
|
64
|
+
* Human-readable timestamps
|
|
65
|
+
* Cleaned descriptions
|
|
66
|
+
* Three data formats
|
|
67
|
+
* Save or display output
|
|
68
|
+
* Analytics modules in progress
|
|
69
|
+
* GraphQL planned
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
### From PyPI
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install gitraze
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### From source
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/akpandey-dev/gitraze.git
|
|
85
|
+
cd gitraze
|
|
86
|
+
pip install -e .
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> There may be some gaps between releases on GitHub and PyPI, as multiple commits are sometimes clustered into a single release on PyPI.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
Gitraze can be used from the command line or as a Python library.
|
|
97
|
+
|
|
98
|
+
### CLI
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
gitraze --help
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Example:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
gitraze --version
|
|
108
|
+
gitraze --help
|
|
109
|
+
gitraze user octocat --data-format=raw --output-action=save
|
|
110
|
+
gitraze repo torvalds/linux --data-format=full # Query format must match
|
|
111
|
+
gitraze search repos "machine learning" -n 5 --data-format=compact
|
|
112
|
+
gitraze analyze <target> # Coming soon!
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Python
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import gitraze as gz
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For example:
|
|
122
|
+
```python
|
|
123
|
+
import gitraze as gz
|
|
124
|
+
user = gz.user("octocat", data_format="compact")
|
|
125
|
+
print(user["name"])
|
|
126
|
+
print(user["followers"])
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
For command usage, API reference, output formats, and examples, see the **[documentation](docs/)**.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Philosophy
|
|
134
|
+
|
|
135
|
+
Gitraze is built for speed, clarity, and control.
|
|
136
|
+
|
|
137
|
+
No clutter, no distractions — just raw access to GitHub data, the way it should be.
|
|
138
|
+
|
|
139
|
+
If you live in the terminal, Gitraze lives with you.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Project Status
|
|
144
|
+
|
|
145
|
+
Gitraze is in active development:
|
|
146
|
+
|
|
147
|
+
* Expect breaking changes
|
|
148
|
+
* Some commands may not work
|
|
149
|
+
* Features are being added rapidly
|
|
150
|
+
* GraphQL is not implemented yet; Gitraze is REST-focused for now
|
|
151
|
+
|
|
152
|
+
If you're here early — you're basically a beta tester.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Contributing
|
|
157
|
+
|
|
158
|
+
PRs, ideas, bug reports, and feature suggestions are welcome.
|
|
159
|
+
|
|
160
|
+
If you want to improve or modify Gitraze, go ahead.
|
|
161
|
+
|
|
162
|
+
* Fork the repository
|
|
163
|
+
* Create a feature branch
|
|
164
|
+
* Submit a PR with clean commit messages
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
git checkout -b feature/cool-thing
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Just keep the code clean and the terminal fast.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
MIT License — do whatever you want, just don't blame me if you break stuff.
|
gitraze-0.5.0/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Gitraze
|
|
2
|
+
|
|
3
|
+
> A CLI and Python library for GitHub exploration, search, and analysis
|
|
4
|
+
|
|
5
|
+
Gitraze is a CLI and Python library for exploring, analyzing, and extracting insights from GitHub through the REST API, with GraphQL planned.
|
|
6
|
+
|
|
7
|
+
**Status:** Early development — expect bugs, missing features, and rapid changes. APIs and CLI may change without notice.
|
|
8
|
+
|
|
9
|
+
> Built for developers who prefer terminals over tabs.
|
|
10
|
+
|
|
11
|
+
[](https://pypi.org/project/gitraze/)
|
|
12
|
+
[](https://pypi.org/project/gitraze/)
|
|
13
|
+
[](https://pypi.org/project/gitraze/)
|
|
14
|
+
[](https://github.com/akpandey-dev/gitraze/actions)
|
|
15
|
+
[](LICENSE)
|
|
16
|
+
[](https://github.com/akpandey-dev/gitraze/issues)
|
|
17
|
+
[](https://github.com/akpandey-dev/gitraze)
|
|
18
|
+
[](https://github.com/akpandey-dev/gitraze/commits/main)
|
|
19
|
+
[](https://github.com/akpandey-dev/gitraze/graphs/contributors)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Why Gitraze?
|
|
25
|
+
|
|
26
|
+
Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
27
|
+
|
|
28
|
+
Gitraze is built around a simpler approach:
|
|
29
|
+
|
|
30
|
+
* Fast, minimal, no nonsense
|
|
31
|
+
* Built for developers who think in terminals
|
|
32
|
+
* Deep GitHub data access through the REST API
|
|
33
|
+
* Modular and extensible architecture
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
* Modular system
|
|
40
|
+
* GitHub REST API integration
|
|
41
|
+
* CLI-first workflow
|
|
42
|
+
* SDK support
|
|
43
|
+
* Repository insights
|
|
44
|
+
* User analysis
|
|
45
|
+
* Search users, repositories, issues, pull requests, and topics
|
|
46
|
+
* Automatic filtering of pull requests and issues
|
|
47
|
+
* Human-readable timestamps
|
|
48
|
+
* Cleaned descriptions
|
|
49
|
+
* Three data formats
|
|
50
|
+
* Save or display output
|
|
51
|
+
* Analytics modules in progress
|
|
52
|
+
* GraphQL planned
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
### From PyPI
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install gitraze
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### From source
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/akpandey-dev/gitraze.git
|
|
68
|
+
cd gitraze
|
|
69
|
+
pip install -e .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
> There may be some gaps between releases on GitHub and PyPI, as multiple commits are sometimes clustered into a single release on PyPI.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
Gitraze can be used from the command line or as a Python library.
|
|
80
|
+
|
|
81
|
+
### CLI
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
gitraze --help
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Example:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
gitraze --version
|
|
91
|
+
gitraze --help
|
|
92
|
+
gitraze user octocat --data-format=raw --output-action=save
|
|
93
|
+
gitraze repo torvalds/linux --data-format=full # Query format must match
|
|
94
|
+
gitraze search repos "machine learning" -n 5 --data-format=compact
|
|
95
|
+
gitraze analyze <target> # Coming soon!
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Python
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
import gitraze as gz
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
For example:
|
|
105
|
+
```python
|
|
106
|
+
import gitraze as gz
|
|
107
|
+
user = gz.user("octocat", data_format="compact")
|
|
108
|
+
print(user["name"])
|
|
109
|
+
print(user["followers"])
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
For command usage, API reference, output formats, and examples, see the **[documentation](docs/)**.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Philosophy
|
|
117
|
+
|
|
118
|
+
Gitraze is built for speed, clarity, and control.
|
|
119
|
+
|
|
120
|
+
No clutter, no distractions — just raw access to GitHub data, the way it should be.
|
|
121
|
+
|
|
122
|
+
If you live in the terminal, Gitraze lives with you.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Project Status
|
|
127
|
+
|
|
128
|
+
Gitraze is in active development:
|
|
129
|
+
|
|
130
|
+
* Expect breaking changes
|
|
131
|
+
* Some commands may not work
|
|
132
|
+
* Features are being added rapidly
|
|
133
|
+
* GraphQL is not implemented yet; Gitraze is REST-focused for now
|
|
134
|
+
|
|
135
|
+
If you're here early — you're basically a beta tester.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Contributing
|
|
140
|
+
|
|
141
|
+
PRs, ideas, bug reports, and feature suggestions are welcome.
|
|
142
|
+
|
|
143
|
+
If you want to improve or modify Gitraze, go ahead.
|
|
144
|
+
|
|
145
|
+
* Fork the repository
|
|
146
|
+
* Create a feature branch
|
|
147
|
+
* Submit a PR with clean commit messages
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
git checkout -b feature/cool-thing
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Just keep the code clean and the terminal fast.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
MIT License — do whatever you want, just don't blame me if you break stuff.
|
|
@@ -3,8 +3,10 @@ from .modules.repo import get_repo_rest as repo
|
|
|
3
3
|
from .modules.search import get_search_rest as search
|
|
4
4
|
|
|
5
5
|
from .utils.helpers import display
|
|
6
|
+
from .utils.helpers import save
|
|
7
|
+
from .utils.helpers import output_action
|
|
6
8
|
|
|
7
|
-
__version__ = "0.
|
|
9
|
+
__version__ = "0.5.0"
|
|
8
10
|
|
|
9
11
|
USERS = "users"
|
|
10
12
|
REPOS = "repos"
|
|
@@ -13,7 +15,9 @@ ISSUES = "issues"
|
|
|
13
15
|
TOPICS = "topics"
|
|
14
16
|
|
|
15
17
|
__all__ = [
|
|
18
|
+
"output_action",
|
|
16
19
|
"display",
|
|
20
|
+
"save",
|
|
17
21
|
"user",
|
|
18
22
|
"repo",
|
|
19
23
|
"search",
|
|
@@ -17,7 +17,7 @@ def main():
|
|
|
17
17
|
parser.add_argument(
|
|
18
18
|
"--version",
|
|
19
19
|
action="version",
|
|
20
|
-
version="gitraze 0.
|
|
20
|
+
version="gitraze 0.5.0"
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
@@ -26,6 +26,7 @@ def main():
|
|
|
26
26
|
user_parser = subparsers.add_parser("user", help="Fetch user info (GitHub username)")
|
|
27
27
|
user_parser.add_argument("username", help="Format: username")
|
|
28
28
|
user_parser.add_argument("--data-format", choices=["compact", "full", "raw"], default="compact", help="Data format (default: compact)")
|
|
29
|
+
user_parser.add_argument("--output-action", choices=["display", "save"], default="display", help="Output action (default: display)")
|
|
29
30
|
user_parser.set_defaults(func=handle_user)
|
|
30
31
|
|
|
31
32
|
|
|
@@ -33,6 +34,7 @@ def main():
|
|
|
33
34
|
repo_parser = subparsers.add_parser("repo", help="Fetch repo info (Repository in owner/repo format)")
|
|
34
35
|
repo_parser.add_argument("repo", help="Format: owner/repo")
|
|
35
36
|
repo_parser.add_argument("--data-format", choices=["compact", "full", "raw"], default="compact", help="Data format (default: compact)")
|
|
37
|
+
repo_parser.add_argument("--output-action", choices=["display", "save"], default="display", help="Output action (default: display)")
|
|
36
38
|
repo_parser.set_defaults(func=handle_repo)
|
|
37
39
|
|
|
38
40
|
|
|
@@ -42,6 +44,7 @@ def main():
|
|
|
42
44
|
search_parser.add_argument("query", nargs="+", help="Search category (repos, users, issues, topics)")
|
|
43
45
|
search_parser.add_argument("-n", "--limit", type=int, default=1, help="Number of results to show")
|
|
44
46
|
search_parser.add_argument("--data-format", choices=["compact", "full", "raw"], default="compact", help="Data format (default: compact)")
|
|
47
|
+
search_parser.add_argument("--output-action", choices=["display", "save"], default="display", help="Output action (default: display)")
|
|
45
48
|
search_parser.set_defaults(func=handle_search)
|
|
46
49
|
|
|
47
50
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from gitraze.utils.helpers import pretty_print
|
|
2
|
+
from gitraze.utils.helpers import file_save, pretty_print
|
|
3
3
|
from gitraze.modules.repo import get_repo_rest
|
|
4
4
|
|
|
5
5
|
def handle_repo(args):
|
|
@@ -20,7 +20,12 @@ def handle_repo(args):
|
|
|
20
20
|
|
|
21
21
|
print("[✓] Done")
|
|
22
22
|
|
|
23
|
-
if args.
|
|
24
|
-
|
|
23
|
+
if args.output_action == "save":
|
|
24
|
+
file_save(data, f"{owner}-{repo}-data.json")
|
|
25
25
|
return
|
|
26
|
-
|
|
26
|
+
elif args.output_action == "display":
|
|
27
|
+
if args.data_format == "raw":
|
|
28
|
+
print(json.dumps(data, indent=2))
|
|
29
|
+
return
|
|
30
|
+
else:
|
|
31
|
+
pretty_print(data, title=f"User: {owner}, Repository: {repo}")
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from gitraze.utils.helpers import file_save, pretty_print
|
|
3
|
+
from gitraze.modules.search import get_search_rest
|
|
4
|
+
|
|
5
|
+
def handle_search(args):
|
|
6
|
+
"""Handle the search CLI command."""
|
|
7
|
+
|
|
8
|
+
category = args.category
|
|
9
|
+
|
|
10
|
+
raw_query = " ".join(args.query)
|
|
11
|
+
clean_query = raw_query.replace('"', '')
|
|
12
|
+
query = f'"{clean_query}"'
|
|
13
|
+
|
|
14
|
+
print(f"[+] Searching {category} for {query}...")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
data = get_search_rest(category, query, args.limit, data_format=args.data_format)
|
|
18
|
+
|
|
19
|
+
if "error" in data:
|
|
20
|
+
print(data["error"])
|
|
21
|
+
return
|
|
22
|
+
|
|
23
|
+
print("[✓] Done")
|
|
24
|
+
|
|
25
|
+
if args.output_action == "save":
|
|
26
|
+
file_save(data, f"{category}-{clean_query}-data.json")
|
|
27
|
+
return
|
|
28
|
+
elif args.output_action == "display":
|
|
29
|
+
if args.data_format == "raw":
|
|
30
|
+
print(json.dumps(data, indent=2))
|
|
31
|
+
return
|
|
32
|
+
else:
|
|
33
|
+
if isinstance(data, list):
|
|
34
|
+
for i, item in enumerate(data, 1):
|
|
35
|
+
pretty_print(item, title=f"{category} [{i}] -> {query}")
|
|
36
|
+
else:
|
|
37
|
+
pretty_print(data, title=f"Search: {category} -> {query}")
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from gitraze.utils.helpers import file_save, pretty_print
|
|
3
|
+
from gitraze.modules.user import get_user_rest
|
|
4
|
+
|
|
5
|
+
def handle_user(args):
|
|
6
|
+
"""Handle the user CLI command."""
|
|
7
|
+
|
|
8
|
+
print("[+] Fetching user data...")
|
|
9
|
+
data = get_user_rest(args.username, data_format=args.data_format)
|
|
10
|
+
|
|
11
|
+
if "error" in data:
|
|
12
|
+
print(data["error"])
|
|
13
|
+
return
|
|
14
|
+
|
|
15
|
+
print("[✓] Done")
|
|
16
|
+
|
|
17
|
+
if args.output_action == "save":
|
|
18
|
+
file_save(data, f"{args.username}-data.json")
|
|
19
|
+
return
|
|
20
|
+
elif args.output_action == "display":
|
|
21
|
+
if args.data_format == "raw":
|
|
22
|
+
print(json.dumps(data, indent=2))
|
|
23
|
+
return
|
|
24
|
+
else:
|
|
25
|
+
pretty_print(data, title=f"User: {args.username}")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# helpers.py
|
|
2
2
|
from datetime import datetime
|
|
3
|
+
import json
|
|
3
4
|
from colorama import Fore, Style, init
|
|
4
5
|
import re
|
|
5
6
|
|
|
@@ -49,6 +50,34 @@ def display(data, title=None):
|
|
|
49
50
|
|
|
50
51
|
pretty_print(data, title=f"Result: ")
|
|
51
52
|
|
|
53
|
+
def file_save(data, title=None):
|
|
54
|
+
"""Save dictionary data as JSON file."""
|
|
55
|
+
|
|
56
|
+
filename = title if title else "file.txt"
|
|
57
|
+
with open(filename, "w", encoding="utf-8") as file:
|
|
58
|
+
json.dump(data, file, indent=4, ensure_ascii=False)
|
|
59
|
+
|
|
60
|
+
def save(data, title=None):
|
|
61
|
+
"""Save dictionary or list data as JSON files."""
|
|
62
|
+
|
|
63
|
+
if isinstance(data, list):
|
|
64
|
+
for i, item in enumerate(data, 1):
|
|
65
|
+
filename = f"{title}-{i}.json" if title else f"gitraze-data-{i}.json"
|
|
66
|
+
file_save(item, filename)
|
|
67
|
+
else:
|
|
68
|
+
filename = f"{title}.json" if title else "gitraze-data.json"
|
|
69
|
+
file_save(data, filename)
|
|
70
|
+
|
|
71
|
+
def output_action(action, data, title=None):
|
|
72
|
+
"""Perform the specified output action (display or save) on the data."""
|
|
73
|
+
|
|
74
|
+
if action == "display":
|
|
75
|
+
display(data, title)
|
|
76
|
+
elif action == "save":
|
|
77
|
+
save(data, title)
|
|
78
|
+
else:
|
|
79
|
+
raise ValueError("Invalid action. Use 'display' or 'save'.")
|
|
80
|
+
|
|
52
81
|
def format_date(date_str):
|
|
53
82
|
"""Format a GitHub API date string for display."""
|
|
54
83
|
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitraze
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: A CLI and Python library for GitHub exploration, search, and analysis
|
|
5
|
+
Author: AK Pandey
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/akpandey-dev/gitraze
|
|
8
|
+
Keywords: github,cli,api,recon,search,github-user,repository
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: requests
|
|
15
|
+
Requires-Dist: colorama
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# Gitraze
|
|
19
|
+
|
|
20
|
+
> A CLI and Python library for GitHub exploration, search, and analysis
|
|
21
|
+
|
|
22
|
+
Gitraze is a CLI and Python library for exploring, analyzing, and extracting insights from GitHub through the REST API, with GraphQL planned.
|
|
23
|
+
|
|
24
|
+
**Status:** Early development — expect bugs, missing features, and rapid changes. APIs and CLI may change without notice.
|
|
25
|
+
|
|
26
|
+
> Built for developers who prefer terminals over tabs.
|
|
27
|
+
|
|
28
|
+
[](https://pypi.org/project/gitraze/)
|
|
29
|
+
[](https://pypi.org/project/gitraze/)
|
|
30
|
+
[](https://pypi.org/project/gitraze/)
|
|
31
|
+
[](https://github.com/akpandey-dev/gitraze/actions)
|
|
32
|
+
[](LICENSE)
|
|
33
|
+
[](https://github.com/akpandey-dev/gitraze/issues)
|
|
34
|
+
[](https://github.com/akpandey-dev/gitraze)
|
|
35
|
+
[](https://github.com/akpandey-dev/gitraze/commits/main)
|
|
36
|
+
[](https://github.com/akpandey-dev/gitraze/graphs/contributors)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Why Gitraze?
|
|
42
|
+
|
|
43
|
+
Most GitHub tools are either slow, bloated, or UI-heavy.
|
|
44
|
+
|
|
45
|
+
Gitraze is built around a simpler approach:
|
|
46
|
+
|
|
47
|
+
* Fast, minimal, no nonsense
|
|
48
|
+
* Built for developers who think in terminals
|
|
49
|
+
* Deep GitHub data access through the REST API
|
|
50
|
+
* Modular and extensible architecture
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
* Modular system
|
|
57
|
+
* GitHub REST API integration
|
|
58
|
+
* CLI-first workflow
|
|
59
|
+
* SDK support
|
|
60
|
+
* Repository insights
|
|
61
|
+
* User analysis
|
|
62
|
+
* Search users, repositories, issues, pull requests, and topics
|
|
63
|
+
* Automatic filtering of pull requests and issues
|
|
64
|
+
* Human-readable timestamps
|
|
65
|
+
* Cleaned descriptions
|
|
66
|
+
* Three data formats
|
|
67
|
+
* Save or display output
|
|
68
|
+
* Analytics modules in progress
|
|
69
|
+
* GraphQL planned
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
### From PyPI
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install gitraze
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### From source
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/akpandey-dev/gitraze.git
|
|
85
|
+
cd gitraze
|
|
86
|
+
pip install -e .
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> There may be some gaps between releases on GitHub and PyPI, as multiple commits are sometimes clustered into a single release on PyPI.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
Gitraze can be used from the command line or as a Python library.
|
|
97
|
+
|
|
98
|
+
### CLI
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
gitraze --help
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Example:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
gitraze --version
|
|
108
|
+
gitraze --help
|
|
109
|
+
gitraze user octocat --data-format=raw --output-action=save
|
|
110
|
+
gitraze repo torvalds/linux --data-format=full # Query format must match
|
|
111
|
+
gitraze search repos "machine learning" -n 5 --data-format=compact
|
|
112
|
+
gitraze analyze <target> # Coming soon!
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Python
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import gitraze as gz
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For example:
|
|
122
|
+
```python
|
|
123
|
+
import gitraze as gz
|
|
124
|
+
user = gz.user("octocat", data_format="compact")
|
|
125
|
+
print(user["name"])
|
|
126
|
+
print(user["followers"])
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
For command usage, API reference, output formats, and examples, see the **[documentation](docs/)**.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Philosophy
|
|
134
|
+
|
|
135
|
+
Gitraze is built for speed, clarity, and control.
|
|
136
|
+
|
|
137
|
+
No clutter, no distractions — just raw access to GitHub data, the way it should be.
|
|
138
|
+
|
|
139
|
+
If you live in the terminal, Gitraze lives with you.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Project Status
|
|
144
|
+
|
|
145
|
+
Gitraze is in active development:
|
|
146
|
+
|
|
147
|
+
* Expect breaking changes
|
|
148
|
+
* Some commands may not work
|
|
149
|
+
* Features are being added rapidly
|
|
150
|
+
* GraphQL is not implemented yet; Gitraze is REST-focused for now
|
|
151
|
+
|
|
152
|
+
If you're here early — you're basically a beta tester.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Contributing
|
|
157
|
+
|
|
158
|
+
PRs, ideas, bug reports, and feature suggestions are welcome.
|
|
159
|
+
|
|
160
|
+
If you want to improve or modify Gitraze, go ahead.
|
|
161
|
+
|
|
162
|
+
* Fork the repository
|
|
163
|
+
* Create a feature branch
|
|
164
|
+
* Submit a PR with clean commit messages
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
git checkout -b feature/cool-thing
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Just keep the code clean and the terminal fast.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
MIT License — do whatever you want, just don't blame me if you break stuff.
|