{ "info": { "author": "Oliver Steele", "author_email": "steele@osteele.com", "bugtrack_url": null, "classifiers": [ "Framework :: IPython", "Framework :: Jupyter", "Intended Audience :: Developers", "Intended Audience :: Education", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6" ], "description": "Callgraph Magic\n===============\n\n|PyPI version| |Doc Status| |License| |Supported Python|\n\nCallgraph is a Python package that defines a decorator, and Jupyter magic,\nto draw `dynamic call graphs`_ of Python function calls.\n\nIt\u2019s intended for classroom use, but may also be useful for self-guided\nexploration.\n\nThe package defines a Jupyter `IPython`_ `magic`_, ``%callgraph``, that\ndisplays a call graph within a Jupyter cell:\n\n.. code:: python\n\n from functools import lru_cache\n\n @lru_cache()\n def lev(a, b):\n if \"\" in (a, b):\n return len(a) + len(b)\n\n candidates = []\n if a[0] == b[0]:\n candidates.append(lev(a[1:], b[1:]))\n else:\n candidates.append(lev(a[1:], b[1:]) + 1)\n candidates.append(lev(a, b[1:]) + 1)\n candidates.append(lev(a[1:], b) + 1)\n return min(candidates)\n\n %callgraph -w10 lev(\"big\", \"dog\"); lev(\"dig\", \"dog\")\n\n|image0|\n\nIt also provides a Python decorator, ``callgraph.decorator``, that\ninstruments a function to collect call graph information and render the\nresult.\n\nJupyter / IPython Usage\n-----------------------\n\n.. code:: bash\n\n $ pip install callgraph\n\nIn a Jupyter IPython notebook:\n\n.. code:: python\n\n %load_ext callgraph\n\n def nchoosek(n, k):\n if k == 0:\n return 1\n if n == k:\n return 1\n return nchoosek(n - 1, k - 1) + nchoosek(n - 1, k)\n\n %callgraph nchoosek(4, 2)\n\nAs an alternative to including ``%load_ext callgraph`` in each notebook that\nuses ``%callgraph``, you can add the extension to the Notebook\nconfiguration file in your IPython profile.\n\nYour configuration file is probably called ``~/.ipython/profile_default/ipython_config.py``.\n(You can run ``ipython profile locate`` to find it.)\nEdit this file to include the following line::\n\n c.InteractiveShellApp.extensions = [\"callgraph.extension\"]\n\n(If your configuration file already includes an uncommented statement\n``c.InteractiveShellApp.extensions = [\u2026]``, edit the list of extensions in\nthat line to include ``\"callgraph.extension\"``.\n\nSee `extension example notebook`_ for additional examples.\n\nDecorator Usage\n---------------\n\n.. code:: bash\n\n $ pip install callgraph\n\n.. code:: python\n\n from functools import lru_cache\n import callgraph.decorator as callgraph\n\n @callgraph()\n @lru_cache()\n def nchoosek(n, k):\n if k == 0:\n return 1\n if n == k:\n return 1\n return nchoosek(n - 1, k - 1) + nchoosek(n - 1, k)\n\n nchoosek(5, 2)\n\n nchoosek.__callgraph__.view()\n\nSee the `API documentation`_ for additional documentation.\n\nSee the `decorator example notebook`_ for additional instructions and examples.\n\nDevelopment\n-----------\n\nInstall dev tools, and set up a Jupyter kernel for the current python\nenviromnent:\n\n.. code:: bash\n\n $ pip install -r requirements-dev.txt\n $ python -m ipykernel install --user\n\nInstall locally:\n\n.. code:: bash\n\n flit install --symlink\n\nAcknowledgements\n----------------\n\nCallgraph uses the Python `graphviz package`_. Python graphviz uses\nthe `Graphviz`_ package.\n\nLicense\n-------\n\nMIT\n\n.. |PyPI version| image:: https://img.shields.io/pypi/v/callgraph.svg\n :target: https://pypi.python.org/pypi/callgraph\n :alt: Latest PyPI Version\n.. |Doc Status| image:: https://readthedocs.org/projects/callgraph/badge/?version=latest\n :target: http://callgraph.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n.. |License| image:: https://img.shields.io/pypi/l/callgraph.svg\n :target: https://pypi.python.org/pypi/callgraph\n :alt: License\n.. |Supported Python| image:: https://img.shields.io/pypi/pyversions/callgraph.svg\n :target: https://pypi.python.org/pypi/callgraph\n :alt: Supported Python Versions\n\n.. _dynamic call graphs: https://en.wikipedia.org/wiki/Call_graph\n.. _IPython: https://ipython.org\n.. _magic: http://ipython.readthedocs.io/en/stable/interactive/magics.html\n.. _graphviz package: https://github.com/xflr6/graphviz\n.. _Graphviz: https://www.graphviz.org\n\n.. |image0| image:: ./docs/images/lev.svg\n.. _API documentation: http://callgraph.readthedocs.io/en/latest/?badge=latest#module-callgraph\n.. _extension example notebook: https://github.com/osteele/callgraph/blob/master/examples/callgraph-magic-examples.ipynb\n.. _decorator example notebook: https://github.com/osteele/callgraph/blob/master/examples/callgraph-decorator-examples.ipynb\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/osteele/callgraph", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "callgraph", "package_url": "https://pypi.org/project/callgraph/", "platform": "", "project_url": "https://pypi.org/project/callgraph/", "project_urls": { "Documentation": "https://callgraph.readthedocs.io/en/latest/", "Homepage": "https://github.com/osteele/callgraph" }, "release_url": "https://pypi.org/project/callgraph/1.0.0/", "requires_dist": [ "graphviz (~=0.8.2)" ], "requires_python": ">=3.5", "summary": "This package defines decorators and IPython magic to display a dynamic call graph.", "version": "1.0.0" }, "last_serial": 3945557, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "c7d19ab24c4003679b66d54d1114671b", "sha256": "1f4b686c69d98149ad4c69d425746fbb3404d3ce6ceef36a9f91a4900d7493a3" }, "downloads": -1, "filename": "callgraph-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c7d19ab24c4003679b66d54d1114671b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 10757, "upload_time": "2018-01-03T02:44:14", "url": "https://files.pythonhosted.org/packages/64/18/8f54e0c93d3f5744c3a2c634d181a287dd1c722ecb2696606f3480448a3e/callgraph-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3f533c6003f9dbd842a3a7c96644388f", "sha256": "22631df16a4f8e1433e3da58e3ee1387b454c2de7994204c3d15f06df93c6054" }, "downloads": -1, "filename": "callgraph-0.1.tar.gz", "has_sig": false, "md5_digest": "3f533c6003f9dbd842a3a7c96644388f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 39492, "upload_time": "2018-01-03T02:44:19", "url": "https://files.pythonhosted.org/packages/9c/25/fcfaed3db5c66e9c95227e5752dc85b5114767c4c63c63d68881efa571ce/callgraph-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "cb47bbdfac278618f8e031bd532d65d5", "sha256": "81452a8a565ebabaccf2cd76079278015ed8e370d185416328265dea90ef901b" }, "downloads": -1, "filename": "callgraph-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "cb47bbdfac278618f8e031bd532d65d5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 10806, "upload_time": "2018-01-03T02:56:10", "url": "https://files.pythonhosted.org/packages/29/e4/0c242eb942d89b00ffef028ffe83f23400e47a47760b3a430d6c690677f6/callgraph-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7be59baa92cbf2cf59daef39d7897a99", "sha256": "4c5b08459add6a920cbb63a0a17971ade936c0928d75b9f8d158c2b52c2bbc47" }, "downloads": -1, "filename": "callgraph-0.1.1.tar.gz", "has_sig": false, "md5_digest": "7be59baa92cbf2cf59daef39d7897a99", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 41966, "upload_time": "2018-01-03T02:56:13", "url": "https://files.pythonhosted.org/packages/1d/80/621c1463411501b60d63f09b3e16b6842683e870b858b14ef0bb5499a564/callgraph-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "c797ae95613e3eaec94ba9813ea54c31", "sha256": "8272ee9053bc45b75c86f9f8d2016987e745997683b50489ea542f55d74cde61" }, "downloads": -1, "filename": "callgraph-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "c797ae95613e3eaec94ba9813ea54c31", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 11724, "upload_time": "2018-01-03T03:10:01", "url": "https://files.pythonhosted.org/packages/c1/af/460fc3504d7ae5643685fa46f91e30b4a9a98ce979a7e8546cd0ea0fed15/callgraph-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "44d84e2069336cceefa6d48d004b1793", "sha256": "1f748d4df6d52032467be35b048d9abe35d7a1b70a648d8f160eafaaefe0379b" }, "downloads": -1, "filename": "callgraph-0.1.2.tar.gz", "has_sig": false, "md5_digest": "44d84e2069336cceefa6d48d004b1793", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 42070, "upload_time": "2018-01-03T03:10:06", "url": "https://files.pythonhosted.org/packages/9f/d1/ab923b37d6c83aec60a54547c5dc8a07599e1f95c6929736327ccb18ae3e/callgraph-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "36ba790e6eb80058683094307ac1e091", "sha256": "a7b31f888bdb361a2cc20a44b38b8422c4e27e866f7f01c810021320d02ef819" }, "downloads": -1, "filename": "callgraph-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "36ba790e6eb80058683094307ac1e091", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 11849, "upload_time": "2018-01-03T03:44:23", "url": "https://files.pythonhosted.org/packages/e7/fb/7af0daf749dc7be22b3c2a847d5fb9d1e5f5d19ffa2f74f2df7110493334/callgraph-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "08c40e839d60035c00626c3e0f7632cc", "sha256": "61ce0dc5097074f501af4bcde430848edb180953f24e614d1dd4638db29c2dfd" }, "downloads": -1, "filename": "callgraph-0.1.3.tar.gz", "has_sig": false, "md5_digest": "08c40e839d60035c00626c3e0f7632cc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 33323, "upload_time": "2018-01-03T03:44:28", "url": "https://files.pythonhosted.org/packages/a7/87/a4998c9260a98e571fb2aed654e990e336f93b39a440d7aa94135c0e9843/callgraph-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "5239756be5a6e9ae807e8db06f482b3f", "sha256": "8a47ed144a912b287a628fc92e0a3de5a93d475f65a83946ba48dc16fbec6568" }, "downloads": -1, "filename": "callgraph-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "5239756be5a6e9ae807e8db06f482b3f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 12543, "upload_time": "2018-01-03T18:12:22", "url": "https://files.pythonhosted.org/packages/fe/ea/c64e444975e4b6eb75fb9a54d159e00be29f3cf7b416ba40c8b31a4db62e/callgraph-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5efd4a2cbc719d087c2bb42b003542f0", "sha256": "3de69e4a73b0768b9dcf33bc960047e8a5995f083d37a4559faa39034d830bfc" }, "downloads": -1, "filename": "callgraph-0.1.4.tar.gz", "has_sig": false, "md5_digest": "5efd4a2cbc719d087c2bb42b003542f0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 38013, "upload_time": "2018-01-03T18:12:30", "url": "https://files.pythonhosted.org/packages/19/e9/649c7051cde9fbe6818bd5da8b952e09e29d9c8e909412c2d9d54879fd6e/callgraph-0.1.4.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "d36c500f1eee88dc3f48bb20f755fc89", "sha256": "24db0ffa82a1eb037d90d030dacaa9494002a88bb06f4daf81266ebfa564eb2a" }, "downloads": -1, "filename": "callgraph-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d36c500f1eee88dc3f48bb20f755fc89", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 15444, "upload_time": "2018-06-09T16:08:16", "url": "https://files.pythonhosted.org/packages/6a/6c/bcd23ace79b168d8a6c2436d92c1321704e2fbb2165ef78119c9895d1db7/callgraph-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2ff727b8305d8f4df7036c4e440901c", "sha256": "7bf40a314734a5deff4cb6a1ad71b164dccf66b049dafe69536bea9d80fd4d07" }, "downloads": -1, "filename": "callgraph-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e2ff727b8305d8f4df7036c4e440901c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 55560, "upload_time": "2018-06-09T16:08:17", "url": "https://files.pythonhosted.org/packages/17/8c/19aa947e7bfe9020c59b07e3ba3a3b39e1f16c54fd32c4bdf2f12d3d6b40/callgraph-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d36c500f1eee88dc3f48bb20f755fc89", "sha256": "24db0ffa82a1eb037d90d030dacaa9494002a88bb06f4daf81266ebfa564eb2a" }, "downloads": -1, "filename": "callgraph-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d36c500f1eee88dc3f48bb20f755fc89", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 15444, "upload_time": "2018-06-09T16:08:16", "url": "https://files.pythonhosted.org/packages/6a/6c/bcd23ace79b168d8a6c2436d92c1321704e2fbb2165ef78119c9895d1db7/callgraph-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2ff727b8305d8f4df7036c4e440901c", "sha256": "7bf40a314734a5deff4cb6a1ad71b164dccf66b049dafe69536bea9d80fd4d07" }, "downloads": -1, "filename": "callgraph-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e2ff727b8305d8f4df7036c4e440901c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 55560, "upload_time": "2018-06-09T16:08:17", "url": "https://files.pythonhosted.org/packages/17/8c/19aa947e7bfe9020c59b07e3ba3a3b39e1f16c54fd32c4bdf2f12d3d6b40/callgraph-1.0.0.tar.gz" } ] }