Draws Python object reference graphs with graphviz
objgraph is a module that lets you visually explore Python object graphs.
You’ll need graphviz if you want to draw the pretty graphs.
I recommend xdot for interactive use. pip install xdot should suffice; objgraph will automatically look for it in your PATH.
pip install objgraph or download it from PyPI.
Documentation lives at http://mg.pov.lt/objgraph.
I’ve developed a set of functions that eventually became objgraph when I was hunting for memory leaks in a Python program. The whole story – with illustrated examples – is in this series of blog posts:
issue 28 <https://github.com/mgedmin/objgraph/pull/28>).
show_growthnow defaults to None instead of sys.stdout. None is interpreted to be the same as sys.stdout, which means the right stdout will be used if you change it at runtime (which happens, in doctests).
show_growth now accept a file
argument if you want to redirect the output elsewhere.
Fixes issue 24. Contributed by “d-sun-d”.
Don’t trust __class__ to be accurate and __name__ to be a string. Fixes errors in some convoluted corner cases when mocks are involved.
Contributed by Andrew Shannon Brown in PR 26.
Drop support for Python 2.4, 2.5, and 2.6.
Drop support for Python 3.1 and 3.2.
Add support for Python 3.5.
Avoid creating reference cycles between the stack frame and the local
objects variable in
Fixes issue 22. Contributed by Erik Bray.
show_backrefs now accept a file-like object
(via the new output argument) as an alternative to a filename.
Made internal helper methods private. This includes
Correctly determine the name of old-style classes in
by_type, and graph drawing functions.
Fixes issue 16. Contributed by Mike Lambert.
Do not expect file objects to have an encoding attribute. Makes objgraph compatible with Eventlet’s monkey-patching.
Fixes issue 6. Contributed by Jakub Stasiak.
show_backrefsnow allows arbitrary image formats, not just PNG. Patch by Riccardo Murri.
get_leaking_objects, based on a blog post by Kristján Valur.
find_backref_chainreturns [obj] instead of None when a chain could not be found. This makes show_chain(find_backref_chain(...), ...) not break.
show_backrefsby specifying too_many.
show_refsdescend into modules.
show_backrefs, since obj might be a list/tuple.
show_backrefsdon’t create files in the current working directory any more. Instead they accept a filename argument, which can be a .dot file or a .png file. If None or not specified, those functions will try to spawn xdot as before.
show_refsfor showing forward references.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|File Name & Checksum SHA256 Checksum Help||Version||File Type||Upload Date|
|objgraph-3.1.0-py2-none-any.whl (18.6 kB) Copy SHA256 Checksum SHA256||py2||Wheel||Dec 7, 2016|
|objgraph-3.1.0.tar.gz (629.8 kB) Copy SHA256 Checksum SHA256||–||Source||Dec 7, 2016|