{"id":13936159,"url":"https://github.com/DIYer22/boxx","last_synced_at":"2025-07-19T21:31:54.419Z","repository":{"id":57416227,"uuid":"112070868","full_name":"DIYer22/boxx","owner":"DIYer22","description":"Tool-box for efficient build and debug in Python. Especially for Scientific Computing and Computer Vision.","archived":false,"fork":false,"pushed_at":"2025-05-09T07:40:08.000Z","size":6389,"stargazers_count":512,"open_issues_count":2,"forks_count":40,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-07-11T05:54:26.002Z","etag":null,"topics":["awesome-python","computer-vision","debug","debugging","deep-learning","hack","pytorch","pytorch-debug","scientific-computing","toolbox"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DIYer22.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2017-11-26T09:35:12.000Z","updated_at":"2025-07-03T16:04:09.000Z","dependencies_parsed_at":"2023-01-23T10:56:32.101Z","dependency_job_id":"56dd97a6-4e04-4d9b-83fc-ab3a6ec6b8b4","html_url":"https://github.com/DIYer22/boxx","commit_stats":{"total_commits":280,"total_committers":3,"mean_commits":93.33333333333333,"dds":"0.025000000000000022","last_synced_commit":"c91125ab4da6ac9c143952c82f310b6dc854a60e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DIYer22/boxx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fboxx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fboxx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fboxx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fboxx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DIYer22","download_url":"https://codeload.github.com/DIYer22/boxx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fboxx/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264926332,"owners_count":23684320,"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":["awesome-python","computer-vision","debug","debugging","deep-learning","hack","pytorch","pytorch-debug","scientific-computing","toolbox"],"created_at":"2024-08-07T23:02:25.486Z","updated_at":"2025-07-19T21:31:49.380Z","avatar_url":"https://github.com/DIYer22.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"**Language :** [![English](https://jaywcjlove.github.io/sb/lang/english.svg)](https://github.com/DIYer22/boxx) [![Chinese](https://jaywcjlove.github.io/sb/lang/chinese.svg)](./README_zh_cn.md)\n  \n\u003cbr\u003e\n\u003ch1 align=\"center\"\u003eBox-X\u003c/h1\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n  \u003cstrong\u003eHack Python and Vision\u003c/strong\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  A Tool-box for Efficient Build and Debug in Python. Especially for \u003cstrong\u003eScientific Computing\u003c/strong\u003e and \u003cstrong\u003eComputer Vision\u003c/strong\u003e.\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003c!-- Build Status --\u003e\n  \u003ca href=\"https://travis-ci.org/DIYer22/boxx\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/build-passing-brightgreen.svg\" alt=\"build\"\u003e\n  \u003c/a\u003e\n  \n  \u003c!-- pyversions --\u003e\n  \u003ca href=\"https://pypi.python.org/pypi/boxx\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/boxx.svg\" alt=\"pyversions\"\u003e\n  \u003c/a\u003e\n  \u003c!-- platform --\u003e\n  \u003ca href=\"\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/platform-linux%20%7C%20osx%20%7C%20win-blue.svg\" alt=\"platform\"\u003e\n  \u003c/a\u003e\n  \u003c!-- License --\u003e\n  \u003c!--\u003ca href=\"https://www.github.com/DIYer22/boxx\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/l/boxx.svg\" alt=\"LICENSE\"\u003e\n  \u003c/a\u003e--\u003e\n  \u003c!-- Version --\u003e\n  \u003ca href=\"https://pypi.python.org/pypi/boxx\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/boxx.svg\" alt=\"PyPI\"\u003e\n  \u003c/a\u003e\n  \u003c!-- Binder --\u003e\n  \u003ca href=\"https://mybinder.org/v2/gh/DIYer22/boxx-ipynb/master?filepath=tutorial_for_boxx.ipynb\"\u003e\n    \u003cimg src=\"https://mybinder.org/badge.svg\" alt=\"Binder\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n\n ### [Introduce](#1-introduce) | [Install](#2-install) | [Tutorial](#3-tutorial) | [Examples](#4-examples) | [Acknowledgments](#5-acknowledgments)\n\u003c/div\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n  \u003csub\u003eCode with \u003cspan style=\"color:red\"\u003e❤︎\u003c/span\u003e by\n  \u003ca href=\"https://github.com/DIYer22\"\u003eDIYer22\u003c/a\u003e and\n  \u003ca href=\"https://github.com/DIYer22/boxx/graphs/contributors\"\u003e\n    contributors\n  \u003c/a\u003e\n  \u003c/sub\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\n---\n## 1. Introduce\n\n**`Box-X`** is a Tool-box for Efficient Build and Debug in Python.   \n\nEspecially for **Scientific Computing** and **Computer Vision**. \n\nSo, all Tools are divided into 2 parts by wether the tool is general used:    \n * **General Python Tool**: Tools could be used anywhere in Python\n\n * **Scientific Computing and Computer Vision Tool**: Those tools are useful in Scientific Computing and Computer Vision field\n \n\nP.S. **`boxx`** supports both **`Python 2/3`** on **`Linux | macOS | Windows`** with **`CPython | IPython | Spyder | Notebook`** environment.\n\n\n\n\n\n## 2. Install\n\n```\npip install boxx\n```\n\u003c!--\n#### Via pip\n#### From source\n```bash\ngit clone https://github.com/DIYer22/boxx\ncd boxx/\npython setup.py install\n```\n#### If no git\n```\npip install boxx -U\n```\n\n💡 **Note:** \n * Recommended to install via git or source because PyPI mirrors may has a big delay.\n * Please ensure `boxx`'s version \u003e `0.9.1`. Otherwise, please install from source.\n\n--\u003e\n\n## 3. Tutorial\n\n**`Box-X`**'s Tutorial is a Jupyter Notebook file \n\nThere are 3 methods to run or view this Notebook file\n\n#### Method 1: Executable Interactive Online Notebook\nWe use [Binder](https://mybinder.org) to run Tutorial Notebook in  an executable interactive online jupyer environment.    \nThat's mean you can **run code in notebook rightnow** in your browser without download or install anything.    \n* [**=\u003e Executable Interactive Online Tutorial**](https://mybinder.org/v2/gh/DIYer22/boxx-ipynb/master?filepath=tutorial_for_boxx.ipynb)\n\n#### Method 2: Download and Run at Local\n\n```bash\ngit clone https://github.com/DIYer22/boxx\ncd boxx/\npython setup.py install\njupyter notebook\n```\nThen open `./tutorial_for_boxx.ipynb` in notebook.\n\n#### Method 3: Static Noetbook\n Just view the Tutorial Notebook.\n* [**=\u003e Static Tutorial**](https://nbviewer.jupyter.org/github/DIYer22/boxx-ipynb/blob/master/tutorial_for_boxx.ipynb)\n\n\n## 4. Examples\n\nExamples are divided into 2 parts too.   \n\n**General Python Tool** on left, **Scientific Computing and Computer Vision Tool** on right.\n\n💡 **Note:** \n * *Click the image will see more clearer image, and if image is GIF, GIF will be replayed*\n * *The following content is layout of desktop browser, if you are viewing through a mobile browser, it is recommended to visit [**=\u003e Static Tutorial**](https://nbviewer.jupyter.org/github/DIYer22/boxx-ipynb/blob/master/tutorial_for_boxx.ipynb)*\n\n\u003ctable  style=\"\"\u003e\n  \u003ctr\u003e\n    \u003ctd valign=\"top\" width=\"50%\"\u003e\n    \n  ### General Python Tool \n  \u003chr\u003e\u003c/hr\u003e\n        \n  #### ▶  `p/x` is better way to `print(x)`    \n  `p/x` will `print(x)` and return `x`\n  [![click to restart GIF and see more clearer GIF](./other/img/p.png)](./other/img/p.png)     \n  💡 **Note:** `p/x` is easy to print value in expression.\n        \u003chr\u003e\u003c/hr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n        \n  #### ▶ Use `g.name = x` or `g.name/x` to transport variable to Python interactive console\n  [![click to restart GIF and see more clearer GIF](./other/gif/g.gif) ](./other/gif/g.gif)    \n  💡 **Note:** \n  * `gg` is the meaning of \"to Global and log\", has same usage as `g`, but `gg` will print the transported variable. \n  *  if variable name exists in console before, the variable's value will be covered by new value.\n        \u003chr\u003e\u003c/hr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n        \n  #### ▶ `g()` to transport all vars that in the function to Python interactive console\n  [![click to restart GIF and see more clearer GIF](./other/gif/g_call.gif) ](./other/gif/g_call.gif)    \n  💡 **Note:** `g()` is a useful tool for debug. `import boxx.g` is convenient way to use `g()` instead of `from boxx import g;g()`(`import boxx.gg` is avaliable too)\n        \u003chr\u003e\u003c/hr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n        \n  #### ▶ `with p`, `with g`, `with gg` are mulit variables version of `p`, `g`, `gg` that work under \"with statement\"\n  Only act on interested variables which is under \"with statement\"\n  [![click to restart GIF and see more clearer GIF](./other/gif/w.gif) ](./other/gif/w.gif)    \n  💡 **Note:** \n  * `with p`, `with g`, `with gg` only act on assignment variables under \"with statement\". \n  * If variable's name exists in `locals()` before and `id(variable)` not change ,variable may not be detected \n        \u003chr\u003e\u003c/hr\u003e\n        \n    \u003c/td\u003e\n    \u003ctd valign=\"top\"\u003e\n    \n  ### Scientific Computing and Computer Vision\n\n  Useful tools in **Scientific Computing** and **Computer Vision** field. All tools support array-like types, include `numpy`, `torch.tensor`, `mxnet.ndarray`, `PIL.Image` .etc     \n  \n  💡 **Note:** If you are using `ssh` to execute code on a remote server, it is recommended that `ssh` plus `-X` make visualized `plt` charts can be transferred to the local and display, like `ssh -x user@host`.\n        \u003chr\u003e\u003c/hr\u003e\n\n  #### ▶ `loga` to visualization matrix and tensor   \n  `loga` is short of \"log array\", `loga` will show many attributes of array-like object.\n  [![click to restart GIF and see more clearer GIF](./other/gif/loga.gif)](./other/gif/loga.gif)     \n  💡 **Note:** `loga` analysis array-like object by it's shape, max, min, mean, and distribute. Support `numpy`, `torch.tensor`, `mxnet.ndarray`, `PIL.Image` .etc \n        \u003chr\u003e\u003c/hr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n\n  #### ▶ `show` is easy to do `imshow`, even images are in complex struct\n  `show` could find every image in complex struct and imshow they.\n  [![click to restart GIF and see more clearer GIF](./other/gif/show.gif)](./other/gif/show.gif)    \n  💡 **Note:** if args inculde function(like `torgb`). those functions will process all numpys befor imshow.\n        \u003chr\u003e\u003c/hr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n        \u003cbr\u003e\u003cbr\u003e\n\n  #### ▶ `tree` for visualization complex struct\n  like `tree` command in shell, `boxx.tree` could visualization any struct in tree struct view.\n  [![click to restart GIF and see more clearer GIF](./other/gif/tree.gif)](./other/gif/tree.gif)    \n  💡 **Note:** `tree` support types include `list`, `tuple`, `dict`, `numpy`, `torch.tensor/Dataset/DataLoader`, `mxnet.ndarray`, `PIL.Image`.etc\n        \u003chr\u003e\u003c/hr\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e \n\n\n\u003ctable  style=\"\"\u003e\n  \u003ctr\u003e\n    \u003ctd valign=\"top\" width=\"50%\"\u003e\n    \n  #### ▶ `boxx` debug tool matrix\n| How many vars \\ Operation | print | transport | print \u0026 transport |\n| :---- | :---- | :---- | :---- |\n| Single variable | `p/x` | `g.name/x` | `gg.name/x`|\n|Multi variables | `with p:` | `with g:` | `with gg:` |\n|All `locals()`| `p()` | `g()` | `gg()` |\n|All `locals()`\\_2 | `import boxx.p` | `import boxx.g` | `import boxx.gg` |    \n\n  💡 **Note:**   \n  * **transport** mean \"transport variable to Python interactive console\"\n  * **All `locals()`** mean operation will act on all variables in the function or module\n  * **All `locals()`\\_2 :** when `boxx` are not imported, `import boxx.{operation}` is a convenient way to execution operation \n        \u003cbr\u003e\u003cbr\u003e\n        \u003chr\u003e\u003c/hr\u003e\n        \n  ####  ▶ `what` to know \"What's this?\"\n  [![click to restart GIF and see more clearer GIF](./other/img/what.png) ](./other/img/what.png)    \n  💡 **Note:** `what(x)` will show \"what is `x`?\" by pretty print it's **Self**, **Document**, **Father Classes**, **Inner Struct** and **Attributes**. It is a supplement of `help(x)`.\n        \u003cbr\u003e\u003cbr\u003e\n        \u003chr\u003e\u003c/hr\u003e\n        \n  #### ▶ `timeit` is convenient timing tool \n  [![click to restart GIF and see more clearer GIF](./other/img/timeit.png) ](./other/img/timeit.png)    \n  💡 **Note:** `timeit` will timing code block under \"with statement\" and print spend time in blue color.\n        \u003cbr\u003e\u003cbr\u003e\n        \u003chr\u003e\u003c/hr\u003e\n        \n  #### ▶ `mapmp` is Multi Process version of `map`\n  `mapmp` is the meaning of \"MAP for Multi Process\", has the same usage as `map` but faster.    \n  [![click to restart GIF and see more clearer GIF](./other/gif/mapmp.gif) ](./other/gif/mapmp.gif)    \n  💡 **Note:** \n  * **pool** parameter in `mapmp` mean the number of Process, the default is the number of CPUs in the system.\n  * In multi process programs, display processing progress is troublesome. **printfreq** parameter in `mapmp` can handle this problem.\n  * Like `map`, `mapmp` support muliti args to as input to function, like `mapmp(add, list_1, list_2)`.\n  *  * It's better to run multi process under `__name__ == '__main__'` environment.\n  * If you speed up the `numpy` program, note that in the MKL version of `numpy`, multiple processes will be slower. You can run `boxx.testNumpyMultiprocessing()` to test how friendly the current environment is to a multi-process `numpy`. \n        \u003cbr\u003e\u003cbr\u003e\n        \u003chr\u003e\u003c/hr\u003e\n        \n  #### ▶ `heatmap` to show the time heat map of your code\n  [![click to restart GIF and see more clearer GIF](./other/img/heatmap.png) ](./other/img/heatmap.png)    \n  💡 **Note:** `heatmap` also support python code string.\n        \u003cbr\u003e\u003cbr\u003e\n        \u003chr\u003e\u003c/hr\u003e\n        \n  #### ▶ `performance` could statistic function calls and visualize code performance   \n  [![click to restart GIF and see more clearer GIF](./other/gif/performance.gif) ](./other/gif/performance.gif)    \n  💡 **Note:** `performance` also support python code string.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\n\n\n\n\n\n\n\n\n\n---\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## 5. Acknowledgments\n * Thanks to Xiaodong Xu, Guodong Wu, Haoqiang Fan, Pengfei Xiong for their suggestions\n * I develop **`boxx`** in [Spyder IDE](https://github.com/spyder-ide/spyder), [Spyder](https://github.com/spyder-ide/spyder) is a awesome Scientific Python Development Environment with Powerful [**Qt-IPython**](https://github.com/jupyter/qtconsole)\n * `performance` is supported by [SnakeViz](https://jiffyclub.github.io/snakeviz/)\n * `heatmap` is supported by [csurfer/pyheat](https://github.com/csurfer/pyheat)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDIYer22%2Fboxx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDIYer22%2Fboxx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDIYer22%2Fboxx/lists"}