Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Number of Packages in the "cheeseshop"

Reply
Thread Tools

Number of Packages in the "cheeseshop"

 
 
Michael Rudolf
Guest
Posts: n/a
 
      03-05-2009
Hi, I just wondered how many Packages are in the Python Package Index.

I could not find any counter, but I found that there is a category
overview on http://pypi.python.org/pypi?%3Aaction=browse .

A quick look at the HTML told me that the number of Packages per
Category is listed surrounded by parentheses, at most one per line.

So I counted them:

import urllib
sum=0
for t in urllib.urlopen('http://pypi.python.org/pypi?%3Aaction=browse'):
t=t.split('(')[-1].split(')')[0]
try:
sum += int(t)
except ValueError:
pass # print "OMG cannot convert %s to int" % t
print "sum is: %s" % sum

Which yields: sum is: 31670

That would be around half the weight of CPAN, which would be a
not-so-bad result

My Questions:
a) Are there package listed in multiple Categories, which would breaking
my counting?
b) Did I make some other mistake(s)?
c) is there a counter which yields the current number of PyPI-Packages?

PS: Please excuse my bad english, I am not a native speaker.

THX, Michael
 
Reply With Quote
 
 
 
 
John Machin
Guest
Posts: n/a
 
      03-05-2009
On Mar 5, 9:40*pm, Michael Rudolf <(E-Mail Removed)> wrote:
> Hi, I just wondered how many Packages are in the Python Package Index.
>
> I could not find any counter,


Main page (http://pypi.python.org/pypi), right at the top:
"""
The Python Package Index is a repository of software for the Python
programming language. There are currently 5883 packages here.
"""

The devs must have read your posting and slammed in a quick fix

> but I found that there is a category
> overview onhttp://pypi.python.org/pypi?%3Aaction=browse.
>
> A quick look at the HTML told me that the number of Packages per
> Category is listed surrounded by parentheses, at most one per line.
>
> So I counted them:
>
> import urllib
> sum=0
> for t in urllib.urlopen('http://pypi.python.org/pypi?%3Aaction=browse'):
> * * t=t.split('(')[-1].split(')')[0]


That statement is a thing of beauty and a joy forever. I wonder what
it does.

> * * try:
> * * * * sum += int(t)
> * * except ValueError:
> * * * * pass # print "OMG cannot convert %s to int" % t
> print "sum is: %s" % sum
>
> Which yields: sum is: 31670
>
> That would be around half the weight of CPAN, which would be a
> not-so-bad result
>
> My Questions:
> a) Are there package listed in multiple Categories, which would breaking
> my counting?


Next you'll be asking if items are listed in multiple categories on
eBay

Have you considered looking at the listing for some individual
packages? Here's one:

# Categories

* Development Status :: 5 - Production/Stable
* Intended Audience :: Developers
* License :: OSI Approved :: BSD License
* Operating System :: OS Independent
* Programming Language :: Python
* Topic :: Database
* Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/
Libraries
* Topic :: Office/Business :: Financial :: Spreadsheet
* Topic :: Software Development :: Libraries :: Python Modules

So that's 9 categories. And 4 topics -- that'd be "keyword spamming"
on eBay

> b) Did I make some other mistake(s)?


Yes.

> c) is there a counter which yields the current number of PyPI-Packages?


Yes.
>
> PS: Please excuse my bad english, I am not a native speaker. * *
>
> THX, Michael


 
Reply With Quote
 
 
 
 
Michael Rudolf
Guest
Posts: n/a
 
      03-05-2009
Am Thu, 5 Mar 2009 05:38:58 -0800 (PST)
schrieb John Machin <(E-Mail Removed)>:

> Main page (http://pypi.python.org/pypi), right at the top:
> """
> The Python Package Index is a repository of software for the Python
> programming language. There are currently 5883 packages here.
> """


Ooops... totally missed that... must have been blind, sorry.
Thank you.

> > for t in \
> > urllib.urlopen('http://pypi.python.org/pypi?%3Aaction=browse'):
> > t=t.split('(')[-1].split(')')[0]

> That statement is a thing of beauty and a joy forever. I wonder what
> it does.

extracts everything between parentheses per line, as long as there is
exactly one '(' and one ')' in it (true for that site).

Didnt want to parse the HTML or write a regex for that simple Job.

Anyways, sorry for that stupid post and thanks for pointing out that
there actually *is* a counter.
Next time I will readjust my caffeine-in-blood-level before posting.

Michael
 
Reply With Quote
 
Gerard Flanagan
Guest
Posts: n/a
 
      03-05-2009
Michael Rudolf wrote:
> Hi, I just wondered how many Packages are in the Python Package Index.


fwiw

http://bitbucket.org/djerdo/musette/...wnload-pypi.py

regards

G.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python Packages : A loomingproblem? packages might no longer work? (well not on your platform or python version anyway) David Lyon Python 19 04-23-2009 11:10 PM
OT: Number Nine, Number Nine, Number Nine FrisbeeŽ MCSE 37 09-26-2005 04:06 PM
Advice on converting hashed packages to pseudo-hashed packages Ian Perl Misc 3 02-12-2005 12:17 AM
Do the javax.imageio packages replace packages in com.sun.image? Paul Smith Java 0 11-18-2003 02:58 PM



Advertisments