ronaldoussoren / modulegraph2

Modulegraph2 is a library for creating and introspecting the dependency graph between Python modules.
MIT License
11 stars 8 forks source link

store code object inside of node #15

Closed xoviat closed 1 year ago

xoviat commented 3 years ago

In PyInstaller, we may parse the code object of a module, for later manipulation and extraction. To avoid duplicating work, we typically store the code object inside of the BaseNode object. Is this acceptable?

ronaldoussoren commented 3 years ago

The current API is to use extension_attributes dict for that, that dict won't be used by the package itself.

When I (finally) get around to use modulegraph2 in py2app the API might change, I'm keeping the API fairly minimal with additions where needed to keep the library easy to use and where users need to poke into private details (unlike the older modulegraph library that has a bigger and unclear API surface which makes development too hard).

I'm open for adding an API to access the code object for a node, for those nodes that can have one. The library already loads and processes those code objects, storing them in the graph would be easy enough.

ronaldoussoren commented 1 year ago

Version 2.2 introduced a code attribute on nodes that can have associated code. I'm not adding a code attribute to BaseNode because that makes it unclear as to which node types can have associated code.