Ontonaut 🚀
Interactive widgets for marimo with pluggable backends
Ontonaut provides beautiful, marimo-compatible widgets for code execution and AI chat with customizable backends. Build domain-specific languages, create custom interpreters, or integrate AI assistants - all within your marimo notebooks!
✨ Features
CodeEditor Widget
- 🎨 Clean, marimo-style UI - Seamless integration with marimo's aesthetic
- 🔌 Pluggable executors - Python, JSON, Calculator, Regex, or your own
- 🛠️ Custom languages - Create DSLs and custom interpreters
- ⌨️ Keyboard shortcuts - Cmd/Ctrl+Enter to run
- 🌓 Light & dark themes - Follows your marimo theme
ChatBot Widget
- 💬 Streaming responses - Real-time, token-by-token output
- 📑 Automatic tabs - Each question creates a new history tab
- 💻 Code formatting - Markdown code blocks render beautifully
- 🤖 Multiple handlers - OpenAI, Anthropic, MCP, or custom
- 🎯 Type-safe - Full type hints throughout
📦 Installation
pip install ontonaut
🚀 Quick Start
CodeEditor
import marimo as mo
from ontonaut import CodeEditor, PythonExecutor
editor = CodeEditor(
executor=PythonExecutor(),
code="x = 10\nresult = x * 2",
theme="dark"
)
editor
ChatBot
from ontonaut import ChatBot, EchoHandler
chatbot = ChatBot(
handler=EchoHandler(),
placeholder="Ask me anything...",
theme="dark"
)
chatbot
📚 Documentation
📖 User Guides
Comprehensive guides for using Ontonaut:
- Quick Start - Get up and running in 5 minutes
- CodeEditor Guide - Complete CodeEditor documentation
- ChatBot Guide - Complete ChatBot documentation
- Executors Reference - Built-in executors
- Handlers Reference - Built-in chat handlers
- Custom Executors - Build your own
- Custom Handlers - Build your own
📓 Interactive Notebooks
Runnable marimo notebooks with examples:
- Getting Started - Basic usage
- ChatBot Guide - Complete chat examples
- OpenAI Integration - AI integration
Run them:
marimo edit book/marimo/01-getting-started.py
🏗️ Architecture Docs
For developers and AI assistants:
- Architecture Overview - System design
- Widget System - anywidget patterns
- Development Guide - Contributing
💡 Examples
Custom DSL
from ontonaut import CodeEditor
def greeting_dsl(code: str) -> str:
"""Simple greeting DSL."""
lines = code.strip().split("\n")
results = []
for line in lines:
parts = line.split()
if len(parts) == 2:
command, name = parts
if command == "greet":
results.append(f"Hello, {name}!")
elif command == "farewell":
results.append(f"Goodbye, {name}!")
return "\n".join(results)
editor = CodeEditor(
executor=greeting_dsl,
code="greet Alice\nfarewell Bob",
language="dsl"
)
OpenAI Chat
from ontonaut import ChatBot, OpenAIHandler
import os
chatbot = ChatBot(
handler=OpenAIHandler(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4",
system_prompt="You are a helpful assistant.",
temperature=0.7
),
theme="dark"
)
Custom Streaming Handler
def my_handler(message: str):
"""Custom streaming handler."""
import time
# Generate code example
if "code" in message.lower():
yield "Here's a Python example:\n\n"
yield "```python\n"
yield "def greet(name):\n"
yield " return f'Hello {name}!'\n"
yield "```"
else:
words = f"You said: {message}".split()
for word in words:
yield word + " "
time.sleep(0.05)
chatbot = ChatBot(handler=my_handler)
🎨 Built-in Components
Executors
- PythonExecutor - Execute Python code
- JSONExecutor - Format and validate JSON
- CalculatorExecutor - Evaluate math expressions
- RegexExecutor - Test regular expressions
Handlers
- EchoHandler - Echo back messages (testing)
- OpenAIHandler - Stream from OpenAI GPT models
- AnthropicHandler - Stream from Anthropic Claude
- MCPHandler - Model Context Protocol integration
- CustomHandler - Wrap any function
⌨️ Keyboard Shortcuts
Cmd/Ctrl + Enter- Execute/SendTab- Insert 4 spaces
🏗️ Development
Setup
git clone https://github.com/yourusername/ontonaut.git
cd ontonaut
make setup
Commands
make test # Run tests with coverage
make lint # Run linters (black, ruff, mypy)
make format # Format code
make build # Build package
make clean # Clean artifacts
Project Structure
ontonaut/
├── src/ontonaut/ # Python package
│ ├── editor.py # CodeEditor widget
│ ├── chatbot.py # ChatBot widget
│ ├── executors.py # Code execution backends
│ ├── handlers.py # Chat handlers
│ └── static/ # Frontend assets
├── tests/ # Test suite
├── examples/ # Example notebooks
├── book/
│ ├── markdown/ # User documentation
│ └── marimo/ # Interactive notebooks
├── docs/ # Architecture documentation
└── scripts/ # Development scripts
🧪 Testing
make test
Coverage: 85%+ across all components
📝 Use Cases
- AI Chat Interfaces - Streaming AI assistants in notebooks
- DSL Prototyping - Test domain-specific language ideas
- Custom Interpreters - Specialized code execution
- Educational Tools - Interactive coding tutorials
- Data Transformation - Custom data processing
- Template Languages - Specialized templating
- Company Integrations - Wrap internal AI APIs
🎯 Roadmap
CodeEditor
- Syntax highlighting
- Code completion
- Multi-file support
- Debugger integration
ChatBot
- Syntax highlighting for code blocks
- Copy-to-clipboard
- Tab persistence
- Export conversations
- Async handler support
🤝 Contributing
Contributions welcome! See docs/README.md for architecture and development guidelines.
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing) - Run tests (
make test) and linting (make lint) - Commit changes
- Push to branch
- Open Pull Request
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
- Built with Anywidget
- Designed for marimo
- Inspired by the need for flexible, customizable widgets
- Thanks to the open source community
📚 Learn More
- User Documentation - Complete guides
- Interactive Notebooks - Runnable examples
- Architecture Docs - For developers
- Marimo Documentation
- Anywidget Documentation
🔗 Links
- Homepage: https://github.com/yourusername/ontonaut
- Issues: https://github.com/yourusername/ontonaut/issues
- PyPI: https://pypi.org/project/ontonaut/
Made with ❤️ for the marimo and Python communities
Start building your custom widgets today! 🚀
Metadata
Release files for ontonaut 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ontonaut-0.1.0.tar.gz | 81.2 kB | Without provenance | Details for ontonaut-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ontonaut-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ontonaut-0.1.0-py3-none-any.whl |
Total release size: 104.5 kB
Release files / ontonaut-0.1.0.tar.gz
| Download URL | ontonaut-0.1.0.tar.gz |
|---|---|
| Size | 81.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb9fbf08a5050d3b4b48050abf033822ec87c1123f78fa9f92c95dc8b4ffa9f3
|
|
BLAKE2b-256 checksum How to use checksums |
f8ff8fa4fd3e916523a706762bb40a3012464c1e060f23a44963cba475ef525f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / ontonaut-0.1.0-py3-none-any.whl
| Download URL | ontonaut-0.1.0-py3-none-any.whl |
|---|---|
| Size | 23.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93c78f2987693372bdfa75a78ff16547c680032cebb0fae17a28e49519f69bd1
|
|
BLAKE2b-256 checksum How to use checksums |
1bf73ae0969090e686a0ba077fb0b3e2ade0f1cca637a5a9e0fb5ef8669b78f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for ontonaut 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.