Surprised there isn't more innovation and new tools like this around python's interactive shell given it's one of the real strong points the language has.
If you never heard about it, scroll to the bottom to https://github.com/gruns/icecream#icecream-in-other-language...
Twenty years ago I wrote an object introspector for Zope ;)
Nowadays, I'm using devtools daily, and icecream and q occasionally. I'll give wat a try.
Given the cool nature of this project, I'm surprised they don't offer simply "import wat" with identical usage syntax. Thus inviting curious users to wat/wat in order to discover the trick...
try:
from wat import wat
except ImportError:
pass
to your $PYTHONSTARTUP file to avoid the cumbersome import.
Instead I just installed pry and became a rabid ruby fanboy, but this might get me to give it another go.
see inspection.py in the wat module.
it has this on line 2:
import inspect as std_inspect
> Load it on the fly by pasting this snippet to your Python interpreter
The idea of having a project's readme include a full copy of the project itself as base64'd compressed data is pretty ingenious!
especially for a project like this where you may not have had the foresight to preload it into the environment where you most need it
I mean the number of times I've bumped on json not being able to dump the content of an object is just infuriating given how flexible Python is.
I'm definitely giving this a whirl.
Please don't do this. Exec'ing arbitrary, obfuscated code you just copied from the internet directly in a running environment is such a bad idea it shouldn't even be suggested.
At the very lease please put huge warnings around this section to let people know that it is a horrendously bad idea and they do it at their own peril.
In a previous company I set things up so that when there's an uncaught exception it will automatically start a VSCode debug session and connect to it.
Here's the extension: https://github.com/Timmmm/autodebug/
Unfortunately the Python part of that is not open source but it was only a few lines of code - should be easy to recreate. That repo does contain a C library that does a similar thing.
You might just say "why not just run your program directly with the debugger?" and yeah that is better when you can do it, but I'm working with complicated silicon verification flows that are often several layers of Python and Make, followed by a simulator (e.g. Questa or VCS) that itself loads the library you want to debug. Very difficult to make debugging work through all those layers, but it's quite easy to write some code at the bottom of the stack that says to a debugger "I'm here, debug me!".
One thing I'd like to note, though, is that most engineers (at least around and including myself) would be triggered by the "Insta-load" example of executing base64 encoded (and thus obfuscated) code.
I'm also really appreciating the base64 exec hack. All my years in Python I never thought of or came across it until now. I'll totally be using it for some things :).
[0] https://github.com/gabrielcnr/python-ls [1] https://pypi.org/project/snoop/