A lightweight markup language for structured text generation
Project description
🚀 LLML - Lightweight Language Markup Language
The most elegant way to generate structured text in Python.
LLML transforms your data into beautifully formatted XML-like markup with zero fuss and maximum flexibility. Perfect for context engineering, configuration generation, and structured document creation.
⚡ Quick Start
from zenbase_llml import llml
# Simple values
print(llml({"greeting": "Hello World"}))
# Output: <greeting>Hello World</greeting>
# Lists become numbered items
print(llml({"tasks": ["Buy milk", "Walk dog", "Code LLML"]}))
# Output:
# <tasks>
# <tasks-1>Buy milk</tasks-1>
# <tasks-2>Walk dog</tasks-2>
# <tasks-3>Code LLML</tasks-3>
# </tasks>
# Complex nested structures
print(llml({
"title": "My Project",
"features": ["Fast", "Simple", "Powerful"],
"config": {"debug": True, "version": "1.0"}
}))
🎯 Why LLML?
- 🔥 Zero Learning Curve: One function, infinite possibilities
- 🎨 Beautiful Output: Automatically formatted, properly indented
- 🔧 Flexible Architecture: Extensible formatter system for custom types
- ⚡ Lightning Fast: Minimal overhead, maximum performance
- 🌟 Pythonic: Feels natural, works everywhere
- 🔧 Customizable: Create your own formatters for specialized output
🛠️ Installation
pip install zenbase-llml
📚 Advanced Usage
Multi-line Content
instructions = """
Step 1: Install LLML
Step 2: Import llml
Step 3: Create magic
"""
print(llml({"instructions": instructions}))
# Output:
# <instructions>
# Step 1: Install LLML
# Step 2: Import llml
# Step 3: Create magic
# </instructions>
Complex Nested Structures
prompt_data = {
"system": "You are a helpful assistant",
"rules": [
"Be concise and clear",
"Provide examples when helpful",
"Ask clarifying questions"
],
"context": {
"user_level": "beginner",
"topic": "Python programming"
}
}
print(llml(prompt_data))
Custom Formatters
LLML uses an extensible formatter system. You can create custom formatters for specialized types:
from zenbase_llml import llml
from zenbase_llml.formatters.vibe_xml import vibe_xml
from datetime import datetime
# Custom date formatter
def is_date(value):
return isinstance(value, datetime)
def format_date(value, llml_func, formatters=None):
return f"<date>{value.strftime('%Y-%m-%d')}</date>"
# Create custom formatter map
custom_formatters = {**vibe_xml, is_date: format_date}
# Use with custom formatters
result = llml({"created": datetime.now()}, formatters=custom_formatters)
For detailed information on creating and using formatters, see our Formatters Guide.
🎪 Use Cases
🤖 AI Prompt Engineering
Perfect for structuring complex prompts:
prompt = llml({
"role": "Senior Python Developer",
"task": "Code review the following function",
"criteria": ["Performance", "Readability", "Best practices"],
"code": function_to_review
})
⚙️ Configuration Generation
Generate clean config files:
config = llml({
"database": {"host": "localhost", "port": 5432},
"features": ["logging", "caching", "monitoring"],
"environment": "production"
})
📄 Document Structure
Create structured documents:
document = llml({
"title": "API Documentation",
"sections": ["Authentication", "Endpoints", "Examples"],
"metadata": {"version": "2.1", "author": "Dev Team"}
})
🧪 Testing
Run the comprehensive test suite:
# Run tests
uv run pytest
# Run with coverage
uv run pytest --cov=src --cov-report=html
# Test across Python versions
tox
🌐 Python Compatibility
LLML supports Python 3.8+ and is tested against:
- ✅ Python 3.8
- ✅ Python 3.9
- ✅ Python 3.10
- ✅ Python 3.11
- ✅ Python 3.12
- ✅ Python 3.13
🏗️ Development
# Clone the repo
git clone https://github.com/yourusername/llml.git
cd llml/py
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate
uv pip install -e .[dev]
# Run linting and formatting
uv run ruff check .
uv run ruff format .
# Run tests
uv run pytest
🤝 Contributing
We love contributions! Whether it's:
- 🐛 Bug reports
- 💡 Feature requests
- 📝 Documentation improvements
- 🔧 Code contributions
Check out our contribution guidelines to get started.
📄 License
MIT License - see LICENSE file for details.
🌟 Star History
If LLML makes your life easier, give us a star! ⭐
Made with ❤️ for the Python community
LLML: Because beautiful markup shouldn't be hard.
Project details
Release history Release notifications | RSS feed
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 zenbase_llml-0.4.0.tar.gz.
File metadata
- Download URL: zenbase_llml-0.4.0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d34929a14aa9da0c9ef93d16cbcf065b912c5dece767f892c90f917bba0e7760
|
|
| MD5 |
cf23b3a6966a13bb53ec7381c2da73d9
|
|
| BLAKE2b-256 |
01cca73b74508d9017513562b8c06817a9d4aeb8dde40a241d750e058986a42d
|
File details
Details for the file zenbase_llml-0.4.0-py3-none-any.whl.
File metadata
- Download URL: zenbase_llml-0.4.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d64123312c69f8d01fe81cecda31ad65532a9a93dee8e629c769fddb21b6c84
|
|
| MD5 |
39024d644d81d727f98ed07d819497ed
|
|
| BLAKE2b-256 |
45762d642690869c82f126c73e9bf94ad0eb72b21ca8e062add01fc430035258
|