{"id":13586235,"url":"https://github.com/zhuyifei1999/guppy3","last_synced_at":"2026-01-06T01:14:10.136Z","repository":{"id":44007985,"uuid":"202611372","full_name":"zhuyifei1999/guppy3","owner":"zhuyifei1999","description":"guppy / heapy ported to Python3. It works for real!","archived":false,"fork":false,"pushed_at":"2025-01-16T21:43:02.000Z","size":1907,"stargazers_count":409,"open_issues_count":4,"forks_count":24,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-03T10:35:29.291Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://zhuyifei1999.github.io/guppy3/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhuyifei1999.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-15T21:05:15.000Z","updated_at":"2025-03-26T16:25:59.000Z","dependencies_parsed_at":"2024-01-12T23:43:10.844Z","dependency_job_id":"4891f3d5-d5f7-4c89-9fc9-0cf06d1abac8","html_url":"https://github.com/zhuyifei1999/guppy3","commit_stats":{"total_commits":442,"total_committers":11,"mean_commits":40.18181818181818,"dds":"0.23529411764705888","last_synced_commit":"4315f2744db242e73cbfaaa1eda4dcf0cf84b68c"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuyifei1999%2Fguppy3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuyifei1999%2Fguppy3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuyifei1999%2Fguppy3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuyifei1999%2Fguppy3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhuyifei1999","download_url":"https://codeload.github.com/zhuyifei1999/guppy3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248243473,"owners_count":21071054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:05:25.115Z","updated_at":"2026-01-06T01:14:10.131Z","avatar_url":"https://github.com/zhuyifei1999.png","language":"Python","funding_links":[],"categories":["Python","Memory Management"],"sub_categories":[],"readme":"# Guppy 3\n[![Build Status](https://img.shields.io/github/actions/workflow/status/zhuyifei1999/guppy3/workflow.yml?branch=master)](https://github.com/zhuyifei1999/guppy3/actions/workflows/workflow.yml) [![Codecov](https://img.shields.io/codecov/c/github/zhuyifei1999/guppy3)](https://codecov.io/gh/zhuyifei1999/guppy3) [![PyPI version](https://img.shields.io/pypi/v/guppy3)](https://pypi.org/project/guppy3/) [![Repology - Repositories](https://img.shields.io/repology/repositories/python:guppy3)](https://repology.org/project/python:guppy3/versions) [![PyPI - Downloads](https://img.shields.io/pypi/dm/guppy3)](https://pypistats.org/packages/guppy3)  \n[![PyPI - Implementation](https://img.shields.io/pypi/implementation/guppy3)](https://pypi.org/project/guppy3/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/guppy3)](https://pypi.org/project/guppy3/) [![PyPI - License](https://img.shields.io/pypi/l/guppy3)](https://github.com/zhuyifei1999/guppy3/blob/master/LICENSE) [![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](https://github.com/zhuyifei1999/guppy3/issues)\n\nA Python Programming Environment \u0026 Heap analysis toolset.\n\nThis package contains the following subpackages:\n* etc - Support modules. Contains especially the Glue protocol module.\n* gsl - The Guppy Specification Language implementation. This can be used\n  to create documents and tests from a common source.\n* heapy - The heap analysis toolset. It can be used to find information about\n  the objects in the heap and display the information in various ways.\n* sets - Bitsets and 'nodesets' implemented in C.\n\nGuppy 3 is a fork of Guppy-PE, created by Sverker Nilsson for Python 2.\n\n## Requirements\n\nYou should have Python 3.10, 3.11, 3.12, 3.13, or 3.14. This package is CPython\nonly; PyPy and other Python implementations are not supported. Python 2 support\ncan be obtained from [guppy-pe](http://guppy-pe.sourceforge.net/) by\nSverker Nilsson, from which this package is forked.\n\nTo use the graphical browser, Tkinter is needed.\n\nFree-threaded CPython is not supported, due to the excessive complexity and\noverhead to lock and unlock every object in the interpreter, including objects\nthat are CPython implementation details. (Maybe `_PyEval_EnableGILTransient`\ncould be a solution to this problem, but it is currently not exposed.)\n\n## Installation\n\nInstall with pip by:\n\n```\npip install guppy3\n```\n\nInstall with conda by:\n```\nconda install -c conda-forge guppy3\n```\n\n## Usage\n\nThe following example shows\n\n1. How to create the session context: `h=hpy()`\n2. How to show the reachable objects in the heap: `h.heap()`\n4. How to show the shortest paths from the root to the single largest object: `h.heap().byid[0].sp`\n3. How to create and show a set of objects: `h.iso(1,[],{})`\n\n```python\n\u003e\u003e\u003e from guppy import hpy; h=hpy()\n\u003e\u003e\u003e h.heap()\nPartition of a set of 30976 objects. Total size = 3544220 bytes.\n Index  Count   %     Size   % Cumulative  % Kind (class / dict of class)\n     0   8292  27   739022  21    739022  21 str\n     1   7834  25   625624  18   1364646  39 tuple\n     2   2079   7   300624   8   1665270  47 types.CodeType\n     3    400   1   297088   8   1962358  55 type\n     4   4168  13   279278   8   2241636  63 bytes\n     5   1869   6   269136   8   2510772  71 function\n     6    400   1   228464   6   2739236  77 dict of type\n     7     79   0   139704   4   2878940  81 dict of module\n     8   1061   3    93368   3   2972308  84 types.WrapperDescriptorType\n     9    172   1    81712   2   3054020  86 dict (no owner)\n\u003c89 more rows. Type e.g. '_.more' to view.\u003e\n\u003e\u003e\u003e h.heap().byid[0].sp\n 0: h.Root.i0_modules['os'].__dict__\n\u003e\u003e\u003e h.iso(1,[],{})\nPartition of a set of 3 objects. Total size = 348 bytes.\n Index  Count   %     Size   % Cumulative  % Kind (class / dict of class)\n     0      1  33      248  71       248  71 dict (no owner)\n     1      1  33       72  21       320  92 list\n     2      1  33       28   8       348 100 int\n\u003e\u003e\u003e\n```\n\nPeople have written awesome posts on how to use this toolset, including:\n* [How to use guppy/heapy for tracking down memory usage](https://smira.ru/wp-content/uploads/2011/08/heapy.html)\n* [Debugging Django memory leak with TrackRefs and Guppy](https://opensourcehacker.com/2008/03/07/debugging-django-memory-leak-with-trackrefs-and-guppy/)\n* [Diagnosing Memory \"Leaks\" in Python](https://chase-seibert.github.io/blog/2013/08/03/diagnosing-memory-leaks-python.html)\n* [Digging into python memory issues in ckan with heapy](https://joetsoi.github.io/debugging-python-ckan-memory-issues/)\n* [Optimizing memory usage in Python: a case study](https://web.archive.org/web/20230614181724/https://guillaume.segu.in/blog/code/487/optimizing-memory-usage-in-python-a-case-study/)\n* [Memory profiling in python](https://quantlane.com/blog/python-memory-profiling/)\n* [guppy/heapy - Profile Memory Usage in Python](https://coderzcolumn.com/tutorials/python/guppy-heapy-profile-memory-usage-in-python)\n\nFormal and API documentation are [also available](https://zhuyifei1999.github.io/guppy3/).\n\n## Contributing\n\nIssues and pull requests are welcome. You may also ask for help on using this\ntoolset; however, in such cases, we will only provide guidance, and not profile\nyour code for you.\n\nPlease make sure to update tests as appropriate.\n\n### Testing\n\nTo test if the heapy build and installation was ok, you can do:\n\n```python\n\u003e\u003e\u003e from guppy import hpy\n\u003e\u003e\u003e hpy().test()\nTesting sets\nTest #0\nTest #1\nTest #2\n...\n```\n\nThere will be several more tests. Some tests may take a while.\n\n## License\n\nCopyright (C) 2005-2013 Sverker Nilsson, S. Nilsson Computer System AB  \nCopyright (C) 2019-2021 YiFei Zhu  \nCopyright (C) 2021-2025 YiFei Zhu, Google LLC\n\nThe right is granted to copy, use, modify and redistribute this code\naccording to the rules in what is commonly referred to as an MIT\nlicense.\n\nThis is not an official Google product.\n\n*** USE AT YOUR OWN RISK AND BE AWARE THAT THIS IS AN EARLY RELEASE ***\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhuyifei1999%2Fguppy3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhuyifei1999%2Fguppy3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhuyifei1999%2Fguppy3/lists"}