CPAN functionality for python

Sean Reifschneider jafo-pythonlist at tummy.com
Thu Feb 15 19:02:27 EST 2001


On Tue, Feb 13, 2001 at 07:50:25PM +0300, Oleg Broytmann wrote:
>   Ok, so we should create formats and protocols and reference
>implementations. Zope can be use for one of such reference implementations,
>but we must have other implementations as well.

Ok, so from a client side we'll need the following commands available:

   Search:
      Takes:
         Module name
         Module Version*
         Platform*
         Platform Version*
         Architecture*
         Package Format*
      Returns:
         List of matching entities:
            Module name
            Module Version
            Platform
            Platform Version
            Architecture
            Package Format
   
   Find:
      Takes:
         Module name
         Module Version
         Platform
         Platform Version
         Architecture
         Package Format
      Returns:
         List of:
            URL

For the protocol, I'd recommend sockets using DJB's netstring encoding (which
I just happen to have a module for).  Netstrings allow embedded spaces and
nulls, and send the size of the messages before the messages themselves, so
that space can be allocated (preventing buffer overruns) and overly large
messages can be dropped right up front.  They can also be embedded within
other netstrings to represent lists or dictionaries:

   >>> print netstring.stons([ 'a', 'b', 'c' ])
   12:1:a,1:b,1:c,,
   >>> print netstring.dicttons({ 'a' : 1, 'b' : 2, 'c' : 'foo' })
   26:1:a,1:1,1:b,1:2,1:c,3:foo,,
   >>> print netstring.nstodict('26:1:a,1:1,1:b,1:2,1:c,3:foo,,')
   {'b': '2', 'c': 'foo', 'a': '1'}

You get the idea.  The module is available from
ftp://ftp.tummy.com/pub/tummy/Python/netstring/

The schema required for the database is pretty obvious, but the questions
become wether we want to try to track descriptions of the packages (and how
to search them), groupings of packages, etc.

Sean
-- 
 Actual error message:  "Keyboard not connected.  Press F1 to continue."
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python




More information about the Python-list mailing list