[Pythonmac-SIG] First stab at an API for the pim module
Jack Jansen
Jack.Jansen@oratrix.com
Mon, 9 Sep 2002 00:12:00 +0200
Folks,
here's a rough sketch of an API and a GUI for the Python Install
Manager engine. Please shoot holes in it.
pim has two types of objects: pimdatabase and pimpackage. It has
one module-level method:
open(), which returns a pimdatabase.
pimdatabase objects have initially one method: list(), which
returns a list of all pimpackage objects in the database. Later
this will be extended for search routines and the like.
pimpackage objects have a couple of methods:
- name() returns the name (string)
- version() returns the version (string?)
- description() returns the one-line description (string)
- longdesc() returns the URL of the long description webpage (string)
isinstalled() returns a tuple. The first item is a
yes/no/outdated/problem indicator. The second is a user-readable
description of the first (example: "Installed", "Not installed",
"Version 2.0 is installed but 2.5 is available", "Some
prerequisites are missing").
- prerequisites() returns a list of prerequisites() for this
package that are not currently satisfied. Each list item is a
tuple (pimpackage, string). string is again a human-readable
explanation, pimpackage is either a pimpackage object or None,
in which case the description should tell the user what to do.
- install() installs the package. It returns a user-readable
string (examples: "Tkinter installed correctly", "Numeric
installed correctly, please restart IDE to start using it").
Install needs a couple of arguments, such as download folder for
the package, possibly install location, maybe more. This needs
thought.
The PIM GUI would consist of a browser of packages with an icon
showing the isinstalled() state. Select a package and in another
section of the window you get the name, version, description and
isinstalled() user-readable status, plus buttons more info,
check prerequisites and install. Check prerequisites brings up a
separate window listing all unsatisfied prerequisites plus the
accompanying message. This list is created recursively, so it
lists everything needed. Selecting a package here will also
select it in the package browser in the main PIM GUI window.
(That's why there's a separate window: the user can quickly
click through the missing prerequisites and press "install" for
each of them).
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution --
Emma Goldman -