Last active
July 4, 2019 16:18
-
-
Save djsutherland/6266460a921fd9dcdf07c5ffd7e8067a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import os\n", | |
"\n", | |
"import github\n", | |
"from tqdm import tqdm_notebook as tqdm\n", | |
"\n", | |
"from IPython.display import display, HTML" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/Users/dougal/anaconda/envs/py3/lib/python3.7/site-packages/jinja2/utils.py:485: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working\n", | |
" from collections import MutableMapping\n" | |
] | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"\u001b[0;96mdb\u001b[0;35m:\u001b[0;97mpulling latest graph\u001b[0m\n" | |
] | |
} | |
], | |
"source": [ | |
"from libcflib.db import DB\n", | |
"db = DB()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"with open(os.path.expanduser('~/.conda-smithy/github.token')) as f:\n", | |
" token = f.read().strip()\n", | |
"\n", | |
"gh = github.Github(token)\n", | |
"gh_me = gh.get_user()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"subs = gh_me.get_subscriptions()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.jupyter.widget-view+json": { | |
"model_id": "e5c782a6579a4f7286571536594baa11", | |
"version_major": 2, | |
"version_minor": 0 | |
}, | |
"text/plain": [ | |
"HBox(children=(IntProgress(value=0, max=306), HTML(value='')))" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<a href='https://github.com/conda-forge/allensdk-feedstock/'>allensdk</a>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<a href='https://github.com/conda-forge/segyio-feedstock/'>segyio</a>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"for repo in tqdm(subs, total=subs.totalCount):\n", | |
" if (\n", | |
" repo.owner is None\n", | |
" or repo.owner.login != 'conda-forge'\n", | |
" or not repo.name.endswith('-feedstock')\n", | |
" ):\n", | |
" continue\n", | |
" \n", | |
" short = repo.name[:-len('-feedstock')]\n", | |
" try:\n", | |
" p = db.packages[short]\n", | |
" except KeyError as e:\n", | |
" display(HTML(f\"<a href='https://github.com/conda-forge/{repo.name}/'>{short}</a>\"))\n", | |
" else:\n", | |
" a = p.latest_artifact()\n", | |
" if gh_me.login not in a['rendered_recipe']['extra']['recipe-maintainers']:\n", | |
" gh_me.remove_from_subscriptions(repo)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python [conda env:py3] *", | |
"language": "python", | |
"name": "conda-env-py3-py" | |
}, | |
"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.1" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment