{"id":13648295,"url":"https://github.com/whittlbc/wat-py","last_synced_at":"2025-09-06T11:34:20.346Z","repository":{"id":62588319,"uuid":"132199791","full_name":"whittlbc/wat-py","owner":"whittlbc","description":"Simple interactive breakpoint library with with automatic variable injection.","archived":false,"fork":false,"pushed_at":"2018-09-15T19:34:01.000Z","size":9,"stargazers_count":61,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T02:41:15.517Z","etag":null,"topics":[],"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/whittlbc.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":"2018-05-05T00:00:48.000Z","updated_at":"2024-12-25T00:33:08.000Z","dependencies_parsed_at":"2022-11-03T22:41:36.459Z","dependency_job_id":null,"html_url":"https://github.com/whittlbc/wat-py","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whittlbc%2Fwat-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whittlbc%2Fwat-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whittlbc%2Fwat-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whittlbc%2Fwat-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whittlbc","download_url":"https://codeload.github.com/whittlbc/wat-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248705495,"owners_count":21148548,"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-02T01:04:07.260Z","updated_at":"2025-04-13T11:32:26.173Z","avatar_url":"https://github.com/whittlbc.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# wat\n\nSimple interactive breakpoint library with automatic variable injection, providing access to **both** local and global variables.\n\n**Better than** `print` because you can actually interact with your variables.\u003cbr\u003e\n**Better than** `code.interact` because you get both local and global variables.\u003cbr\u003e\n**Better than anything else** because it's short and sweet, has no dependencies, and works with both Python 2 \u0026 3.\u003cbr\u003e\n\n# Installation\n\n```\n$ pip install wat-py\n```\n\n# Quickstart\n\n```python\nfrom wat import wat\n\nwat() # set interactive breakpoint\n```\n\n# Usage\n\n### Set a breakpoint\n\nSetting an interactive breakpoint is as easy as calling `wat()` from whatever line you want.\n\nExample:\n```python\n# Example app.py file\nfrom wat import wat\nimport urllib\n\na = 1\nb = 2\n\n\ndef do_something():\n  a = 10\n  c = 3\n  wat()\n  # more code-sauce\n\n\nif __name__ == '__main__':\n  do_something()\n```\n\nRunning `app.py` will call the `do_something` function and pause code execution right after `c` is defined.\nAn interactive console will appear, giving you access to all vars (both local and global) that `do_something` would \notherwise have access to at the time of the breakpoint:\n\n```python\n$ python app.py\n(wat Interactive Console)\n\u003e\u003e\u003e a\n10                          # local var overwrites global var\n\u003e\u003e\u003e b\n2                           # global var\n\u003e\u003e\u003e c\n3                           # local var\n\u003e\u003e\u003e urllib\n\u003cmodule 'urllib' from ...\u003e  # imported module still available\n```\n\n### Leave interactive console \u0026 proceed with code execution\n\n`Ctrl+D`\n\n### Leave interactive console without executing any more code\n\n`exit()`\n\n# Reason\n\nThe built-in `code.interact` method Python provides requires you to pass in the specific variables you want to have \navailable in the interactive console, which gives you the option of passing in `locals()`, `globals()`, or manually \ncreating a dict with the combination of both local and global vars (which no one wants to do every single time they want to set a breakpoint). I got sick of writing `import code; code.interact(local=locals())` whenever I needed to set a \nbreakpoint, realizing I needed some global vars from the import statements at the top of my file, and then having to \nmanually re-import those global vars.\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhittlbc%2Fwat-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhittlbc%2Fwat-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhittlbc%2Fwat-py/lists"}