From ca94fbcc1e4dfe7c16431739e2e56d44876a3f88 Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Wed, 25 Oct 2023 12:10:43 +1100 Subject: [PATCH 1/5] updates --- .devcontainer/devcontainer.json | 4 -- .devcontainer/icon.svg | 90 --------------------------------- 2 files changed, 94 deletions(-) delete mode 100644 .devcontainer/icon.svg diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b7c03c6..9ea4e14 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,9 +1,5 @@ { - "name": "stackql-codespaces-demo", "image": "stackql/stackql-codespaces-base", - "hostRequirements": { - "cpus": 2 - }, "customizations": { "vscode": { "extensions": [ diff --git a/.devcontainer/icon.svg b/.devcontainer/icon.svg deleted file mode 100644 index ab25508..0000000 --- a/.devcontainer/icon.svg +++ /dev/null @@ -1,90 +0,0 @@ - -Group.svg -Created using Figma 0.90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 7240470474d1617b792c95aa40c27d75a4cb4421 Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Wed, 25 Oct 2023 14:54:36 +1100 Subject: [PATCH 2/5] updated devcontainer.json --- .devcontainer/devcontainer.json | 6 +++++- notebooks/github.ipynb | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9ea4e14..f59736a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,9 @@ { "image": "stackql/stackql-codespaces-base", + "containerEnv": { + "STACKQL_GITHUB_PASSWORD": "${secrets:STACKQL_GITHUB_PASSWORD}", + "STACKQL_GITHUB_USERNAME": "${secrets:STACKQL_GITHUB_USERNAME}" + }, "customizations": { "vscode": { "extensions": [ @@ -8,4 +12,4 @@ ] } } -} \ No newline at end of file +} diff --git a/notebooks/github.ipynb b/notebooks/github.ipynb index 202c953..288d059 100644 --- a/notebooks/github.ipynb +++ b/notebooks/github.ipynb @@ -37,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Stargazers per Repo" + "## Top Stargazers per Repo" ] }, { @@ -49,10 +49,13 @@ "outputs": [], "source": [ "%%stackql\n", - "select name, stargazers_count \n", + "select name, stargazers FROM\n", + "(select name, stargazers_count as stargazers\n", "from github.repos.repos \n", "where org = '$org' \n", - "order by stargazers_count desc" + "and visibility = 'public'\n", + "order by stargazers_count desc) t\n", + "limit 10" ] }, { @@ -63,7 +66,7 @@ }, "outputs": [], "source": [ - "_.plot(kind='bar', title='Stargazers', x='name', y='stargazers_count')" + "_.plot(kind='bar', title='Stargazers', x='name', y='stargazers')" ] }, { From b0c28827a25942186a241f222045579ad52006d7 Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Wed, 25 Oct 2023 16:08:15 +1100 Subject: [PATCH 3/5] added github query and plot --- notebooks/github.ipynb | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/notebooks/github.ipynb b/notebooks/github.ipynb index 288d059..d1fbcca 100644 --- a/notebooks/github.ipynb +++ b/notebooks/github.ipynb @@ -69,6 +69,52 @@ "_.plot(kind='bar', title='Stargazers', x='name', y='stargazers')" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Daily Traffic Stats for `stackql`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%stackql\n", + "select \n", + "JSON_EXTRACT(json_each.value, '$$.count') as count,\n", + "JSON_EXTRACT(json_each.value, '$$.uniques') as uniques,\n", + "DATE(JSON_EXTRACT(json_each.value, '$$.timestamp')) as date\n", + "from github.repos.view_traffic, json_each(views) \n", + "WHERE owner = '$owner' AND repo = '$repo'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt\n", + "\n", + "df = stackql_df\n", + "fig, ax = plt.subplots(figsize=(10,6))\n", + "ax.bar(df['date'], df['count'], color='b', alpha=0.6, label='Count')\n", + "ax.plot(df['date'], df['uniques'], color='r', marker='o', label='Uniques')\n", + "\n", + "ax.set_xlabel('Date')\n", + "ax.set_ylabel('Value')\n", + "ax.set_xticks(df['date'])\n", + "ax.set_xticklabels(df['date'], rotation=45)\n", + "ax.legend()\n", + "\n", + "plt.title('Count and Uniques Over Time')\n", + "fig.tight_layout()\n", + "plt.show()" + ] + }, { "cell_type": "markdown", "metadata": {}, From 0eea198f4b08f0658e0a235c5160518c33242b3a Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Wed, 25 Oct 2023 19:31:56 +1100 Subject: [PATCH 4/5] updates --- notebooks/github.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/github.ipynb b/notebooks/github.ipynb index d1fbcca..63d4577 100644 --- a/notebooks/github.ipynb +++ b/notebooks/github.ipynb @@ -66,7 +66,7 @@ }, "outputs": [], "source": [ - "_.plot(kind='bar', title='Stargazers', x='name', y='stargazers')" + "_.plot(kind='bar', title='Stargazers', x='name', y='stargazers');" ] }, { From 9c2af7cff05d867c9a767f039a5a78c8a6ed63e0 Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Fri, 27 Oct 2023 13:36:52 +1100 Subject: [PATCH 5/5] updated github notebook --- .devcontainer/devcontainer.json | 3 +++ notebooks/github.ipynb | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f59736a..78f507a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,6 +4,9 @@ "STACKQL_GITHUB_PASSWORD": "${secrets:STACKQL_GITHUB_PASSWORD}", "STACKQL_GITHUB_USERNAME": "${secrets:STACKQL_GITHUB_USERNAME}" }, + "hostRequirements": { + "cpus": 16 + }, "customizations": { "vscode": { "extensions": [ diff --git a/notebooks/github.ipynb b/notebooks/github.ipynb index d1fbcca..8088a4f 100644 --- a/notebooks/github.ipynb +++ b/notebooks/github.ipynb @@ -136,6 +136,50 @@ "WHERE owner = '$owner' AND repo = '$repo'\n", "AND s.login IS NULL" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Org Followers who Arent Stargazers" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%stackql\n", + "SELECT f.login FROM \n", + "github.users.followers f\n", + "LEFT OUTER JOIN github.activity.repo_stargazers s\n", + "ON f.login = s.login\n", + "WHERE s.owner = '$owner' AND s.repo = '$repo' AND f.username = '$org'\n", + "AND s.login IS NULL" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Repo Watchers who Arent Stargazers" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%stackql\n", + "SELECT w.login FROM \n", + "github.activity.repo_watchers w\n", + "LEFT OUTER JOIN github.activity.repo_stargazers s\n", + "ON w.login = s.login\n", + "WHERE owner = '$owner' AND repo = '$repo'\n", + "AND s.login IS NULL" + ] } ], "metadata": {