{"id":13477226,"url":"https://github.com/parrt/lolviz","last_synced_at":"2025-10-24T11:31:47.533Z","repository":{"id":37550074,"uuid":"101499621","full_name":"parrt/lolviz","owner":"parrt","description":"A simple Python data-structure visualization tool for lists of lists, lists, dictionaries; primarily for use in Jupyter notebooks / presentations","archived":false,"fork":false,"pushed_at":"2022-01-12T03:10:45.000Z","size":3031,"stargazers_count":836,"open_issues_count":5,"forks_count":48,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-08-25T09:44:19.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parrt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-26T16:52:57.000Z","updated_at":"2025-07-18T12:32:25.000Z","dependencies_parsed_at":"2022-08-08T20:31:09.721Z","dependency_job_id":null,"html_url":"https://github.com/parrt/lolviz","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/parrt/lolviz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parrt%2Flolviz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parrt%2Flolviz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parrt%2Flolviz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parrt%2Flolviz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parrt","download_url":"https://codeload.github.com/parrt/lolviz/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parrt%2Flolviz/sbom","scorecard":{"id":720858,"data":{"date":"2025-08-11","repo":{"name":"github.com/parrt/lolviz","commit":"301779d39934937795b71ad5d9d62d8a45f7bee1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T11:19:18.239Z","repository_id":37550074,"created_at":"2025-08-22T11:19:18.239Z","updated_at":"2025-08-22T11:19:18.239Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280787585,"owners_count":26391140,"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","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-07-31T16:01:39.650Z","updated_at":"2025-10-24T11:31:47.505Z","avatar_url":"https://github.com/parrt.png","language":"Jupyter Notebook","readme":"# lolviz\n\nBy \u003ca href=\"http://explained.ai/\"\u003eTerence Parr\u003c/a\u003e. See [Explained.ai](http://explained.ai) for more stuff.\n\nA very nice looking [javascript lolviz port with improvements](https://github.com/websemantics/lolviz.js) by [Adnan M.Sagar](https://github.com/websemantics).\n\nA simple Python data-structure visualization tool that started out as a **L**ist **O**f **L**ists (lol) visualizer but now handles arbitrary object graphs, including function call stacks! lolviz tries to look out for and format nicely common data structures such as lists, dictionaries, linked lists, and binary trees. This package is primarily for use in teaching and presentations with Jupyter notebooks, but could also be used for debugging data structures. Useful for devoting machine learning data structures, such as decision trees, as well.\n\nIt seems that I'm always trying to describe how data is laid out in memory to students. There are really great data structure visualization tools but I wanted something I could use directly via Python in Jupyter notebooks. \n\nThe look and idea was inspired by the awesome [Python tutor](http://www.pythontutor.com). The graphviz/dot tool does all of the heavy lifting underneath for layout; my contribution is primarily making graphviz display objects in a nice way.\n\n## Functionality\n\nThere are currently a number of functions of interest that return `graphviz.files.Source` objects:\n\n* `listviz()`: Horizontal list visualization\u003cbr\u003e\u003cimg src=images/list2.png width=320\u003e\n* `lolviz()`: List of lists visualization with the first list vertical and the nested lists horizontal.\u003cbr\u003e\u003cimg src=images/lol2.png width=460\u003e\n* `treeviz()`: Binary trees visualized top-down ala computer science.\u003cbr\u003e\u003cimg src=images/tree.png width=190\u003e\n* `objviz()`: Generic object graph visualization that knows how to find lists of lists (like `lolviz()`) and linked lists. Trees are also displayed reasonably, but with left to right orientation instead of top-down (a limitation of graphviz). Here is an example linked list and dictionary:\u003cbr\u003e\u003cimg src=images/llist2.png width=280\u003e\u003cbr\u003e\u003cimg src=images/dict.png width=60\u003e\n* `callsviz()`: Visualize the call stack and anything pointed to by globals, locals, or parameters. You can limit the variables displayed by passing in a list of `varnames` as an argument.\u003cbr\u003e\u003cimg src=images/callstack.png width=240\u003e\n* `callviz()`: Same as `callsviz()` but displays only the current function's frame or you can pass in a Python stack frame object to display.\n* `matrixviz(data)`: Display numpy `ndarray`; only 1D and 2D at moment.\u003cbr\u003e\u003cimg src=\"images/numpy.png\" width=\"350\"\u003e\n* `strviz()`: Show a string like an array.\u003cbr\u003e\u003cimg src=images/string.png width=100\u003e\n\nGiven the return value in generic Python, simply call method `view()` on the returned object to display the visualization. From jupyter, call function `IPython.display.display()` with the returned object as an argument. Function arguments are in italics.\n\nCheck out the [examples](examples.ipynb).\n\n## Installation\n\nFirst you need graphviz (more specifically the `dot` executable). On a mac it's easy:\n\n```bash\n$ brew install graphviz\n```\n\nThen just install the `lolviz` Python package:\n\n```bash\n$ pip install lolviz\n```\n\nor upgrade to the latest version:\n\n\n```bash\n$ pip install -U lolviz\n```\n\n## Usage\n\nFrom within generic Python, you can get a window to pop up using the `view()` method:\n\n```python\nfrom lolviz import *\ndata = ['hi','mom',{3,4},{\"parrt\":\"user\"}]\ng = listviz(data)\nprint(g.source) # if you want to see the graphviz source\ng.view() # render and show graphviz.files.Source object\n```\n\n\u003cimg src=\"images/list.png\" width=200\u003e\n\nFrom within Jupyter notebooks you can avoid the `render()` call because Jupyter knows how to display `graphviz.files.Source` objects:\n\n\u003cimg src=images/jupyter.png width=620\u003e\n\nFor more examples that you can cut-and-paste, please see the jupyter notebook full of [examples](examples.ipynb).\n\n## Preferences\n\nThere are global preferences you can set that affect the display for long values:\n\n* `prefs.max_str_len` (Default 20). How many chars in a string representation of a value before we abbreviate with `...`. E.g.,:\u003cbr\u003e\u003cimg src=\"images/short-string.png\" width=160\u003e\n* `prefs.max_horiz_array_len` (Default 70) Lists can quickly become too wide and distort the visualization. This preference lets you set how long the combined string representations of the list values can get before we use a vertical representation of the list. E.g.,:\u003cbr\u003e\u003cimg src=\"images/tall-list.png\" width=130\u003e\n* `prefs.max_list_elems`. Horizontal and vertical lists and sets show maximum of 10 (default) elements.\n* `prefs.float_precision`. How many decimal places to show for floats (default is 5).\n\n## Implementation notes\n\nMostly notes for parrt to remember things.\n### Graphviz\n\n* Ugh. `shape=record` means html-labels can't use ports. warning!\n\n* warning: `\u003ctd\u003e` and `\u003c/td\u003e` must be on same line or row is super wide!\n    \n### Deploy\n\n```bash\n$ python setup.py sdist upload \n```\n\nOr to install locally\n\n```bash\n$ cd ~/github/lolviz\n$ pip install .\n```\n","funding_links":[],"categories":["Jupyter Notebook","Domain-Specific Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparrt%2Flolviz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparrt%2Flolviz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparrt%2Flolviz/lists"}