forked from networkx/networkx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteam_list.py
105 lines (75 loc) · 2.12 KB
/
team_list.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import os
import sys
import requests
project = "networkx"
core = "core-developers"
emeritus = "emeritus-developers"
steering = "steering-council"
core_url = f"https://api.github.com/orgs/{project}/teams/{core}/members"
emeritus_url = f"https://api.github.com/orgs/{project}/teams/{emeritus}/members"
steering_url = f"https://api.github.com/orgs/{project}/teams/{steering}/members"
token = os.environ.get("GH_TOKEN", None)
if token is None:
print(
"No token found. Please export a GH_TOKEN with permissions "
"to read team members."
)
sys.exit(-1)
def api(url):
json = requests.get(url=url, headers={"Authorization": f"token {token}"}).json()
if "message" in json and json["message"] == "Bad credentials":
raise RuntimeError("Invalid token provided")
else:
return json
resp = api(core_url)
core = sorted(resp, key=lambda user: user["login"].lower())
resp = api(emeritus_url)
emeritus = sorted(resp, key=lambda user: user["login"].lower())
resp = api(steering_url)
steering = sorted(resp, key=lambda user: user["login"].lower())
def render_team(team):
for member in team:
profile = api(member["url"])
print(
f"""
.. raw:: html
<div class="team-member">
<a href="https://github.com/{member['login']}" class="team-member-name">
<div class="team-member-photo">
<img
src="{member['avatar_url']}&s=40"
loading="lazy"
alt="Avatar picture of @{profile['login']}"
/>
</div>
{profile['name'] if profile['name'] else '@' + profile['login']}
</a>
<div class="team-member-handle">@{member['login']}</div>
</div>
"""
)
print(
"""
.. _core-developers-team:
Core Developers
---------------
NetworkX development is guided by the following core team:
"""
)
render_team(core)
print(
"""
Emeritus Developers
-------------------
We thank these previously-active core developers for their contributions to NetworkX.
"""
)
render_team(emeritus)
print(
"""
.. _steering-council-team:
Steering Council
----------------
"""
)
render_team(steering)