Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/docs/source/_build/scripts/people.py
6939 views
1
import itertools
2
from github import Github, Auth
3
import os
4
5
token = os.getenv("GITHUB_TOKEN")
6
auth = Auth.Token(token) if token else None
7
g = Github(auth=auth)
8
9
ICON_TEMPLATE = '<a href="{html_url}"><img alt="{login}" class="contributor_icon" src="{avatar_url}&s=40" loading="lazy" /></a>'
10
11
12
def get_people_md():
13
repo = g.get_repo("pola-rs/polars")
14
contributors = repo.get_contributors()
15
with open("./docs/assets/people.md", "w") as f:
16
for c in itertools.islice(contributors, 50):
17
# We love dependabot, but he doesn't need a spot on our website
18
if c.login == "dependabot[bot]":
19
continue
20
21
f.write(
22
ICON_TEMPLATE.format(
23
login=c.login,
24
avatar_url=c.avatar_url,
25
html_url=c.html_url,
26
)
27
+ "\n"
28
)
29
30
31
def on_startup(command, dirty):
32
"""Mkdocs hook to autogenerate docs/assets/people.md on startup"""
33
try:
34
get_people_md()
35
except Exception as e:
36
msg = f"WARNING:{__file__}: Could not generate docs/assets/people.md. Got error: {str(e)}"
37
print(msg)
38
39
40
if __name__ == "__main__":
41
get_people_md()
42
43