diff --git a/code/myriad/get_all_contributors/all-contributors.py b/code/myriad/get_all_contributors/all-contributors.py index 990e8696..6b94b30f 100644 --- a/code/myriad/get_all_contributors/all-contributors.py +++ b/code/myriad/get_all_contributors/all-contributors.py @@ -7,6 +7,7 @@ import json #import re import sys +from datetime import datetime, timedelta #assumes that GH token is in a file "github_access_token.txt" that's in the same folder as this file tok = open("github_access_token.txt", "r") @@ -18,15 +19,14 @@ g = Github(auth=auth) #subprocess.check_call(["git", "clone", "git@github.com:processing/p5.js.git"]) -def get_gh_contributors(repo_name): - repo = g.get_repo(repo_name) +def get_gh_contributors(repo): + print("Getting contributors") contributors = repo.get_contributors(anon=True) total_contributors = contributors.totalCount total_contributions = 0 contributors_list = [] - print("Getting "+repo_name+" contributors") for i in range(total_contributors): c = contributors[i] contributor_info = { @@ -45,15 +45,49 @@ def get_gh_contributors(repo_name): # fuse users with same email? print("") + + return total_contributions, contributors_list + +def get_gh_commit_history(repo, end_date): + print("Getting commits") + + start_date = repo.created_at.astimezone() + end_date = datetime.now().astimezone() + total_days = (end_date - start_date).days + n_periods = 32 + period_days = total_days // n_periods + + commits_over_time = [0] * n_periods + for i in range(n_periods): + period_start_date = start_date + timedelta(days = i*period_days) + period_end_date = period_start_date + timedelta(days = period_days) + + commits = repo.get_commits(since = period_start_date, until = period_end_date) + + num_commits = len(list(commits)) + commits_over_time[i] = num_commits + print_progress_bar(i+1, n_periods) + + print("") + return commits_over_time + +def get_and_save_gh_info(repo_name): + print(repo_name) + repo = g.get_repo(repo_name) + + #commits_over_time = get_gh_commit_history(repo) + total_contributions, contributors_list = get_gh_contributors(repo) + filename = "contributors/" + repo_name.replace("/", "#") + ".json" repo_data = { "repo": repo_name, + #"commits_over_time": commits_over_time, "total_contributions": total_contributions, - "contributors": contributors_list + "contributors": contributors_list, } with open(filename, "w") as fp: json.dump(repo_data, fp, indent = 1) - return contributors_list + def print_progress_bar(iteration, total, length=50): filled_length = int(length * iteration // total) @@ -66,7 +100,7 @@ def print_progress_bar(iteration, total, length=50): #print(repos) for repo in repos: if repo[0] != "*": - get_gh_contributors(repo.rstrip("\n")) + get_and_save_gh_info(repo.rstrip("\n")) print("All done ✨") #print(repo.get_stats_contributors()) diff --git a/code/myriad/get_all_contributors/gh_repo_lists/all_gh_repos.txt b/code/myriad/get_all_contributors/gh_repo_lists/all_gh_repos.txt index 27b78e26..94b8d58d 100644 --- a/code/myriad/get_all_contributors/gh_repo_lists/all_gh_repos.txt +++ b/code/myriad/get_all_contributors/gh_repo_lists/all_gh_repos.txt @@ -1,24 +1,18 @@ BelaPlatform/Bela -CNMAT/OpenSoundControl.org EnvelopSound/EnvelopForLive FFmpeg/FFmpeg -GNOME/gimp HandBrake/HandBrake KhronosGroup/GLSL KhronosGroup/WebGL KhronosGroup/glslang -Kitware/CMake NVlabs/stylegan2 TU-Studio/IEMPluginSuite VSCodium/vscodium WebAudio/web-audio-api WebAudio/web-midi-api apache/httpd -apache/maven -arduino/arduino-ide audacity/audacity autonomousvision/projected-gan -bevyengine/bevy brandongmwong/elizabot-js brave/brave-browser brave/brave-core @@ -26,24 +20,15 @@ btel/svg_utils caprover/caprover carstenlebek/svelte-email *chromium/chromium -cilium/ebpf -colinbdclark/osc.js coz-m/MPLUS_FONTS curl/curl -docker/cli -docker/compose +electro-smith/libDaisy emacs-mirror/emacs -gcc-mirror/gcc -gfx-rs/wgpu +festvox/festival git/git -gka/chroma.js -glowroot/glowroot -google/angle -hobbyquaker/artnet joshnuss/svelte-persisted-store keenethics/svelte-notifications kirovj/pocketbase-pyclient -klingtnet/rosc llvm/llvm-project matplotlib/matplotlib microsoft/TypeScript @@ -53,23 +38,18 @@ mossblaser/plottie *mozilla/gecko-dev mozman/svgwrite mrdoob/three.js -nannou-org/nannou -nginx/nginx nodejs/node nodemailer/nodemailer nolimits4web/swiper -npm/cli npm/npm numpy/numpy openai/openai-node openframeworks/openFrameworks -openjdk/jdk openssl/openssl otuva/handwriting-synthesis pocketbase/pocketbase popcornmix/omxplayer processing/p5.js -processing/p5.js-web-editor processing/processing pure-data/pure-data python/cpython @@ -82,12 +62,8 @@ sass/sass sc00/svelte-textarea-auto-height scikit-learn/scikit-learn scipy/scipy -scribusproject/scribus signalapp/Signal-iOS sjvasquez/handwriting-synthesis -snapview/tokio-tungstenite -snapview/tungstenite-rs -supercollider/supercollider sveltejs/svelte tensorflow/tensorflow textmate/textmate @@ -95,4 +71,3 @@ textmate/textmate v8/v8 videolan/vlc vitejs/vite -websockets/ws diff --git a/code/myriad/get_all_contributors/gh_repo_lists/rethread_gh_repos.txt b/code/myriad/get_all_contributors/gh_repo_lists/rethread_gh_repos.txt index f77b9f2e..292b922e 100644 --- a/code/myriad/get_all_contributors/gh_repo_lists/rethread_gh_repos.txt +++ b/code/myriad/get_all_contributors/gh_repo_lists/rethread_gh_repos.txt @@ -1,50 +1,20 @@ coz-m/MPLUS_FONTS -processing/processing -processing/p5.js-web-editor -bevyengine/bevy emacs-mirror/emacs -gcc-mirror/gcc -Kitware/CMake microsoft/vscode -nannou-org/nannou -nodejs/node -openframeworks/openFrameworks processing/p5.js python/cpython rust-lang/rust -supercollider/supercollider v8/v8 -FFmpeg/FFmpeg -videolan/vlc llvm/llvm-project curl/curl -npm/cli -mrdoob/three.js git/git -nginx/nginx -docker/cli -docker/compose apache/httpd openssl/openssl -colinbdclark/osc.js -websockets/ws -snapview/tungstenite-rs -snapview/tokio-tungstenite -klingtnet/rosc -CNMAT/OpenSoundControl.org -hobbyquaker/artnet -glowroot/glowroot rust-lang/cargo -gka/chroma.js -google/angle -cilium/ebpf -microsoft/TypeScript -brave/brave-browser -openjdk/jdk -apache/maven -GNOME/gimp -scribusproject/scribus -arduino/arduino-ide -gfx-rs/wgpu ritwickdey/vscode-live-server rtyley/bfg-repo-cleaner +electro-smith/libDaisy +festvox/festival +mozilla/gecko-dev +torvalds/linux +chromium/chromium