A Python port of xterm.js using Sanic for web-based terminal emulation.
XTerm-Py is a comprehensive Python implementation of the popular xterm.js terminal emulator, designed to work with the Sanic async web framework. It provides a full-featured terminal emulator that can be embedded in web applications.
- Full terminal emulation with ANSI escape sequence support
- WebSocket-based communication
- PTY (pseudo-terminal) support
- Buffer management with scrollback
- Input handling and keyboard events
- Color and styling support
- Unicode support
- Async/await architecture
pip install xterm-pyfrom sanic import Sanic
from xterm_py import create_terminal_app
app = create_terminal_app()
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)The project maintains the same modular architecture as xterm.js:
- browser/: Browser-specific implementations (WebSocket handlers, etc.)
- common/: Platform-agnostic terminal core functionality
- headless/: Headless terminal implementation
MIT License (same as xterm.js)
