Skip to main content

🚀 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.

Metadata

Release files for zenbase_llml 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zenbase_llml 0.4.0
File Size Uploaded Provenance Actions
zenbase_llml-0.4.0.tar.gz 10.3 kB Without provenance Details for zenbase_llml-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zenbase_llml 0.4.0
File Interpreter ABI Platform Actions
zenbase_llml-0.4.0-py3-none-any.whl Python 3 none any Details for zenbase_llml-0.4.0-py3-none-any.whl

Total release size: 22.3 kB

Release files / zenbase_llml-0.4.0.tar.gz

Download URL zenbase_llml-0.4.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d34929a14aa9da0c9ef93d16cbcf065b912c5dece767f892c90f917bba0e7760
BLAKE2b-256 checksum
How to use checksums
01cca73b74508d9017513562b8c06817a9d4aeb8dde40a241d750e058986a42d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / zenbase_llml-0.4.0-py3-none-any.whl

Download URL zenbase_llml-0.4.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d64123312c69f8d01fe81cecda31ad65532a9a93dee8e629c769fddb21b6c84
BLAKE2b-256 checksum
How to use checksums
45762d642690869c82f126c73e9bf94ad0eb72b21ca8e062add01fc430035258
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Security for zenbase_llml 0.4.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page