Menu

#8 New rules to define public objects

Devel (cvs)
open
nobody
None
5
2006-01-09
2006-01-09
No

Hello,

i propose the attached patch to change the rule to
define what container an object belongs to.

Currently an object defined in a .so module (it should
be a .pyd on Windows, but this wasn't checked) belongs
to it. Often the .so object is just an implementative
detail and python modules are used to shape the package
in its public form.

Of course often objects are imported from .so/.pyd
modules just to be used into the bodule and are not
part of the public api.

The patched version first checks if the object is
inside a .py module AND in its __all__ list: such
module has precedence on any .so/.pyc.

A second update is related to modules public/private
state. Currently modules are public only if they are
iported from another public module. Often this is not
the case: many packages are not made to be imported
interely, but present a tree structure and people can
use "import parent.child1.child2" effectively loading
only the required module.

The patch marks as "public" all the modules explicitely
specified on the command line, unless its name doesn't
start with an underscore.

Discussion

  • Daniele Varrazzo

     
  • Daniele Varrazzo

    Logged In: YES
    user_id=1053920

    Patch moved to the exp-all-is-interface CVS branch.

     
  • Edward Loper

    Edward Loper - 2006-01-25

    Logged In: YES
    user_id=195958

    This patch looks good to me -- although it might be a good
    idea to add a few try/except blocks in case __all__ isn't
    a list.

    -Edward

     
  • Edward Loper

    Edward Loper - 2006-03-17

    Logged In: YES
    user_id=195958

    Epydoc 3.0 is basically taking this approach: if a
    variable is explicitly listed in __all__, then it's
    treated like it's not imported.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.