{"id":18905492,"url":"https://github.com/utility-libraries/debuglib-py","last_synced_at":"2025-08-19T00:11:30.919Z","repository":{"id":209809532,"uuid":"725012086","full_name":"utility-libraries/debuglib-py","owner":"utility-libraries","description":"python debugger tool with easy integration into any program","archived":false,"fork":false,"pushed_at":"2023-12-15T13:56:57.000Z","size":81,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-27T22:26:49.273Z","etag":null,"topics":["debugger","debugging-tool","python3"],"latest_commit_sha":null,"homepage":"","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/utility-libraries.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2023-11-29T08:58:37.000Z","updated_at":"2024-03-10T14:34:28.000Z","dependencies_parsed_at":"2023-12-01T10:23:54.401Z","dependency_job_id":"6c6e1ff4-c0c5-45b3-8145-f836e2148c65","html_url":"https://github.com/utility-libraries/debuglib-py","commit_stats":null,"previous_names":["utility-libraries/debuglib-py"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/utility-libraries/debuglib-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utility-libraries%2Fdebuglib-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utility-libraries%2Fdebuglib-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utility-libraries%2Fdebuglib-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utility-libraries%2Fdebuglib-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/utility-libraries","download_url":"https://codeload.github.com/utility-libraries/debuglib-py/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utility-libraries%2Fdebuglib-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271078587,"owners_count":24695473,"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-08-18T02:00:08.743Z","response_time":89,"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":["debugger","debugging-tool","python3"],"created_at":"2024-11-08T09:12:10.946Z","updated_at":"2025-08-19T00:11:30.866Z","avatar_url":"https://github.com/utility-libraries.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# debuglib-py\n\npython debugger tool with easy integration into any program\n\n\u003e To install the development version use:  \n\u003e `pip3 install git+https://github.com/utility-libraries/debuglib-py.git@dev#egg=debuglib[all]`\n\n## Installation\n\n[![PyPI - Version](https://img.shields.io/pypi/v/inifini)](https://pypi.org/project/inifini/)\n\n```bash\npip install debuglib\npip install debuglib[all]  # recommended\n```\n\n| extra               | description                                                    | client/server |\n|---------------------|----------------------------------------------------------------|---------------|\n| `debuglib[dev]`     | better exceptions printing                                     | client        |\n| `debuglib[orjson]`  | for faster packing/unpacking                                   | client/server |\n| `debuglib[cli]`     | required to run the CLI Debugger                               | server        |\n| `debuglib[all]`     | installs all of the ones above                                 | -             |\n\n[//]: # (| `debuglib[msgpack]` | for possibly faster transmission speed through smaller packets | client+server |)\n\n\u003e Note: It's recommended to install all for the best debugging experience\n\n### Why are there extras?\n\nThere are two reasons why some dependencies are marked as extra.\n\n#### 1. Separation between script/program and debugger\n\nSome dependencies are only used for the client/script and some are only used by the debugger (CLI).\nIn case you have different environments for both the dependencies work over extras\n\n#### 2. To not overload the environment\n\nThe more dependencies your project has the likelier it is that version-conflicts arise or that your project gets to big.\n`debuglib` tries to avoid that by requiring as few dependencies as possible but offers support for various packages for a better debugging experience.\n\n## Examples\n\n\u003e Note: there is no need for a server to run/exist.\n\u003e That way you don't have to change anything when going into production\n\u003e but would still have the option to monitor when errors occur.\n\n### 1: logging\n\n`code.py`\n```python\nimport logging\nfrom debuglib.logging import BlockingDebugHandler\n\nlogging.basicConfig(\n    level=logging.DEBUG,\n    handlers=[BlockingDebugHandler()],\n    # the following is also possible for tiny performance boost\n    # handlers=[logging.NullHandler() if prod else BlockingDebugHandler()],\n)\n\nlogging.info(\"Hello World\")\ntry:\n    num = \"Hi\"\n    print(int(num))\nexcept ValueError as error:\n    logging.error(\"failed to convert to integer\", exc_info=error)\n```\n\n```bash\n$ debuglib listen  # and start code.py in another terminal\nNew Connection from 127.0.0.1 (localhost)\n23:48:42.183558 | 127.0.0.1 | INFO | Hello World\n23:48:42.184598 | 127.0.0.1 | ERROR | failed to convert to integer\n--------------------------------------------------------------------------------\n  File \"/home/\u003cuser\u003e/code.py\", line 12, in \u003cmodule\u003e\n    print(int(num))\n              └ 'Hi'\n\nValueError: invalid literal for int() with base 10: 'Hi'\n================================================================================\nConnection closed from 127.0.0.1 (localhost)\n```\n\n### 2: function monitoring\n\n`code.py`\n```python\nfrom debuglib.decorator import Decorator as DebugDecorator\n# from debuglib.decorator import monitor  # shorthand if you only use it once\n\n# better performance than the single `monitor` decorator as everything \n# registered with debugger.monitor() shares the same connection\ndebugger = DebugDecorator()\n\n@debugger.monitor()\ndef my_function(name: str = \"World\"):\n    print(f\"Hello {name}\")\n\nmy_function()\nmy_function(\"debuglib\")\nmy_function(name=\"debuglib\")\n```\n\n```bash\n$ debuglib listen  # and start code.py in another terminal\nListening on localhost:35353\nNew Connection from 127.0.0.1:43998 (localhost)\n15:09:23.947665 | 127.0.0.1:43998 | INF | __main__.my_function() returned None after 6μs+803ns\n15:09:23.947693 | 127.0.0.1:43998 | INF | __main__.my_function('debuglib') returned None after 2μs+234ns\n15:09:23.947714 | 127.0.0.1:43998 | INF | __main__.my_function(name='debuglib') returned None after 2μs+405ns\nConnection closed from 127.0.0.1:43998 (localhost)\n```\n\n### crash-hook\n\nin case your program crashes, and you want to know the reason, you can install the custom excepthook\n\nwith the shortcut\n```python\nimport debuglib.hook.install  # noqa\n...\n```\n\nor the alternative/manual installation\n```python\nimport debuglib.hook\n...\ndebuglib.hook.hook()\n```\n\n```bash\n$ debuglib listen  # and start code.py in another terminal\nNew Connection from 127.0.0.1:41302 (localhost)\n15:09:23.528303 | 127.0.0.1:41302 | ERR | sys.excepthook\n  File \"/home/\u003cuser\u003e/script.py\", line 6, in \u003cmodule\u003e\n    raise RuntimeError(\"testing error\")\n\nRuntimeError: testing error\n--------------------------------------------------------------------------------\nConnection closed from 127.0.0.1:41302 (localhost)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futility-libraries%2Fdebuglib-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Futility-libraries%2Fdebuglib-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futility-libraries%2Fdebuglib-py/lists"}