import pandas as pd
import sqlite3
import pooch
from markdown import markdownorg = "jupyterlab"
# If the template has been converted to pages, then org will not have { org } structure
if "{ org }" in org:
org = "jupyter-book"# Download latest release data for Jupyter Book
file_path = pooch.retrieve(
# URL to one of Pooch's test files
url=f"https://github.com/jupyter/issue-data/releases/download/latest/{org}.db",
known_hash=None,
)Downloading data from 'https://github.com/jupyter/issue-data/releases/download/latest/jupyterlab.db' to file '/home/runner/.cache/pooch/d6d4df2744eda9f266a6a6e8ec1a2cc8-jupyterlab.db'.
SHA256 hash of downloaded file: d970a83e7b0694e66d2197b41d4309d291f52b38426f1f691a66f2b3df234577
Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.
def df_from_sql(query, db):
con = sqlite3.connect(db)
return pd.read_sql(query, con)
con.close()repos = df_from_sql("SELECT * FROM repos;", file_path).set_index("id")
issues = df_from_sql("SELECT * FROM issues;", file_path)
issues = issues.query("state == 'open'")
# Add some metadata that will make the outputs nicer
for ix, irow in issues.iterrows():
# Add number of positive reactions
positive = 0
for ii in ["+1", "heart", "hooray"]:
positive += eval(irow["reactions"])[ii]
issues.loc[ix, 'positive'] = int(positive)
# Add the repository
url_repo = repos.loc[irow["repo"]]["html_url"]
url_repo_parts = url_repo.split("/")[-1]
issues.loc[ix, "repo"] = f"[{url_repo_parts}]({url_repo})"
# Add the URL of each issue
url = f"{url_repo}/issues/{irow['number']}"
issues.loc[ix, "mdtitle"] = f"[{irow['title']}]({url})"
# Add a short body
issues["bodyshort"] = issues["body"].map(lambda a: a.replace("#", "")[:400] if a else '')/tmp/ipykernel_2365/2738450508.py:16: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '[jupyterlab](https://github.com/jupyterlab/jupyterlab)' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.
issues.loc[ix, "repo"] = f"[{url_repo_parts}]({url_repo})"
A table of all the open issues in the jupyterlab github organization, sorted by the number of 👍 and ❤️ reactions.
issues_sorted = issues.sort_values("positive", ascending=False).head(100)[["mdtitle", "repo", "bodyshort", "positive"]]
issues_sorted = issues_sorted.rename(columns={"bodyshort": "body", "mdtitle": "title", "positive": "👍"})
def render_markdown(text):
if isinstance(text, str): # Ensure the cell content is a string
return markdown(text)
return text
md_cols = ["title", "body", "repo"]
styledict = {ii: render_markdown for ii in md_cols}
df_style = issues_sorted
styled_df = issues_sorted.style.format(styledict | {"👍": int}).hide(axis="index")
styled_dfLoading...