Skip to content

Instantly share code, notes, and snippets.

@lmacken
Last active August 29, 2015 14:21
Show Gist options
  • Save lmacken/6efc836f6f7365656ff6 to your computer and use it in GitHub Desktop.
Save lmacken/6efc836f6f7365656ff6 to your computer and use it in GitHub Desktop.
Analyze the activity of Fedora Hosted projects over a period of time.
import operator
import feedparser
import multiprocessing.pool
DAYS_BACK = 498 # 2014-1-1 -> 2015-05-14 https://daycalc.appspot.com/01/01/2015
RSS = 'https://fedorahosted.org/{}/timeline?ticket=on&changeset=on&milestone=on&wiki=on&max=50&format=rss&daysback={}&authors='
active_projects = {}
def handle(project):
project = project.strip()
feed = feedparser.parse(RSS.format(project, DAYS_BACK))
entries = feed['entries']
if entries:
active_projects[project] = len(entries)
with file('fedorahosted-projects.txt') as fh:
projects = fh.readlines()
total = len(projects)
pool = multiprocessing.pool.ThreadPool(20)
pool.map(handle, projects)
num_active = len(active_projects)
print('{} out of {} ({:.2f}%) active Fedora Hosted projects since 2014-01-01'.format(num_active, total, num_active / float(total) * 100))
#for project, entries in sorted(active_projects.items(), key=operator.itemgetter(1)):
# print('{} {}'.format(entries, project))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment