Skip to content

Commit 2baef9d

Browse files
authored
Merge pull request #47 from Onoyiza/test_docs
Generate and add contributors to documentation
2 parents c798929 + 0c5836a commit 2baef9d

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ jobs:
7676
cd examples/MDF
7777
python arrays.py -run # test one example
7878
79+
- name: Build Documentation
80+
run: |
81+
82+
pip install .[docs]
83+
cd docs
84+
python generate.py
85+
python contributors.py
86+
cd sphinx
87+
make clean
88+
make html
89+
7990
- name: Final version info
8091
run: |
8192
pip list

docs/contributors.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import requests
2+
import pandas as pd
3+
import json
4+
import textwrap
5+
from datetime import date
6+
7+
8+
url = "https://api.github.com/repos/modeci/modelspec/contributors"
9+
10+
response = requests.get(url=url, auth=("<github_username>", "<github_token>"))
11+
12+
json_data = response.json()
13+
14+
df = pd.DataFrame(json_data)
15+
16+
per_info = list(df["url"].unique())
17+
len_per_info = len(per_info)
18+
19+
empty_list = []
20+
for i in range(len_per_info):
21+
url = per_info[i]
22+
print(url)
23+
data = requests.get(url=url)
24+
empty_list.append(data.json())
25+
26+
df1 = pd.DataFrame(empty_list)
27+
df1["name"] = df1["name"].fillna("")
28+
name = df1["name"]
29+
login = df1["login"]
30+
url_html = df1["html_url"]
31+
url_id = df1["id"]
32+
33+
login_html = list(zip(name, login, url_html))
34+
zip_dict = dict(zip(url_id, login_html))
35+
36+
file = "sphinx/source/api/Contributors.md"
37+
with open(file, "w") as f:
38+
print(
39+
textwrap.dedent(
40+
"""\
41+
(Modelspec:contributors)=
42+
43+
# Modelspec contributors
44+
45+
This page list names and Github profiles of contributors to Modelspec, listed in no particular order.
46+
This page is generated periodically, most recently on {}.""".format(
47+
date.today()
48+
)
49+
),
50+
file=f,
51+
)
52+
53+
print("", file=f)
54+
55+
for key, val in zip_dict.items():
56+
print("- {} ([@{}]({}))".format(val[0], val[1], val[2]), file=f)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(Modelspec:contributors)=
2+
3+
# Modelspec contributors
4+
5+
This page list names and Github profiles of contributors to Modelspec, listed in no particular order.
6+
This page is generated periodically, most recently on 2023-07-05.
7+
8+
- Padraig Gleeson ([@pgleeson](https://github.com/pgleeson))
9+
- David Turner ([@davidt0x](https://github.com/davidt0x))
10+
- Parikshit Singh Rathore ([@parikshit14](https://github.com/parikshit14))
11+
- Katherine Mantel ([@kmantel](https://github.com/kmantel))

docs/sphinx/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ It is still in development and it is being used by
2020
api/Introduction
2121
api/Quickstart
2222
api/Installation
23+
api/Contributors
2324

2425

2526
.. toctree::

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ test =
6767
typing_extensions; python_version<'3.8'
6868

6969
docs =
70+
requests
7071
Sphinx
7172
recommonmark>=0.5.0
7273
nbsphinx

0 commit comments

Comments
 (0)