Skip to content

Instantly share code, notes, and snippets.

@AndreVallestero
Created September 20, 2022 13:03
Show Gist options
  • Save AndreVallestero/fa5b81e852f8a1028fcf32a40179e8b2 to your computer and use it in GitHub Desktop.
Save AndreVallestero/fa5b81e852f8a1028fcf32a40179e8b2 to your computer and use it in GitHub Desktop.
Count number of commits and unique contributors in the past year
from pydriller import Repository
from datetime import datetime
commits = 0
contributors = set()
now = datetime.now().astimezone()
for commit in Repository('https://github.com/olive-editor/olive.git').traverse_commits():
if ((now - commit.author_date).days > 365): continue
contributors.add(commit.author.email)
commits += 1
contributors_count = len(contributors)
print(f"commits: {commits}\ncontributors: {contributors_count}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment