Schopenhauer's Will¶
What is Schopenhauer?¶
Schopenhauer is a modern document generation tool that transforms YAML or JSON specifications into professional Word documents (.docx). Named after the philosopher Arthur Schopenhauer and his seminal work "The World as Will and Representation," this tool embodies the will to create beautiful documents programmatically.
YAML/JSON Specs
Define your document structure in human-readable YAML or JSON format. No need to manually format Word documents.
Powerful CLI
The will command provides intuitive commands for creating, generating, and manipulating documents.
Python Library
Full Python API for programmatic document creation with fluent builder patterns.
Templates
Built-in templates for reports, memos, proposals, and more. Support for custom templates.
REST API
FastAPI-powered REST API for cloud-based document generation and microservices integration.
Cloud Ready
Docker and GCP Cloud Run deployment support for scalable document generation services.
Quick Example¶
CLI Usage¶
# Create a simple document
will create -o report.docx --title "Annual Report" --author "Jane Doe"
# Generate from YAML specification
will generate spec.yaml -o output.docx
# Initialize a YAML template
will template init report -o my-report.yaml
YAML Specification¶
title: Quarterly Report
subtitle: Q4 2024 Results
author: Analytics Team
page_size: letter
margins: moderate
table_of_contents: true
sections:
- type: section
title: Executive Summary
- type: content
text: |
This report summarizes the key achievements
and metrics for the fourth quarter.
- type: content
title: Key Highlights
bullets:
- Revenue increased by 25%
- Customer satisfaction at all-time high
- New product launch successful
- type: table
title: Performance Metrics
headers: [Metric, Q3, Q4, Change]
data:
- [Revenue, "$1.2M", "$1.5M", "+25%"]
- [Users, "10K", "15K", "+50%"]
Python API¶
from will import WordDocument, DocumentBuilder
# Simple approach
doc = WordDocument()
doc.add_title("My Report", subtitle="2024 Edition")
doc.add_heading("Introduction", level=1)
doc.add_paragraph("Welcome to the report.")
doc.add_bullets(["Point 1", "Point 2", "Point 3"])
doc.save("report.docx")
# Fluent builder approach
(DocumentBuilder()
.set_title("My Report")
.add_heading("Introduction")
.add_paragraph("Welcome to the report.")
.add_bullets(["Point 1", "Point 2"])
.save("report.docx"))
Installation¶
For additional features:
# With API server support
pip install schopenhauer[api]
# With documentation tools
pip install schopenhauer[docs]
# Everything
pip install schopenhauer[all]
Why "Schopenhauer"?¶
The name pays homage to Arthur Schopenhauer (1788-1860), the German philosopher best known for "The World as Will and Representation" (Die Welt als Wille und Vorstellung).
In Schopenhauer's philosophy, the Will (Wille) is the fundamental driving force behind all existence. Similarly, this tool represents the will to transform ideas into documents - the driving force that converts your specifications into tangible Word documents.
The CLI command will reflects this philosophical foundation, making document generation as natural as willing something into existence.
Features¶
- Multiple Input Formats: YAML, JSON, or Python dictionaries
- Rich Content Support: Headings, paragraphs, lists, tables, images, quotes, code blocks
- Placeholder System:
{{PLACEHOLDERS}}for template-based generation - Built-in Templates: Professional templates for common document types
- Custom Styling: Full control over fonts, colors, margins, and layouts
- Table of Contents: Automatic TOC generation
- Headers & Footers: Configurable with page numbers
- REST API: Full-featured API for cloud deployments
- Batch Processing: Generate multiple documents in one request
Getting Started¶
Support¶
- GitHub Issues: Report bugs and request features
- Documentation: You're reading it!
- Examples: Check the
examples/directory in the repository