diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b7c03c6..78f507a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,9 +1,12 @@ { - "name": "stackql-codespaces-demo", "image": "stackql/stackql-codespaces-base", - "hostRequirements": { - "cpus": 2 + "containerEnv": { + "STACKQL_GITHUB_PASSWORD": "${secrets:STACKQL_GITHUB_PASSWORD}", + "STACKQL_GITHUB_USERNAME": "${secrets:STACKQL_GITHUB_USERNAME}" }, + "hostRequirements": { + "cpus": 16 + }, "customizations": { "vscode": { "extensions": [ @@ -12,4 +15,4 @@ ] } } -} \ No newline at end of file +} 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/notebooks/github.ipynb b/notebooks/github.ipynb index 202c953..0f2c2b8 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,53 @@ }, "outputs": [], "source": [ - "_.plot(kind='bar', title='Stargazers', x='name', y='stargazers_count')" + "_.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()" ] }, { @@ -87,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": {