{"action":"opened","issue":{"url":"https://api.github.com/repos/jrfonseca/gprof2dot/issues/14","labels_url":"https://api.github.com/repos/jrfonseca/gprof2dot/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/jrfonseca/gprof2dot/issues/14/comments","events_url":"https://api.github.com/repos/jrfonseca/gprof2dot/issues/14/events","html_url":"https://github.com/jrfonseca/gprof2dot/issues/14","id":119660545,"number":14,"title":"Module name may not be sufficient for Python profiles","user":{"login":"mgedmin","id":159967,"avatar_url":"https://avatars.githubusercontent.com/u/159967?v=3","gravatar_id":"","url":"https://api.github.com/users/mgedmin","html_url":"https://github.com/mgedmin","followers_url":"https://api.github.com/users/mgedmin/followers","following_url":"https://api.github.com/users/mgedmin/following{/other_user}","gists_url":"https://api.github.com/users/mgedmin/gists{/gist_id}","starred_url":"https://api.github.com/users/mgedmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgedmin/subscriptions","organizations_url":"https://api.github.com/users/mgedmin/orgs","repos_url":"https://api.github.com/users/mgedmin/repos","events_url":"https://api.github.com/users/mgedmin/events{/privacy}","received_events_url":"https://api.github.com/users/mgedmin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-01T07:37:48Z","updated_at":"2015-12-01T07:37:48Z","closed_at":null,"body":"Python profiles are sometimes hard to read because all you see is:\r\n- module name\r\n- line number\r\n- function/method name\r\n\r\nbut you don't see\r\n- package name\r\n- class name\r\n\r\nThere may be a dozen different modules with the same name in different packages, don't let me get started about methods called `__init__`.\r\n\r\nNow it's hard to do anything about class names if the profiling data doesn't contain that information (at least on Python 2.7; Python 3 introduced `__qualname__` that gives me hope for the eventual bright future, although I haven't actually checked if the profiler records those).\r\n\r\nPackage names are also difficult, since all we have is filenames.  (If the files still exist you could walk up the tree looking for `__init__.py` files: when these stop, you found the root package.  Except Python 3.3 breaks that heuristic with its implicit namespace packages and anyway, you cannot always rely on having the source code available -- what if the profile was made on a different machine?).\r\n\r\nStill, not all hope is lost: the full filename is available, and humans can figure out the package name from that (or look up the class name from filename + line number).  Filenames are long, though, and would not fit in the graph nicely -- but wouldn't it be awesome if they were available via tooltips?\r\n\r\nCertain graphviz formats (such as SVG) support tooltips.  I have a patch prepared."}}