Created
June 7, 2018 19:54
-
-
Save mariusvniekerk/0f54fca26f0a64ea6d0517af02af4c6b to your computer and use it in GitHub Desktop.
Feedstocks on conda-forge with mergable things
This file contains hidden or 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": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "Fetching package metadata .............\n", | |
| "Solving package specifications: .\n", | |
| "\n", | |
| "Package plan for installation in environment /opt/conda:\n", | |
| "\n", | |
| "The following NEW packages will be INSTALLED:\n", | |
| "\n", | |
| " tqdm: 4.23.4-py_0 conda-forge\n", | |
| "\n", | |
| "The following packages will be DOWNGRADED:\n", | |
| "\n", | |
| " blas: 1.1-openblas conda-forge --> 1.0-openblas defaults\n", | |
| " numpy: 1.14.3-py36_blas_openblas_200 conda-forge [blas_openblas] --> 1.14.2-py36_nomklh2b20989_1 defaults [nomkl]\n", | |
| "\n", | |
| "blas-1.0-openb 100% |################################| Time: 0:00:00 2.44 MB/s\n", | |
| "numpy-1.14.2-p 100% |################################| Time: 0:00:00 26.32 MB/s\n", | |
| "tqdm-4.23.4-py 100% |################################| Time: 0:00:00 651.91 kB/s\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "!conda install --yes tqdm" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "token = 'INSERT A GITHUB API TOKEN HERE'\n", | |
| "prs = {}" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 5, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import datetime as dt" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "application/vnd.jupyter.widget-view+json": { | |
| "model_id": "35b134cb70e04e5e8a0f30a2d40016a8", | |
| "version_major": 2, | |
| "version_minor": 0 | |
| }, | |
| "text/plain": [ | |
| "HBox(children=(IntProgress(value=0, max=90), HTML(value='')))" | |
| ] | |
| }, | |
| "metadata": {}, | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "from tqdm import tqdm_notebook as tqdm\n", | |
| "from github import Github\n", | |
| "import getpass\n", | |
| "import yaml\n", | |
| "\n", | |
| "def user_feedstocks(user):\n", | |
| " \"\"\"\n", | |
| " :param github.AuthenticatedUser.AutheticatedUser user:\n", | |
| " :return: `list` -- list of conda-forge feedstocks the user maintains\n", | |
| " \"\"\"\n", | |
| " feedstocks = []\n", | |
| " teams = list(user.get_teams())\n", | |
| " for team in tqdm(teams):\n", | |
| "\n", | |
| " # Each conda-forge team manages one feedstock\n", | |
| " # If a team has more than one repo, skip it.\n", | |
| " if team.repos_count != 1:\n", | |
| " continue\n", | |
| "\n", | |
| " repo = list(team.get_repos())[0]\n", | |
| " if repo.full_name[:12] == 'conda-forge/' and repo.full_name[-10:] == '-feedstock':\n", | |
| " feedstocks.append(repo)\n", | |
| "\n", | |
| " return feedstocks\n", | |
| "\n", | |
| "g = Github(login_or_token=token)\n", | |
| "user = g.get_user()\n", | |
| "feedstocks = user_feedstocks(user)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 8, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from IPython.display import display" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 9, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "prs = {}\n", | |
| "pr_status = {}" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 10, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "def get_pr_status(pr):\n", | |
| " most_recent = list(pr.get_commits())[-1]\n", | |
| " status = most_recent.get_combined_status()\n", | |
| " return status" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 34, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "rate limit left: RateLimit(rate=Rate(remaining=4628, limit=5000))\n", | |
| "rate limit reset time: 2018-06-07 20:11:43\n" | |
| ] | |
| }, | |
| { | |
| "data": { | |
| "application/vnd.jupyter.widget-view+json": { | |
| "model_id": "7f847d664bd04c119bcd9cecd1f46ae5", | |
| "version_major": 2, | |
| "version_minor": 0 | |
| }, | |
| "text/plain": [ | |
| "HBox(children=(IntProgress(value=0, max=80), HTML(value='')))" | |
| ] | |
| }, | |
| "metadata": {}, | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "#print(feedstocks)\n", | |
| "\n", | |
| "print('rate limit left: %s' % g.get_rate_limit())\n", | |
| "print('rate limit reset time: %s' % dt.datetime.fromtimestamp(g.rate_limiting_resettime))\n", | |
| "\n", | |
| "for f in tqdm(sorted(feedstocks, key=lambda x: x.full_name)):\n", | |
| " repo_name = f.full_name\n", | |
| "# print(repo_name)\n", | |
| " pulls = prs.get(repo_name)\n", | |
| " if not pulls:\n", | |
| " pulls = list(f.get_pulls())\n", | |
| " for pr in pulls:\n", | |
| " pr_status[(repo_name, pr.number)] = get_pr_status(pr)\n", | |
| " prs[repo_name] = pulls\n", | |
| " #if pulls:\n", | |
| " # display(vdom.span(\"%s PR(s) at \" % len(pulls), vdom.a(f.full_name, href='https://github.com/%s' % f.full_name)))" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 17, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from IPython.display import Markdown" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 33, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/markdown": [ | |
| "|PR|Status|Updated|\n", | |
| "|---|---|\n", | |
| "|[conda-forge/flex-swagger-feedstock#3](https://github.com/conda-forge/flex-swagger-feedstock/pull/3)|success|2018-05-25T23:44:01Z| \n", | |
| "|[conda-forge/freetds-feedstock#3](https://github.com/conda-forge/freetds-feedstock/pull/3)|failure|2017-10-28T22:23:04Z| \n", | |
| "|[conda-forge/keras-feedstock#26](https://github.com/conda-forge/keras-feedstock/pull/26)|failure|2018-06-07T05:40:52Z| \n", | |
| "|[conda-forge/lifelines-feedstock#7](https://github.com/conda-forge/lifelines-feedstock/pull/7)|success|2018-06-06T22:53:53Z| \n", | |
| "|[conda-forge/pure-sasl-feedstock#3](https://github.com/conda-forge/pure-sasl-feedstock/pull/3)|failure|2018-05-19T04:22:18Z| \n", | |
| "|[conda-forge/python-snappy-feedstock#12](https://github.com/conda-forge/python-snappy-feedstock/pull/12)|failure|2018-03-13T05:59:49Z| \n", | |
| "|[conda-forge/tinyrpc-feedstock#2](https://github.com/conda-forge/tinyrpc-feedstock/pull/2)|success|2018-04-29T17:33:08Z| " | |
| ], | |
| "text/plain": [ | |
| "<IPython.core.display.Markdown object>" | |
| ] | |
| }, | |
| "execution_count": 33, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "Markdown(\n", | |
| " '|PR|Status|Updated|\\n|---|---|\\n' + \n", | |
| " '\\n'.join(\n", | |
| "f'|[{repo}#{pr}](https://github.com/{repo}/pull/{pr})|{status.state}|{max([r[\"updated_at\"] for r in status.raw_data[\"statuses\"]])}| ' for (repo, pr), status in pr_status.items()\n", | |
| "))" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python [default]", | |
| "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.6.3" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment