@@ -115,8 +115,24 @@ async def list_repos_for_org(org):
115
115
return reps
116
116
117
117
118
- async def main ():
118
+ async def get_package_maintainers (package : str ) -> list [str ]:
119
+ """Get the maintainers of a package from PyPI.
120
+
121
+ The json does not have the right information, so we need to scrape the page.
122
+ """
123
+ url = f"https://pypi.org/project/{ package } /"
124
+ response = await asks .get (url )
125
+ if response .status_code == 200 :
126
+ html = response .text
127
+ soup = BeautifulSoup (html , "html.parser" )
128
+ maintainers = soup .find_all ("a" , class_ = "package-header__author-link" )
129
+ if not maintainers :
130
+ return ["unknown (blocked by fastly?)" ]
131
+ return [a .text .strip () for a in maintainers ]
132
+ return ["unknown (status code: " + str (response .status_code ) + ")" ]
133
+
119
134
135
+ async def main ():
120
136
packages = get_packages (f"https://pypi.org/org/jupyter/" )
121
137
print (f"Found { len (packages )} packages in the pypi jupyter org" )
122
138
@@ -143,19 +159,22 @@ async def main():
143
159
for org , repo in todo :
144
160
145
161
async def _loc (targets , org , repo ):
162
+ maintainers = await get_package_maintainers (repo )
146
163
targets .append (
147
164
(
148
165
org ,
149
166
repo ,
150
167
(
151
168
await asks .get (f"https://pypi.org/pypi/{ repo } /json" )
152
169
).status_code ,
170
+ maintainers ,
153
171
)
154
172
)
155
173
156
174
nursery .start_soon (_loc , targets , org , repo )
175
+
157
176
corg = ""
158
- for org , repo , status in sorted (targets ):
177
+ for org , repo , status , maintainers in sorted (targets ):
159
178
if org != corg :
160
179
print ()
161
180
corg = org
@@ -165,16 +184,18 @@ async def _loc(targets, org, repo):
165
184
f"{ status } for https://pypi.org/project/{ repo } " ,
166
185
)
167
186
187
+ for maintainer in maintainers :
188
+ print (f" |{ maintainer } " )
189
+
168
190
print ()
169
191
print ("repos with no Pypi package:" )
170
192
corg = ""
171
- for org , repo , status in sorted (targets ):
193
+ for org , repo , status , maintainers in sorted (targets ):
172
194
if org != corg :
173
195
print ()
174
196
corg = org
175
197
if status != 200 :
176
198
print (f"https://github.com/{ org } /{ repo } " )
177
-
178
199
print ()
179
200
print ("Packages with no repos." )
180
201
print (map )
0 commit comments