#14 Fix importgraph for relative imports


Graphs produced with G{importgraph} currently only have edges for imports of the form "from package.a import name"; relative imports of the form "import a" inside 'package' do not show up.

This patch tries to fix it.

The problem is that ModuleDoc.imports stores a list of imports names spelled as they were at the time of import, which docwriter.dotgraph.import_graph() can not resolve later. Instead, global names should be stored on imports, which my patch does. Even better would be storing objects representing parse tree nodes.

This patch moves the assignments of 'imports' after some 'if not isinstance(parent_docs[-1], NamespaceDoc)' statements, but I believe behaviour is unchanged because those ifs can never be true, as noted in comments in my patch.


  • Pieter Nagel

    Pieter Nagel - 2007-05-22

    Patch to fix importgraph

  • Edward Loper

    Edward Loper - 2008-01-29

    Logged In: YES
    Originator: NO

    Thanks for this patch. Applied in svn revision 1673.

  • Edward Loper

    Edward Loper - 2008-01-29
    • status: open --> closed-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks