1. Ronald Oussoren
  2. modulegraph
  3. Issues
Issue #16 new

Extended info in the graph? (and: best way to ask qs)

created an issue

I would like to add info to the graph about other dependencies, for example that script "foo" needs a binary "/Some/path/to/bar.dylib" or that it needs to be bundled with "/Another/path/to/userdata.txt". Is there some way to do this?

I tried mg.import_hook but that doesn't work for arbitrary paths, only real python. I also tried mg.createReference but this needs a to-node. I hesitate to call mg.createNode() directly for this use, is that allowed?

An alternative is to carry my auxiliary info outside the graph, e.g. by having a dict relating a graphident to a list of stuff. But it would be nice to store it all in the graph.

Also: is this "issue" mechanism the best way to ask such questions? Or would you rather I asked in stackoverflow or ... ?

Comments (5)

  1. Ronald Oussoren repo owner

    The modulegraph is currently just that: a graph of dependencies between python modules and packages.

    You could add new Node subclasses for other dependencies and then use createNode to create these nodes.

    BTW. How do you determine which other dependencies a module has?

    Py2app uses a separate step for determining the shared library dependencies of extensions (using macholib). That keeps the modulegraph code platform independent, and futhermore the macholib functionality is usable on its own.

  2. david_cortesi reporter

    RIght now I'm looking at "hook-modulename" files which are specific to packages such as Wx, Qt, Django etc. A hook can add specific binary or data-file dependencies it knows about based on the active platform and other factors. There is also a more general dependency search I haven't explored yet. Anyway I will store these outside the graph, in dicts keyed by graphident. Thanks for the info.

  3. Ronald Oussoren repo owner

    Do you mean the hook-<NAME> modules in pyinstaller (https://github.com/cleverplugs/pyinstaller/tree/master/PyInstaller/hooks, http://www.pyinstaller.org/export/develop/project/doc/Manual.html#hooks)?

    The basic goal appears to be similar to py2app's recipe system, but slightly cleaner and with documentation. I'd have to research this some more, but that system might be useable as a replacement for a large part of py2app's recipe system, and bits of modulegraph itself (in particular the modulegraph.find_modules.get_implies function and its callers).

  4. Log in to comment