{ "info": { "author": "Liran Funaro", "author_email": "liran.funaro+objsize@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# objsize\n\nTraversal over Python's objects sub-tree and calculating\nthe total size of the sub-tree (deep size).\n\nThis module uses python internal GC implementation\nto traverse all decedent objects.\nIt ignores type objects (i.e., `isinstance(o, type)`)\nsuch as classes and modules, as they are common among all objects.\nIt is implemented without recursive calls for best performance.\n\n\n# Features\n\n- Calculate single/multiple object(s) deep size.\n- Exclude non exclusive objects.\n- Traverse single/multiple objects(s) sub tree.\n\n[Pympler](https://pythonhosted.org/Pympler/) also supports determening an object deep size via `pympler.asizeof()`.\nThere are two main differences between `objsize` and `pympler`.\n\n1. `objsize` has additional features:\n * Traversing the object sub-tree: iterating all of the object's descendants one by one.\n * Excluding non-exclusive objects. That is, objects that are also referenced from somewhere else in the program. This is true for calculating the object's deep size and for traversing its descendants.\n2. `objsize` has a simple and robust implementation with significantly fewer lines of code, compared to `pympler`.\n The Pympler implementation uses recursion, and thus have to use a maximal depth argument to avoid reaching Python's max depth.\n `objsize`, however, uses BFS which is more efficient and simple to follow.\n Moreover, the Pympler implementation carefully takes care of any object type.\n `objsize` archives the same goal with a simple and generic implementation, which has fewer lines of code.\n\n\n# Install\n\n```bash\npip install objsize\n```\n\n\n# Basic Usage\n\nCalculate an object size including all its members.\n\n```python\n>>> import objsize\n>>> objsize.get_deep_size(dict(arg1='hello', arg2='world'))\n348\n```\n\nIt is possible to calculate the deep size of multiple objects by passing multiple arguments:\n\n```python\n>>> objsize.get_deep_size(['hello', 'world'], dict(arg1='hello', arg2='world'), {'hello', 'world'})\n652\n```\n\n# Complex Data\n\n`objsize` can calculate the size of an object's entire sub-tree\nregardless of the type of objects in it, and its depth.\n\nHere is a complex data structure, for example, that include a self reference:\n\n```python\nmy_data = (list(range(3)), list(range(3,6)))\n\nclass MyClass:\n def __init__(self, x, y):\n self.x = x\n self.y = y\n self.d = {'x': x, 'y': y, 'self': self}\n\n def __repr__(self):\n return \"MyClass\"\n\nmy_obj = MyClass(*my_data)\n```\n\nWe can calculate `my_obj` deep size, including its stored data.\n\n```python\n>>> objsize.get_deep_size(my_obj)\n796\n```\n\nWe might want to ignore non exclusive objects such as the ones stored in `my_data`.\n\n```python\n>>> objsize.get_exclusive_deep_size(my_obj)\n408\n```\n\n# Traversal\n\nA user can implement its own function over the entire sub tree\nusing the traversal method, which traverse all the objects in the sub tree.\n\n```python\n>>> for o in objsize.traverse_bfs(my_obj):\n... print(o)\n... \nMyClass\n{'x': [0, 1, 2], 'y': [3, 4, 5], 'd': {'x': [0, 1, 2], 'y': [3, 4, 5], 'self': MyClass}}\n[0, 1, 2]\n[3, 4, 5]\n{'x': [0, 1, 2], 'y': [3, 4, 5], 'self': MyClass}\n2\n1\n0\n5\n4\n3\n```\n\nSimilirarly to before, non exclusive objects can be ignored.\n\n```python\n>>> for o in objsize.traverse_exclusive_bfs(my_obj):\n... print(o)\n... \nMyClass\n{'x': [0, 1, 2], 'y': [3, 4, 5], 'd': {'x': [0, 1, 2], 'y': [3, 4, 5], 'self': MyClass}}\n{'x': [0, 1, 2], 'y': [3, 4, 5], 'self': MyClass}\n```\n\n# License\n[GPL](LICENSE.txt)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/liran-funaro/objsize", "keywords": "object-size recursive deep traversal object size debug deep-object-size", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "objsize", "package_url": "https://pypi.org/project/objsize/", "platform": "", "project_url": "https://pypi.org/project/objsize/", "project_urls": { "Homepage": "https://github.com/liran-funaro/objsize" }, "release_url": "https://pypi.org/project/objsize/0.3.2/", "requires_dist": null, "requires_python": "", "summary": "Traversal over Python's objects sub-tree and calculating the total size of the sub-tree (deep size).", "version": "0.3.2" }, "last_serial": 4878745, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "f7426b783da03cc676cbdcbacdc2151e", "sha256": "e262715c2a886c8c69e4648207893163c474c7d78d63079b7a0065393093ce5a" }, "downloads": -1, "filename": "objsize-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f7426b783da03cc676cbdcbacdc2151e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 2674, "upload_time": "2018-12-11T19:23:16", "url": "https://files.pythonhosted.org/packages/3f/f7/90d8a6364d72141eec35c807e88610529fffd15af8183427d4eb641b35b5/objsize-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5a3e02c542610789c9c41b2361450ff1", "sha256": "54c30e9675c33789784e6319ab0261160ec3ddc827a956dd7611e6ed3f4f2795" }, "downloads": -1, "filename": "objsize-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5a3e02c542610789c9c41b2361450ff1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15869, "upload_time": "2018-12-11T19:23:18", "url": "https://files.pythonhosted.org/packages/c6/be/b6caa55399d2a7c4f4edf70ea6c6379520fd85c3d6e1183008154acb0db3/objsize-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6062dccd9858f0a0df8f673ba3b43694", "sha256": "198284e1e8fbdca2c89b4b075eb5fe0f3a02e3e96cd0461d9831b45cabb65efd" }, "downloads": -1, "filename": "objsize-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6062dccd9858f0a0df8f673ba3b43694", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 2662, "upload_time": "2018-12-12T15:49:11", "url": "https://files.pythonhosted.org/packages/0a/1d/301d609994cc05163bfc6ecbbb55e92d105ffb68ffa79a857c757322d576/objsize-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d598e291a987e1f6d0dbbd07fca7aaa3", "sha256": "609d7f31b00177801265efb4d81acd47ca8cec4392e04a7c5cc96c10feb4fccb" }, "downloads": -1, "filename": "objsize-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d598e291a987e1f6d0dbbd07fca7aaa3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15860, "upload_time": "2018-12-12T15:49:12", "url": "https://files.pythonhosted.org/packages/7b/9f/842f78cddd47ccb6d42abffc1f102b7fdcb0ec7d61aee2b1bac5c165da03/objsize-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ebfcfc356e37ef727623cd1842240e4d", "sha256": "b0ae508c528e1f4a216917556db4973aa1e6c589fb30f9cb0f4986d01e398f24" }, "downloads": -1, "filename": "objsize-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ebfcfc356e37ef727623cd1842240e4d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3030, "upload_time": "2018-12-19T02:50:21", "url": "https://files.pythonhosted.org/packages/3b/a0/29cf81cad323635308eac36f73424a4c0d6555303c3e70c736b422fbd6ba/objsize-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "865fb1262f06866369dc5688bf510c09", "sha256": "ef9ca67fb75889edf2fecdadb3ef4799c37fcef0eb65095f177a6db6e20a449c" }, "downloads": -1, "filename": "objsize-0.2.0.tar.gz", "has_sig": false, "md5_digest": "865fb1262f06866369dc5688bf510c09", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16484, "upload_time": "2018-12-19T02:50:23", "url": "https://files.pythonhosted.org/packages/31/4f/4bc6b1de027a605e5af985d739c5c5f322375fef18d620a73e6e5fc6f790/objsize-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "1a7a9519cebe47ca8fd5d961507dca7c", "sha256": "fb373a614c9280a6cf6e691cd3ea3031d086ecc8f388462c9827e8bac207fd43" }, "downloads": -1, "filename": "objsize-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1a7a9519cebe47ca8fd5d961507dca7c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3083, "upload_time": "2018-12-19T03:02:41", "url": "https://files.pythonhosted.org/packages/65/8e/b120bd6df01a2c8c2abaf70df73400cc640010d79c02e5bd2533a17a17ab/objsize-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "adf0ad9230964739ff223a285bcfb2e7", "sha256": "7859bf1be122508c8cf4fabc1c2041ff7c87851e9502233ab3ba6930f0483bd2" }, "downloads": -1, "filename": "objsize-0.2.1.tar.gz", "has_sig": false, "md5_digest": "adf0ad9230964739ff223a285bcfb2e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16504, "upload_time": "2018-12-19T03:02:42", "url": "https://files.pythonhosted.org/packages/46/5d/08c506279a200ff1eef5e324dc3388e0382d074f28e90c16ca96b4994d3f/objsize-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "d9ad57175955f0e21343a84ca4e5daa6", "sha256": "c185fa29780771af5f97d01267e42a11c0edb2d41bf3627b203d113e33e7e060" }, "downloads": -1, "filename": "objsize-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d9ad57175955f0e21343a84ca4e5daa6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5326, "upload_time": "2018-12-19T15:12:34", "url": "https://files.pythonhosted.org/packages/16/ea/5d4a8b11fdd76de3a5368de2c3c7e4a7f6939d8e94459b04ddeb69e9f893/objsize-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3ce9219f122dde9e8c74c0a18a28b5fd", "sha256": "a0aca5db880cdfd3db870ed8ac582bfd37d7799fc1e2225b89267247bb8d8c3c" }, "downloads": -1, "filename": "objsize-0.3.0.tar.gz", "has_sig": false, "md5_digest": "3ce9219f122dde9e8c74c0a18a28b5fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18070, "upload_time": "2018-12-19T15:12:36", "url": "https://files.pythonhosted.org/packages/7d/a3/3cb5fa8862699fb0826d7cf6d461bfd7df737e45af9c639d0b4a99890f54/objsize-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "62d332f30caf543cb9625a6c984095bd", "sha256": "946ed42ff64ae8138019c21dc82a4b8090cf0f0efbea672556ab2881d38b3c23" }, "downloads": -1, "filename": "objsize-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "62d332f30caf543cb9625a6c984095bd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4200, "upload_time": "2018-12-20T12:29:29", "url": "https://files.pythonhosted.org/packages/37/60/d824cd0974a49826d675a8ab6128867e0f7997f96e601b1c1af013407114/objsize-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6bab19f6f32f85d068635c45a5b769ce", "sha256": "fb7e76ab7936a0aefe5cf1b9dfe3dd2b0d3f054fd35fff707804ebb3e34e5cc1" }, "downloads": -1, "filename": "objsize-0.3.1.tar.gz", "has_sig": false, "md5_digest": "6bab19f6f32f85d068635c45a5b769ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17766, "upload_time": "2018-12-20T12:29:31", "url": "https://files.pythonhosted.org/packages/2e/22/e3d8e3e7f807181ae79f96150588987d1c5ae932dec9a4b7c201af1f2762/objsize-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "57533067d39d49ba7a161fb2f79aaa88", "sha256": "5e4e6b46d331cdc64295599fd65191a5936bba002294413bae7f6968fb181e45" }, "downloads": -1, "filename": "objsize-0.3.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "57533067d39d49ba7a161fb2f79aaa88", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4626, "upload_time": "2019-02-28T11:08:50", "url": "https://files.pythonhosted.org/packages/a7/62/0fa389d0c77ca41c30e01539fb1abfd480ef38a310ca0908dbd3d218750a/objsize-0.3.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3f12752b1086067f3905772c92e8744c", "sha256": "9d7ce7b775d7d686fc2d1654d1cdec0ea09e22924c0d4cc935764b364531d44f" }, "downloads": -1, "filename": "objsize-0.3.2.tar.gz", "has_sig": false, "md5_digest": "3f12752b1086067f3905772c92e8744c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18203, "upload_time": "2019-02-28T11:09:07", "url": "https://files.pythonhosted.org/packages/70/b3/e46916a18a5dc17b013363f1ea9d3779e298e36bbbdb677c26eee4b3a417/objsize-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "57533067d39d49ba7a161fb2f79aaa88", "sha256": "5e4e6b46d331cdc64295599fd65191a5936bba002294413bae7f6968fb181e45" }, "downloads": -1, "filename": "objsize-0.3.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "57533067d39d49ba7a161fb2f79aaa88", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4626, "upload_time": "2019-02-28T11:08:50", "url": "https://files.pythonhosted.org/packages/a7/62/0fa389d0c77ca41c30e01539fb1abfd480ef38a310ca0908dbd3d218750a/objsize-0.3.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3f12752b1086067f3905772c92e8744c", "sha256": "9d7ce7b775d7d686fc2d1654d1cdec0ea09e22924c0d4cc935764b364531d44f" }, "downloads": -1, "filename": "objsize-0.3.2.tar.gz", "has_sig": false, "md5_digest": "3f12752b1086067f3905772c92e8744c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18203, "upload_time": "2019-02-28T11:09:07", "url": "https://files.pythonhosted.org/packages/70/b3/e46916a18a5dc17b013363f1ea9d3779e298e36bbbdb677c26eee4b3a417/objsize-0.3.2.tar.gz" } ] }