A Python debugger that drops you into a live >>> prompt at breakpoints
Project description
Why seapie?
seapie comes with a user experience focused on discoverability: helpful error messages and built-in help you can reach from anywhere
All debuggers let you step. seapie lets Python expressions walk without magic syntax: ”stop when myfunc returns None, and call stack contains myhelper”
>>> !walk (_event_ == "return") and (_return_ is None) and ("myhelper" in _callstack_)
>>>Checking a variable is print(myvar) changing it is myvar = None. Debugging !commands work in the REPL and inspecting state is just python:
>>> _magic_
{'_line_': 8,
'_source_': ' return round(total_with_tax, 2)',
'_path_': '/home/hirsimak/seapie/test/demo.py',
'_return_': 35.64,
'_exception_': None,
'_event_': 'return',
'_callstack_': ['<module>', 'checkout']}
>>>
Hands on example
print("script says hello!")
import seapie; seapie.breakpoint() # execution pauses here, you get >>>
do_stuff(myvariable)
user@system:~/$ python myscript.py
script says hello!
🔗 Attaching seapie
seapie 4.0.0 (Python 3.13.3) [GCC 13.3.0] on linux
Type "!help" for seapie help
>>>
seapie.breakpoint() gives you >>>. Try it out
>>> print(locals())
{'x': 1, 'myvariable': None}
>>>
>>> myvariable = x
>>>
>>> _magic_.keys()
dict_keys(['_line_', '_source_', '_path_', '_return_', '_exception_', '_event_', '_callstack_'])
>>>
>>> _line_, _source_
(18, ' while True:')
>>>
>>> !bad-command
💀 Unknown command !bad-command
⚡ !command quicklist (example: >>> !location)
!(h)elp Show help
!(l)ocation Show source code around currently executing line
!(t)raceback Show callstack with current frame highlighted
!(f)rame Move up and down in callstack
!(k)eep Constantly show any Python expression at the top of the terminal
!(s)tep Step through code execution
!(e)vent Step until a specific event type
!(u)ntil Step until a target like linenumber or file
... ( cut for brevity in readme ) ...
>>>
Eventually, you’ll want time to move again
Seapie doesn’t lock you into the prompt - you can step forward, jump around, or
resume normal execution whenever you feel done exploring. If you’re ever curious
what’s possible, !help is always there, inside the shell.
(For the curious: a snapshot of the built-in help lives in help_dump.txt.)
Misc / Notes
Click to expand
Origin of the name
seapie is short for 'Scope Escaping Arbitrary Python Injection Executor'.
Licensing
If you need license other than Unlicense, contact me ɯoɔ˙lᴉɐɯƃ (ʇɐ) snʞɹɐɯ˙ᴉʞɐɯᴉsɹᴉɥ.
Editable install
seapie$ pip install -e .
Build & publish
Remember: increment __version__ in __init__.pyRemember: .pypirc file is needed.seapie$ python -m build --wheelseapie$ rm -rf build/ && rm -rf src/seapie.egg-info/seapie$ python -m twine check dist/*seapie$ python -m twine upload dist/*seapie$ rm -rf dist/
Known limitations
- Seapie is essentially singleton; only one thread can be debugged at a time.
- Remote debugging support could be added in the future. Python 3.14 looks promising.
Why not pdb?
Overall, pdb is ok but it felt rough for the novice I once was. pdb asks you to learn a small debugger language on top of Python and interaction with your code requires a separate 'mode'. In my opinion the correct specification for debugger user experience is that 'it works like i imagine it should work' and seapie tries to achieve that.
How to re-record the demo gif
- add
export PS1='$ 'to bashrc, comment out spam fromneofetchand such - resize terminal to about 81x15 characters. Check with
stty size. $ cd seapie/test$ clear$ asciinema rec --quiet demo.cast$ batcat buggy.py$ python buggy.py$ print(_source_)$ items$ items.remove("bad input value")$ items$ !continue- separate terminal:
$ pkill -f asciinema - back in first terminal: ctrl+D
$ asciinema play demo.cast$ asciinema-agg demo.cast demo.gif --font-family "DejaVu Sans Mono" --font-size 20
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seapie-4.0.1-py3-none-any.whl.
File metadata
- Download URL: seapie-4.0.1-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b90372becb2893b6be4b6a50bec06551d09d36f3f5f479c4e213507e34494f20
|
|
| MD5 |
14d8f9b5c878a09fd5cd340f286ce1db
|
|
| BLAKE2b-256 |
87107743d4ed05486cc1eb969855c0813a8363a7dce284545717a25826df7921
|