Skip to content

Instantly share code, notes, and snippets.

@nathanshammah
Last active May 27, 2020 10:42
Show Gist options
  • Save nathanshammah/d271362f03b783b7cda84ded53da622a to your computer and use it in GitHub Desktop.
Save nathanshammah/d271362f03b783b7cda84ded53da622a to your computer and use it in GitHub Desktop.
Unitary Fund microgrants data.
Unitary Fund microgrants data. GPL v.3 license.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Micro-grant projects supported by Unitary Fund.\n",
"\n",
"### As of May 20th, 2020\n",
"\n",
"This notebook collects some data about micro-grant projects funded by Unitary Fund that are hosted as open-source repositories on Github. This notebook is under GPL v.3 license.\n",
"\n",
"The [PyGithub](https://github.com/PyGithub/PyGithub) library is used to access the [Github Rest API](https://developer.github.com/v3/) data. This is one of the many [Oktokit](https://developer.github.com/v3/libraries/) third-party libraries. "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from github import Github\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# First create a Github instance:\n",
"# 1. Using username and password\n",
"USER = \"your_username_or_email\"\n",
"# Use a one-way token as password if 2FA is enabled\n",
"PWD = \"your_pwd_or_token_(if_2fa_enabled)\"\n",
"g = Github(USER, PWD)\n",
"# 2. Or using an access token\n",
"#g = Github(\"access_token\")\n",
"# 3. Github Enterprise with custom hostname\n",
"#g = Github(base_url=\"https://{hostname}/api/v3\", login_or_token=\"access_token\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"supported_repos = [\n",
" \"tqsd/QuNetSim\",\n",
" \"vm6502q/qrack\",\n",
" \"mstechly/quantum_tsp_tutorials\",\n",
" \"QuantumAI-lib/NISQAI\",\n",
" \"hendrikpn/scigym\",\n",
" \"gate42qc/em-pyquil\",\n",
" \"Quantum-Game/bra-ket-vue\",\n",
" \"vprusso/toqito\",\n",
" \"libtangle/qcgpu\",\n",
" \"LSaldyt/Qurry\",\n",
" \"Quantomatic/pyzx\",\n",
" \"bpcarlos/AAVQE-Tutorial\"\n",
" ]"
]
},
{
"cell_type": "code",
"execution_count": 98,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"repos_data = []\n",
"for repo_name in supported_repos:\n",
" repo = g.get_repo(repo_name)\n",
" name = repo.name\n",
" stars = repo.stargazers_count\n",
" watchers = repo.subscribers_count\n",
" forks = repo.forks\n",
" issues = repo.open_issues_count\n",
" closed_issues = repo.get_issues(state=\"closed\").totalCount\n",
" pulls = repo.get_pulls().totalCount\n",
" closed_pulls = repo.get_pulls(state=\"closed\").totalCount\n",
" commits = repo.get_commits().totalCount\n",
" contributors = repo.get_contributors().totalCount\n",
" releases = repo.get_releases().totalCount\n",
" try: \n",
" license = repo.get_license()\n",
" license = \"Yes\"\n",
" except:\n",
" license = None\n",
" license = \"No\"\n",
" try: \n",
" latest = repo.get_latest_release().title\n",
" except:\n",
" latest = None\n",
" repos_data.append([name, watchers, \n",
" stars, forks, \n",
" issues, closed_issues,\n",
" pulls, closed_pulls,\n",
" commits, contributors, \n",
" releases,latest, license\n",
" ,\n",
" ])"
]
},
{
"cell_type": "code",
"execution_count": 99,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>watchers</th>\n",
" <th>stars</th>\n",
" <th>forks</th>\n",
" <th>issues</th>\n",
" <th>closed_issues</th>\n",
" <th>pulls</th>\n",
" <th>closed_pulls</th>\n",
" <th>commits</th>\n",
" <th>contributors</th>\n",
" <th>releases</th>\n",
" <th>latest release</th>\n",
" <th>license</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>QuNetSim</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>34</td>\n",
" <td>0</td>\n",
" <td>34</td>\n",
" <td>504</td>\n",
" <td>5</td>\n",
" <td>4</td>\n",
" <td>None</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>qrack</td>\n",
" <td>5</td>\n",
" <td>53</td>\n",
" <td>8</td>\n",
" <td>7</td>\n",
" <td>351</td>\n",
" <td>1</td>\n",
" <td>310</td>\n",
" <td>757</td>\n",
" <td>4</td>\n",
" <td>10</td>\n",
" <td>Improved QUnit buffering and fSim gate</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>quantum_tsp_tutorials</td>\n",
" <td>2</td>\n",
" <td>42</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>6</td>\n",
" <td>38</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>None</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>NISQAI</td>\n",
" <td>6</td>\n",
" <td>31</td>\n",
" <td>12</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>11</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>None</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>scigym</td>\n",
" <td>3</td>\n",
" <td>6</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>13</td>\n",
" <td>1</td>\n",
" <td>8</td>\n",
" <td>63</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>None</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>em-pyquil</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>7</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>None</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>bra-ket-vue</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>37</td>\n",
" <td>0</td>\n",
" <td>34</td>\n",
" <td>176</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>None</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>toqito</td>\n",
" <td>4</td>\n",
" <td>15</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>313</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>None</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>qcgpu</td>\n",
" <td>18</td>\n",
" <td>372</td>\n",
" <td>32</td>\n",
" <td>1</td>\n",
" <td>6</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>78</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>None</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>Qurry</td>\n",
" <td>5</td>\n",
" <td>19</td>\n",
" <td>6</td>\n",
" <td>22</td>\n",
" <td>25</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>243</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>None</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>pyzx</td>\n",
" <td>16</td>\n",
" <td>93</td>\n",
" <td>22</td>\n",
" <td>3</td>\n",
" <td>36</td>\n",
" <td>0</td>\n",
" <td>13</td>\n",
" <td>469</td>\n",
" <td>9</td>\n",
" <td>2</td>\n",
" <td>v0.5.1</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>AAVQE-Tutorial</td>\n",
" <td>1</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>None</td>\n",
" <td>No</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" name watchers stars forks issues closed_issues \\\n",
"0 QuNetSim 5 10 3 0 34 \n",
"1 qrack 5 53 8 7 351 \n",
"2 quantum_tsp_tutorials 2 42 8 0 6 \n",
"3 NISQAI 6 31 12 1 0 \n",
"4 scigym 3 6 3 1 13 \n",
"5 em-pyquil 2 1 1 0 0 \n",
"6 bra-ket-vue 1 2 1 0 37 \n",
"7 toqito 4 15 3 0 1 \n",
"8 qcgpu 18 372 32 1 6 \n",
"9 Qurry 5 19 6 22 25 \n",
"10 pyzx 16 93 22 3 36 \n",
"11 AAVQE-Tutorial 1 5 0 0 0 \n",
"\n",
" pulls closed_pulls commits contributors releases \\\n",
"0 0 34 504 5 4 \n",
"1 1 310 757 4 10 \n",
"2 0 6 38 2 0 \n",
"3 1 0 11 1 0 \n",
"4 1 8 63 3 0 \n",
"5 0 0 7 1 0 \n",
"6 0 34 176 2 0 \n",
"7 0 1 313 1 1 \n",
"8 1 1 78 1 0 \n",
"9 0 0 243 1 0 \n",
"10 0 13 469 9 2 \n",
"11 0 0 4 1 0 \n",
"\n",
" latest release license \n",
"0 None Yes \n",
"1 Improved QUnit buffering and fSim gate Yes \n",
"2 None Yes \n",
"3 None Yes \n",
"4 None Yes \n",
"5 None Yes \n",
"6 None No \n",
"7 None Yes \n",
"8 None Yes \n",
"9 None Yes \n",
"10 v0.5.1 Yes \n",
"11 None No "
]
},
"execution_count": 99,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.DataFrame(data=repos_data)\n",
"df.rename(columns={0:\"name\",1: \"watchers\", 2:\"stars\",3: \"forks\",\n",
" 4:\"issues\",5:\"closed_issues\",\n",
" 6:\"pulls\",7:\"closed_pulls\",\n",
" 8: \"commits\", 9:\"contributors\",\n",
" 10:\"releases\",11:\"latest release\",12:\"license\",})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To apply for a micro-grant, see https://unitary.fund/#apply.\n",
"\n",
"For an up-to-date list of Unitary Fund grants given, see https://unitary.fund/#grants-made.\n",
"\n",
"For more information about Unitary Fund activities, visit https://unitary.fund/."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Affiliated projects\n",
"QuTiP is the first affiliated project supported by Unitary Fund. "
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {},
"outputs": [],
"source": [
"affiliated_repos_data = []\n",
"affiliated_repos=['qutip/qutip']\n",
"for repo_name in affiliated_repos:\n",
" repo = g.get_repo(repo_name)\n",
" name = repo.name\n",
" stars = repo.stargazers_count\n",
" watchers = repo.subscribers_count\n",
" forks = repo.forks\n",
" open_issues = repo.open_issues_count\n",
" commits = repo.get_commits().totalCount\n",
" contributors = repo.get_contributors().totalCount\n",
" releases = repo.get_releases().totalCount\n",
" try: \n",
" license = repo.get_license()\n",
" license = \"Yes\"\n",
" except:\n",
" license = None\n",
" license = \"No\"\n",
" try: \n",
" latest = repo.get_latest_release().title\n",
" except:\n",
" latest = None\n",
" affiliated_repos_data.append([name, watchers, \n",
" stars, forks, open_issues, \n",
" commits, contributors, \n",
" releases,latest, license\n",
" ])"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>watchers</th>\n",
" <th>stars</th>\n",
" <th>forks</th>\n",
" <th>open_issues</th>\n",
" <th>commits</th>\n",
" <th>contributors</th>\n",
" <th>releases</th>\n",
" <th>latest release</th>\n",
" <th>license</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>qutip</td>\n",
" <td>73</td>\n",
" <td>839</td>\n",
" <td>354</td>\n",
" <td>148</td>\n",
" <td>5545</td>\n",
" <td>71</td>\n",
" <td>8</td>\n",
" <td>Qutip 4.5.1</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" name watchers stars forks open_issues commits contributors \\\n",
"0 qutip 73 839 354 148 5545 71 \n",
"\n",
" releases latest release license \n",
"0 8 Qutip 4.5.1 Yes "
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2 = pd.DataFrame(data=affiliated_repos_data)\n",
"df2.rename(columns={0:\"name\",1: \"watchers\", 2:\"stars\",3: \"forks\",\n",
" 4:\"open_issues\",5: \"commits\", 6:\"contributors\",\n",
" 7:\"releases\",8:\"latest release\",9:\"license\"})"
]
},
{
"cell_type": "code",
"execution_count": 88,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3257\n"
]
}
],
"source": [
"print(repo.get_views_traffic(per=\"week\")['count'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment