Number of Packages in the "cheeseshop"

John Machin sjmachin at lexicon.net
Thu Mar 5 08:38:58 EST 2009


On Mar 5, 9:40 pm, Michael Rudolf <spamfres... at ch3ka.de> 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




More information about the Python-list mailing list