gitstar 0.1.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.
- gitstar-0.1.0/PKG-INFO +60 -0
- gitstar-0.1.0/README.md +39 -0
- gitstar-0.1.0/gitstar/__init__.py +1 -0
- gitstar-0.1.0/gitstar/core.py +77 -0
- gitstar-0.1.0/gitstar.egg-info/PKG-INFO +60 -0
- gitstar-0.1.0/gitstar.egg-info/SOURCES.txt +10 -0
- gitstar-0.1.0/gitstar.egg-info/dependency_links.txt +1 -0
- gitstar-0.1.0/gitstar.egg-info/entry_points.txt +2 -0
- gitstar-0.1.0/gitstar.egg-info/top_level.txt +1 -0
- gitstar-0.1.0/pyproject.toml +3 -0
- gitstar-0.1.0/setup.cfg +4 -0
- gitstar-0.1.0/setup.py +27 -0
gitstar-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitstar
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Find out the total star earned by a github user
|
|
5
|
+
Home-page: https://github.com/imranpollob/github-total-star-counter
|
|
6
|
+
Author: Pollmix
|
|
7
|
+
Author-email: imranpollob@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# Gitstar
|
|
23
|
+
|
|
24
|
+
A command-line tool to calculate the total number of stars earned by a GitHub user.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Install via pip:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install gitstar
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
Basic usage:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
gitstar <username>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Limit the output to the top N repositories:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
gitstar <username> <limit>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Examples
|
|
49
|
+
|
|
50
|
+
Get total stars for user `pollmix`:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
gitstar pollmix
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Get total stars and list top 5 repositories:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
gitstar pollmix 5
|
|
60
|
+
```
|
gitstar-0.1.0/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Gitstar
|
|
2
|
+
|
|
3
|
+
A command-line tool to calculate the total number of stars earned by a GitHub user.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install via pip:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install gitstar
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Basic usage:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
gitstar <username>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Limit the output to the top N repositories:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gitstar <username> <limit>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Examples
|
|
28
|
+
|
|
29
|
+
Get total stars for user `pollmix`:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
gitstar pollmix
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Get total stars and list top 5 repositories:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
gitstar pollmix 5
|
|
39
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .core import main
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import math
|
|
3
|
+
import sys
|
|
4
|
+
from urllib.error import HTTPError
|
|
5
|
+
from urllib.request import Request, urlopen
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def fetch(params):
|
|
9
|
+
url = "https://api.github.com/"
|
|
10
|
+
httprequest = Request(url + params, headers={"Accept": "application/json"})
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
response = urlopen(httprequest)
|
|
14
|
+
return json.loads(response.read().decode())
|
|
15
|
+
except HTTPError as e:
|
|
16
|
+
print(e.reason)
|
|
17
|
+
exit()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
USAGE = """
|
|
21
|
+
Find out the total star earned by a github user.
|
|
22
|
+
|
|
23
|
+
Basic command:
|
|
24
|
+
gitstar theusername
|
|
25
|
+
|
|
26
|
+
Add printing limit:
|
|
27
|
+
gitstar theusername 5
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def main():
|
|
32
|
+
# Debug print
|
|
33
|
+
# print(f"DEBUG: sys.argv = {sys.argv}", file=sys.stderr)
|
|
34
|
+
if len(sys.argv) == 1:
|
|
35
|
+
print(USAGE)
|
|
36
|
+
exit()
|
|
37
|
+
|
|
38
|
+
limit = None
|
|
39
|
+
|
|
40
|
+
if len(sys.argv) == 3:
|
|
41
|
+
try:
|
|
42
|
+
limit = int(sys.argv[2])
|
|
43
|
+
except ValueError:
|
|
44
|
+
print("Limit must be an integer")
|
|
45
|
+
exit()
|
|
46
|
+
|
|
47
|
+
username = sys.argv[1]
|
|
48
|
+
|
|
49
|
+
user = fetch(f"users/{username}")
|
|
50
|
+
|
|
51
|
+
if not user["public_repos"]:
|
|
52
|
+
print(f"{username} doesn't have any public repository.")
|
|
53
|
+
exit()
|
|
54
|
+
|
|
55
|
+
pages = math.ceil(user["public_repos"] / 100)
|
|
56
|
+
star = 0
|
|
57
|
+
highest_name = 0
|
|
58
|
+
repo_star_map = {}
|
|
59
|
+
|
|
60
|
+
for i in range(pages):
|
|
61
|
+
repos = fetch(f"users/{username}/repos?per_page=100&page={i+1}")
|
|
62
|
+
|
|
63
|
+
for repo in repos:
|
|
64
|
+
repo_star_map[repo["html_url"]] = repo["stargazers_count"]
|
|
65
|
+
star += repo["stargazers_count"]
|
|
66
|
+
highest_name = max(highest_name, len(repo["html_url"]))
|
|
67
|
+
|
|
68
|
+
print(f"Total ⭐️ {star}")
|
|
69
|
+
|
|
70
|
+
for repo, star in sorted(repo_star_map.items(), key=lambda x: x[1], reverse=True)[
|
|
71
|
+
:limit
|
|
72
|
+
]:
|
|
73
|
+
print(f"{repo:-<{highest_name}} ⭐️ {star}")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if __name__ == "__main__":
|
|
77
|
+
main()
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitstar
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Find out the total star earned by a github user
|
|
5
|
+
Home-page: https://github.com/imranpollob/github-total-star-counter
|
|
6
|
+
Author: Pollmix
|
|
7
|
+
Author-email: imranpollob@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# Gitstar
|
|
23
|
+
|
|
24
|
+
A command-line tool to calculate the total number of stars earned by a GitHub user.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Install via pip:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install gitstar
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
Basic usage:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
gitstar <username>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Limit the output to the top N repositories:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
gitstar <username> <limit>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Examples
|
|
49
|
+
|
|
50
|
+
Get total stars for user `pollmix`:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
gitstar pollmix
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Get total stars and list top 5 repositories:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
gitstar pollmix 5
|
|
60
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gitstar
|
gitstar-0.1.0/setup.cfg
ADDED
gitstar-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="gitstar",
|
|
8
|
+
version="0.1.0",
|
|
9
|
+
author="Pollmix",
|
|
10
|
+
author_email="imranpollob@gmail.com",
|
|
11
|
+
description="Find out the total star earned by a github user",
|
|
12
|
+
long_description=long_description,
|
|
13
|
+
long_description_content_type="text/markdown",
|
|
14
|
+
url="https://github.com/imranpollob/github-total-star-counter",
|
|
15
|
+
packages=find_packages(),
|
|
16
|
+
classifiers=[
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
],
|
|
21
|
+
python_requires=">=3.6",
|
|
22
|
+
entry_points={
|
|
23
|
+
"console_scripts": [
|
|
24
|
+
"gitstar=gitstar.core:main",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
)
|