forked from 2i2c-org/team-compass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
117 lines (95 loc) · 4.23 KB
/
conf.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
106
107
108
109
110
111
112
113
114
115
116
117
from pathlib import Path
# -- Project information -----------------------------------------------------
project = "Team Compass"
copyright = "2021, 2i2c"
author = "2i2c"
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"myst_parser",
"sphinx_design",
"sphinx_copybutton",
"sphinx.ext.intersphinx",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".github", ".nox", "README.md"]
# -- Options for HTML output---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_2i2c_theme"
html_static_path = ["_static"]
html_title = "Team Compass"
show_navbar_depth = 3
html_theme_options = {
"repository_url": "https://github.com/2i2c-org/team-compass",
"repository_branch": "main",
"use_repository_button": True,
"use_edit_page_button": True,
"extra_navbar": "",
}
myst_enable_extensions = [
"colon_fence",
"deflist",
"linkify",
]
myst_url_schemes = ["https", "http", "ftp", "mailto"]
intersphinx_mapping = {
"docs": ("https://docs.2i2c.org/en/latest/", None),
"infra": ("https://infrastructure.2i2c.org/en/latest/", None),
}
# Disable linkcheck for anchors because it throws false errors for any JS anchors
linkcheck_anchors = False
linkcheck_ignore = [
"https://github.com/2i2c-org/meta*", # Because it's a private repo
"https://github.com/issues*", # Because linkcheck doesn't work with github issues + queries
"https://github.com/orgs/2i2c-org/projects*", # because projects don't respond properly for some reason
"https://github.com/2i2c-org/leads*", # Because it's a private repo
"https://drive.google.com*", # Because it's almost always private
"https://icsi.berkeley.edu*", # Because it's broken often
"https://sociocracyforall.org*", # Because it raises a 403 but still works
"https://airtable.com*", # Because it has some kind of security that returns a 403
]
# -- Custom scripts ---------------------------------------------------
# Hacky solution to list the latest engineering team members as reference
# This grabs the latest list of team members from https://2i2c.org/about/
# It then parses the HTML to grab the names and GitHub handles, then sorts by name
# We can use this to define the order of team roles.
from urllib import request
from bs4 import BeautifulSoup
import pandas as pd
from pathlib import Path
resp = request.urlopen("https://2i2c.org/about/")
text = resp.read().decode()
teams = []
for row in BeautifulSoup(text, features="html.parser").select("div.people-widget > div"):
# If not a `.people-person` item, it will be a group title
if "people-person" not in row.attrs.get("class"):
category = row.text.strip()
continue
entry = {"name": row.select("h2 a")[0].text, "team": category}
# Grab the listed contact links for this person
for link in row.select("ul.network-icon a"):
if "fa-github" in str(link):
handle = link.attrs["href"].split("/")[-1]
entry["github"] = f"[@{handle}]({link.attrs['href']})"
elif "mailto" in str(link):
entry["email"] = link.attrs["href"].split(":")[-1]
elif "twitter" in str(link):
handle = link.attrs["href"].split("/")[-1]
entry["twitter"] = f"[@{handle}]({link.attrs['href']})"
teams.append(entry)
# Sort and create CSV files to be imported in the Team page
teams = pd.DataFrame(teams)
Path(__file__).parent.joinpath("tmp").mkdir(exist_ok=True)
for team, people in teams.groupby("team"):
people.sort_values("name").drop(columns=["team"]).to_csv(f"tmp/{team}.csv" , index=None)
# -- Sphinx setup script ---------------------------------------------------
def setup(app):
app.add_css_file("custom.css")