Swanky Python: Bringing Lisp-Style Interactive Development to Python
Share this article
Swanky Python: Revolutionizing Development with Lisp-Style Interactivity
For decades, Lisp developers have leveraged powerful interactive environments like SLIME (Superior Lisp Interaction Mode for Emacs) to inspect, debug, and modify running applications without losing state. At EmacsConf 2025, developer Scott Zimmermann demonstrated how his project Swanky Python aims to bring this paradigm to the Python ecosystem—a significant leap for a language traditionally constrained by edit-run-restart cycles.
The SLIME Inspiration
Swanky Python directly emulates SLIME's architecture, creating a bridge between Emacs and a live Python process. Unlike standard debuggers or IDEs, Swanky maintains persistent connections, allowing developers to:
- Inspect objects in real-time with a dedicated viewer
- Explore interactive backtraces during exceptions
- Monitor threads and asynchronous tasks visually
- Trace function executions dynamically
- Modify code on-the-fly without restarting the runtime
"We provide more advanced tooling based on runtime introspection," Zimmermann explained. "Unlike static analysis tools, we see actual variable values—not just types—enabling deeper insight during development."
Technical Mechanics and Challenges
Swanky communicates with Python via a custom protocol, injecting instrumentation at runtime to enable features like the function tracer. This approach allows immediate feedback but introduces complexities:
# Example of Swanky's runtime instrumentation
from swanky.tracing import trace_function
@trace_function # Decorator enables live call tracking
def process_data(input):
# ... code execution monitored in Emacs
Current limitations include compatibility hurdles with certain async frameworks and performance overhead during tracing. Zimmermann acknowledges these in his Codeberg repository, noting optimizations and broader interpreter support as key priorities.
Why This Matters for Pythonistas
The project challenges Python’s conventional development loop. By preserving application state between edits—a hallmark of Lisp and Smalltalk environments—Swanky could dramatically reduce debugging friction. This is particularly valuable for data science workflows or long-running services where restarting processes wastes significant time.
As Zimmermann quipped: "Python is eating the world. Emacs is eating my computing environment. I’m attempting to get them working together." If successful, Swanky may inspire a new generation of interactive tools for statically-typed languages.
Source: EmacsConf 2025 Talk by Scott Zimmermann (Video, Repository)