[py-dev] Future export interface

David Stanek dstanek at dstanek.com
Wed Jun 8 14:12:23 CEST 2005


I want to get my hands a little dirty by playing with the
export/import changes that are in the future document. The example
of the new specification looks like:

  from py import pkg
  pkg.export(__name__,
          pkg.Class('local', 'doc comment', extpy='./path/local.LocalPath'),
          pkg.Class('svnurl', 'doc comment',
              extpy='./path/local/svn/urlcommand.SvnUrlPath'),
      ),
  # it goes on ...
  )

I was thinking about how this would look a little and I am unsure of it.

The keyword arguments that are currently passed to initpkg are missing
from the example and adding them in to the export call may look clumsy.
I was thinking of something like:

  from py import pkg
  exporter = pkg.Exporter(__name__, description, version, url, etc...)
  exporter.exportModule('path', 'doc comment',
      pkg.Class('local', 'doc comment', extpy='./path/local.Localpath'),
      pkg.Class('svnurl', 'doc comment',
          extpy='./path/local/svn/urlcommand.SvnUrlPath'),
      # more exported classes
  )
  exporter.exportModule('junk', 'doc comment',
      pkg.Module('stuff', 'doc comment',
          pkg.Class('Stuff', 'comment')
      )
  )

That is an attempt to flatten the data structure and make it more
readable.

Regards,
David



More information about the py-dev mailing list