Package: objgraph
Python Object Graphsobjgraphis a module that lets you visually explore Python object graphs.You’ll needgraphvizif you want to draw
the pretty graphs.I recommendxdotfor interactive use.pip install xdotshould suffice; objgraph will automatically look for it
in yourPATH.Installation and Documentationpip install objgraphordownload it from PyPI.Documentation lives athttps://mg.pov.lt/objgraph.HistoryI’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:Hunting memory leaks in PythonPython object graphsObject graphs with graphvizSupport and DevelopmentThe source code can be found in this Git repository:https://github.com/mgedmin/objgraph.To check it out, usegit clonehttps://github.com/mgedmin/objgraph.Report bugs athttps://github.com/mgedmin/objgraph/issues.Changes3.6.1 (2024-02-26)Add support for Python 3.12.3.6.0 (2023-06-16)Add support for Python 3.9, 3.10, and 3.11.Drop support for Python 2.7 and 3.6.3.5.0 (2020-10-11)Do not requiremockfor the test suite on Python 3; use unittest.mock
instead.100% test coverage for each version of Python rather than combined, usingcoverage-python-version.Add the optionalextra_node_attrsparameter toshow_backrefsandshow_backrefsFix IPython/Jupyter inline graph support code that would kick in even if you
explicitly passed a filename=’foo.png’ argument toshow_refs/show_backrefs.  Seeissue 47.Add support for Python 3.8.Drop support for Python 3.5.3.4.1 (2019-04-23)Add support for Python 3.7.Drop support for Python 3.3 and 3.4.3.4.0 (2018-02-13)New functions:get_new_ids,at_addrs.Contributed by Justin Black inPR 36.3.3.0 (2017-12-28)New function:growth.3.2.0 (2017-12-20)Newfilterargument fortypestats,most_common_types,show_most_common_types,show_growth.Show lambda functions in a more human-friendly way.3.1.2 (2017-11-27)Correct UTF-8 mojibake in the changelog and switch all links to HTTPS.3.1.1 (2017-10-30)Add support for Python 3.6.Replace bareexcept:insafe_repr()withexcept Exception:.3.1.0 (2016-12-07)Support displaying graphs inline in IPython/Jupyter notebooks (issue 28
<https://github.com/mgedmin/objgraph/pull/28>).3.0.1 (2016-09-17)Thefileargument ofshow_most_common_typesandshow_growthnow defaults toNoneinstead ofsys.stdout.Noneis interpreted to be the same assys.stdout, which means
the right stdout will be used if you change it at runtime (which happens,
in doctests).3.0.0 (2016-04-13)show_most_common_typesandshow_growthnow accept afileargument if you want to redirect the output elsewhere.Fixesissue 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 inPR 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.2.0.1 (2015-07-28)Avoid creating reference cycles between the stack frame and the localobjectsvariable inby_type,count, andtypestats.Fixesissue 22.  Contributed
by Erik Bray.2.0.0 (2015-04-18)show_refsandshow_backrefsnow accept a file-like object
(via the newoutputargument) as an alternative to a filename.Made internal helper methods private. This includesfind_chain,show_graph,obj_node_id,obj_label,quote,long_typename,safe_repr,short_repr,gradient,edge_label, and_program_in_path.Correctly determine the name of old-style classes incount,by_type, and graph drawing functions.Fixesissue 16.  Contributed
by Mike Lambert.1.8.1 (2014-05-15)Do not expect file objects to have anencodingattribute.  Makes objgraph
compatible with Eventlet’s monkey-patching.Fixesissue 6.  Contributed
by Jakub Stasiak.1.8.0 (2014-02-13)Moved to GitHub.Python 3.4 support (LP#1270872).New function:is_proper_module.Newshortnamesargument fortypestats,most_common_types,show_most_common_types,show_growth,show_refs,
andshow_backrefs.countandby_typeaccept fully-qualified type names now.Fixesissue 4.1.7.2 (2012-10-23)Bugfix: setup.py sdist was broken on Python 2.7 (UnicodeDecodeError in
tarfile).Thefilenameargument forshow_refsandshow_backrefsnow
allows arbitrary image formats, not just PNG.  Patch byRiccardo
Murri.Temporary dot files are now namedobjgraph-*.dotinstead oftmp*.dot.Python 3.3 support: no code changes, but some tests started failing because
the new and improved dictionary implementation no longer holds references to
str objects used as dict keys.Added a tox.ini for convenient multi-Python testing.1.7.1 (2011-12-11)Bugfix: non-ASCII characters in object representations would break graph
generation on Python 3.x, in some locales (e.g. with LC_ALL=C).  Reported and
fixed byStefano Rivera.Bugfix: setup.py was broken on Python 3.xBugfix: dot.exe/xdot.exe were not found on Windows (LP#767239).Documentation updates: document the forgottenfind_ref_chain,
updateshow_chainprototype.1.7.0 (2011-03-11)New function:find_ref_chain.Newbackrefsargument forshow_chain.New function:get_leaking_objects, based ona blog post by
Kristján Valur.Newobjectsargument forcount,typestats,most_common_types,show_most_common_types, andby_type.Edges pointing to function attributes such as __defaults__ or __globals__
are now labeled.Edge labels that are not simple strings now show the type.Bugfix: ‘0’ and other unsafe characters used in a dictionary key could
break graph generation.Bugfix: show_refs(…, filename=’graph.dot’) would then go to complain
about unrecognized file types and then produce a png.1.6.0 (2010-12-18)Python 3 support, thanks to Stefano Rivera (fixesLP#687601).Removed weird weakref special-casing.1.5.1 (2010-12-09)Avoid test failures in uncollectable-garbage.txt (fixesLP#686731).Added HACKING.txt (later renamed to HACKING.rst).1.5.0 (2010-12-05)Show frame objects as well (fixesLP#361704).New functions:show_growth,show_chain.find_backref_chainreturns[obj]instead ofNonewhen a chain
could not be found.  This makesshow_chain(find_backref_chain(...),...)not break.Show how many references were skipped from the output ofshow_refs/show_backrefsby specifyingtoo_many.Makeshow_refsdescend into modules.Do not highlight classes that define a__del__, highlight only instances of
those classes.Option to show reference counts inshow_refs/show_backrefs.AddSphinxdocumentation and a PyPI
long description.1.4.0 (2010-11-03)Compatibility with Python 2.4 and 2.5 (tempfile.NamedTemporaryFilehas nodeleteargument).New function:most_common_types.1.3.1 (2010-07-17)Rebuild an sdist with no missing files (fixesLP#606604).Added MANIFEST.in and a Makefile to check that setup.py sdist generates
source distributions with no files missing.1.3 (2010-07-13)Highlight objects with a__del__method.FixesLP#483411: suggest always passing[obj]toshow_refs,show_backrefs, since obj might be a
list/tuple.FixesLP#514422:show_refs,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.New extra_info argument to graph-generating functions (patch by Thouis Jones,LP#558914).setup.py should work with distutils now (LP#604430, thanks to Randy Heydon).1.2 (2009-03-25)Project website, public source repository, uploaded to PyPI.No code changes.1.1 (2008-09-10)New function:show_refsfor showing forward references.New functions:typestatsandshow_most_common_types.Object boxes are less crammed with useless information (such as IDs).Spawnsxdotif it is available.1.0 (2008-06-14)First public release.