Python compatibility layer for executing Deluge scripts with full SalesIQ/Zobot support
Project description
Deluge Compatibility Layer
A Python compatibility layer that allows you to execute Deluge scripts within Python environments. This project provides a runtime environment and translator that converts Deluge language syntax to Python, enabling testing and execution of Deluge scripts outside of their native environment.
Features
- Complete Data Type Support: Implements Deluge's Map, List, and String types with all their methods
- Built-in Functions: HTTP requests, encoding/decoding, mathematical operations, and utility functions
- Script Translation: Converts Deluge syntax to executable Python code
- Runtime Environment: Provides a sandboxed execution context for Deluge scripts
- Zobot Support: Full SalesIQ/Zobot development with interactive chat simulation
- Easy Integration: Simple API for running Deluge scripts from Python
Installation
Full Installation (Recommended)
Includes CLI tools, rich output formatting, and all features:
# Install from PyPI (when published)
pip install deluge-compat
# Or with uv
uv add deluge-compat
# Or from source
git clone git@github.com:jctosta/deluge-compat.git
cd deluge-compat
uv install
Slim Installation
For minimal dependencies in environments where you only need the core compatibility layer:
pip install deluge-compat[slim]
# or
uv add deluge-compat[slim]
The slim version excludes CLI tools and rich formatting but retains all core translation and execution capabilities.
Quick Start
Command Line Tools
The package provides CLI tools for working with Deluge scripts:
Running Deluge Scripts
# Run a Deluge script file
deluge-run my_script.dg
# Run with JSON output
deluge-run my_script.dg --json
# Run with verbose output
deluge-run my_script.dg --verbose
Translating Deluge Scripts to Python
# Translate a Deluge script to Python
deluge-translate my_script.dg --output converted.py
Interactive Zobot Chat Testing
# Test Zobot scripts with interactive chat
deluge-chat my_zobot.dg
# Use specific visitor data
deluge-chat my_zobot.dg --visitor-mock-source json --visitor-mock-file visitor_data.json
# Automated testing with predefined messages
deluge-chat my_zobot.dg --message-mock-source json --message-mock-file test_messages.json
For detailed usage information, see our documentation.
Basic Usage Examples
from deluge_compat import run_deluge_script
# Simple script execution
result = run_deluge_script('''
response = Map();
response.put("greeting", "Hello World!");
return response;
''')
print(result) # {'greeting': 'Hello World!'}
# With context variables
result = run_deluge_script('''
greeting = "Hello " + username + "!";
return Map({"message": greeting});
''', username="Alice")
print(result['message']) # "Hello Alice!"
Translation to Python
from deluge_compat import translate_deluge_to_python
# Generate PEP 723 compatible Python script
python_code = translate_deluge_to_python('''
numbers = List([1, 2, 3]);
sum = 0;
for each num in numbers {
sum = sum + num;
}
return Map({"sum": sum});
''')
# Save and run with: uv run script.py
with open("script.py", "w") as f:
f.write(python_code)
Documentation
Core Features
- Basic Usage Guide - Complete guide to data types, functions, and common patterns
- Zobot Support Guide - SalesIQ/Zobot development with interactive testing
Quick Reference
Data Types: Map, List, String with full Deluge method compatibility
Functions: HTTP, encoding, math, utilities, and SalesIQ session management
CLI Tools: deluge-run, deluge-translate, deluge-chat
Testing: Comprehensive test suite with 28 SalesIQ tests + 115 core tests
Examples
Check the examples/ directory and documentation for comprehensive examples:
- Basic Operations: Data manipulation, string processing, control flow
- HTTP Integration: API calls, data processing, error handling
- Zobot Scripts: Customer service bots, session management, interactive chat
- Translation Examples: Converting Deluge to Python with PEP 723 support
Testing
Comprehensive test coverage with 143 total tests (115 core + 28 SalesIQ) achieving 100% success rate.
# Run all tests
uv run pytest
# Test specific functionality
uv run pytest tests/test_types.py # Data types
uv run pytest tests/test_salesiq.py # SalesIQ/Zobot features
uv run pytest tests/test_showcase.py # Working features demo
✅ Production Ready: Complete Deluge language support with full SalesIQ/Zobot compatibility
Project Structure
deluge-compat/
├── src/deluge_compat/
│ ├── __init__.py # Main API
│ ├── types.py # Deluge data types
│ ├── functions.py # Built-in functions
│ ├── translator.py # Deluge → Python translator
│ ├── runtime.py # Execution environment
│ ├── cli_*.py # CLI tools
│ └── salesiq/ # SalesIQ/Zobot support
├── docs/ # Documentation
├── examples/ # Usage examples
└── tests/ # Test suite
Architecture
Core Engine: Types, Functions, Translator, Runtime SalesIQ Layer: Visitor/Message objects, session management, mock system CLI Tools: Interactive testing, script translation, chat simulation Testing: Comprehensive validation with 143 tests
All core Deluge features are fully supported with complete SalesIQ/Zobot compatibility.
Contributing
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Add comprehensive tests
- Ensure all tests pass (
uv run pytest) - Run code quality checks (
uv run ruff check .anduv run pyright .) - Submit a pull request
See development documentation for detailed contribution guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Based on the Deluge language specification and documentation
- Inspired by the Deluge Language Parser project
- Built with Python 3.12+ and modern tooling
- Created with the assistance of Claude Code - Anthropic's AI-powered coding assistant
Disclaimer
Deluge Language Ownership: Deluge is a proprietary scripting language owned and developed by Zoho Corporation. This project is an independent, unofficial compatibility layer created for educational and development purposes. It is not affiliated with, endorsed by, or sponsored by Zoho Corporation.
Usage Notice: This compatibility layer is intended for testing, development, and educational purposes only. For production Deluge script execution, please use the official Deluge runtime environment provided by Zoho Corporation.
Trademark Notice: "Deluge" is a trademark of Zoho Corporation. This project respects all intellectual property rights and trademarks of Zoho Corporation.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 deluge_compat-1.2.6.tar.gz.
File metadata
- Download URL: deluge_compat-1.2.6.tar.gz
- Upload date:
- Size: 59.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcca130ff72ce5bce229964b49462311a2d83e61a42b55d6672b3ce363eb1f15
|
|
| MD5 |
0f3252a968cd1e7ddc308f689d0d67c0
|
|
| BLAKE2b-256 |
947494b946d5222e44ab2b55c2ff14807ecb71a809c9f1cd764ef41372b5e459
|
File details
Details for the file deluge_compat-1.2.6-py3-none-any.whl.
File metadata
- Download URL: deluge_compat-1.2.6-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
900ca0f630443d981b5397ed6550a604189148b4e40811a5b198fa423b98f02b
|
|
| MD5 |
62aa241abb19ec3c326faf1ddf26f70d
|
|
| BLAKE2b-256 |
8bcdcff1d4c62b493100d2b78816dbd8bd94f4e679eed9d74f2643d59e16a51a
|