Created
March 3, 2020 03:05
-
-
Save emmanuelle/d0ff848797d05775b511da252fda7f44 to your computer and use it in GitHub Desktop.
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
from github import Github | |
import plotly.express as px | |
from datetime import datetime | |
# First create a Github instance | |
# using an access token | |
g = Github("your own token here") | |
repo = g.get_repo("scikit-image/scikit-image") | |
contributors_by_year = {} | |
for year in range(2009, 2021): | |
commits = repo.get_commits(since=datetime(year, 1, 1), until=datetime(year, 12, 31)) | |
contributors = set([cm.commit.author.name for cm in commits]) | |
print(year, contributors) | |
contributors_by_year[year] = len(contributors) | |
fig = px.bar(x=list(contributors_by_year.keys()), y=list(contributors_by_year.values()), | |
text=list(contributors_by_year.values()), labels={'x':'year', 'y':'contributors'}) | |
fig.update_layout(width=400, height=300) | |
fig.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment