Skip to content

Commit c90c9c6

Browse files
committed
Add extension equivalency
1 parent ff225f6 commit c90c9c6

File tree

3 files changed

+84
-69
lines changed

3 files changed

+84
-69
lines changed

conf.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,17 @@
2323

2424
HERE = pathlib.Path(__file__).parent
2525
GET_REPOS = "https://api.github.com/orgs/jupyterlab-contrib/repos"
26+
GET_REPO = "https://api.github.com/repos/jupyterlab-contrib/"
2627
TOKEN = os.getenv("GITHUB_TOKEN")
2728

28-
extensions = (HERE / "extensions.tpl").read_text()
29+
footer = (HERE / "extensions.tpl").read_text()
30+
header = """# List of extensions and tools
31+
32+
## Extensions in this organization
33+
34+
The extensions hosted in this organization.
35+
36+
"""
2937
default_headers = {}
3038
if TOKEN is not None:
3139
default_headers["authorization"] = f"Bearer {TOKEN}"
@@ -37,6 +45,7 @@
3745
params={"per_page": 100},
3846
)
3947
data = repos.json()
48+
extensions = ""
4049
for repo in data:
4150
if isinstance(repo, str):
4251
raise ValueError(data["message"])
@@ -45,6 +54,12 @@
4554
continue # Skip special repositories
4655

4756
try:
57+
response = requests.get(
58+
GET_REPO + repo["name"],
59+
headers={**default_headers, "Accept": "application/vnd.github.v3+json"}
60+
)
61+
repo_attributes = response.json()
62+
description = repo_attributes.get("description", "")
4863
readme = requests.get(
4964
repo["contents_url"].replace("{+path}", "README.md"),
5065
headers={
@@ -54,15 +69,15 @@
5469
)
5570
filename = repo["name"]
5671
(HERE / (filename + ".md")).write_text(readme.text)
57-
extensions += f"\n* [{filename.replace('_', ' ')}]({filename}.md)"
72+
extensions += f"\n* [{filename.replace('_', ' ')}]({filename}.md): {description}"
5873
except BaseException as err:
5974
print(err)
6075
print(f"Fail to get README for {filename}.")
6176
except BaseException as err:
6277
print(err)
6378
print("Fail to get organization repositories")
6479
finally:
65-
(HERE / "extensions.md").write_text(extensions)
80+
(HERE / "extensions.md").write_text(header + extensions + footer)
6681

6782

6883
# -- Project information -----------------------------------------------------

extensions.tpl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# List of extensions and tools
21

32
## Extensions from elsewhere
43

@@ -55,6 +54,5 @@ This a list of nice JupyterLab extensions not part of ``jupyterlab-contrib`` org
5554
- [Dask](https://github.com/dask/dask-labextension) - Manage Dask clusters, as well as embed Dask's dashboard plots directly into JupyterLab panes.
5655
- [jupyterlab-autoplay](https://github.com/remborg/autoplay) - Run and hide code cells automatically when opening a notebook.
5756

58-
## Extensions in this organization
59-
60-
The extensions hosted in this organization.
57+
If you don't find what you are looking here or in the web, you can always start coding a new extension; for
58+
more information have a look at the [documentation](https://jupyterlab.readthedocs.io/en/stable/extension/extension_dev.html).

0 commit comments

Comments
 (0)