Launchpad statistic

Hi all,

Until today i thought Launchpad doesn’t have way get statistic. But today i found it was wrong. Launchpad have way Tracking PPA download statistics http://blog.launchpad.net/cool-new-stuff/tracking-ppa-download-statistics. If you use Ubuntu you can try yourself just use this python script: #!/usr/bin/python

See

https://api.launchpad.net/+apidoc/devel.html#binary_package_publishing_history

See API/launchpadlib - Launchpad Help

from launchpadlib.launchpad import Launchpad

import os

print ‘Please, wait…’

USERNAME=‘dismine’ PPA=‘valentina-dev’ PACKAGE=‘valentina’

print ‘Connect to Service.’

cachedir = os.environ[‘HOME’] + ‘/.launchpadlib/cache/’ launchpad = Launchpad.login_anonymously(‘just testing’, ‘production’, cachedir)

print ‘Getting package information.’

ppa = launchpad.people[USERNAME].getPPAByName(name=PPA) bins = ppa.getPublishedBinaries(binary_name=PACKAGE) builds = total = 0

print ‘Creation statistic.’

for bin in bins: count = bin.getDownloadCount() total += count if (count > 0): builds.append([count,‘%s %s’ % (bin.binary_package_name,bin. binary_package_version)])

builds_sorted = sorted(builds,key=lambda count: count[0],reverse=True)

for build in builds_sorted: print ‘%s:%s’ % (build[0], build[1])

print ‘Total: %s’ % (total)

Example: dismine@dismine:~$ python launchpad_stats.py Please, wait… Connect to Service. Getting package information. Creation statistic. 11:valentina 0.2.2+339+15+201402281649~ubuntu13.10.1 5:valentina 0.2.2+339+15+201402281657~ubuntu12.04.1 5:valentina 0.2.2+339+15+201402281649~ubuntu13.10.1 4:valentina 0.2.2+464+26+201407111231~ubuntu14.04.1 3:valentina 0.2.2+521+26+201407291901~ubuntu14.04.1 3:valentina 0.2.2+472+26+201407132048~ubuntu14.04.1 3:valentina 0.2.2+444+26+201406301636~ubuntu14.04.1 2:valentina 0.2.2+506+26+201407250117~ubuntu14.04.1 2:valentina 0.2.2+493+26+201407171618~ubuntu14.04.1 2:valentina 0.2.2+330+15+201402201607~ubuntu13.10.1 2:valentina 0.2.2+330+15+201402201607~ubuntu13.10.1 1:valentina 0.2.2+521+26+201407291901~ubuntu14.04.1 1:valentina 0.2.2+464+26+201407101231~ubuntu14.04.1 1:valentina 0.2.2+339+15+201402281652~ubuntu12.10.1 1:valentina 0.2.2+330+15+201402201607~ubuntu12.04.1 1:valentina 0.2.2+326+15+201402191511~ubuntu12.04.1 1:valentina 0.2.2+315+13+201402141947~ubuntu13.10.1 1:valentina 0.2.2+306+13+201402110741~ubuntu13.10.1 1:valentina 0.2.1+300+12+201402100733~ubuntu12.04.1 1:valentina 0.2.1+300+12+201402100731~ubuntu13.10.1 1:valentina 0.2.1+300+12+201402100731~ubuntu13.10.1 Total: 52

*Conclusion. *Right now we don’t have full download statistic. How do you think should we create such statistic or available information enough? I mean PPA statistic plus BitBucket download statistic.

Roman