Schopenhauer's Will
The Will to Document
A powerful CLI tool and Python library for generating Word documents from YAML/JSON specifications
Documentation • Installation • Quick Start • Features • API
Overview
Schopenhauer transforms YAML or JSON specifications into professional Word documents (.docx). Named after the philosopher Arthur Schopenhauer and his work "The World as Will and Representation," this tool embodies the will to create beautiful documents programmatically.
Why Schopenhauer?
- Version Control Friendly: Document specs are plain text (YAML/JSON)
- Reproducible: Same spec always produces the same output
- Automatable: Perfect for CI/CD pipelines and batch processing
- Customizable: Full control over styling, templates, and content
- Cloud Ready: REST API for microservices and cloud deployment
Installation
pip install schopenhauer
Optional Dependencies
# With REST API server
pip install schopenhauer[api]
# With documentation tools
pip install schopenhauer[docs]
# Everything
pip install schopenhauer[all]
Quick Start
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
# Interactive document creation
will new -o document.docx
YAML Specification
Create a file report.yaml:
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%"]
Generate the document:
will generate report.yaml -o quarterly-report.docx
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.add_table(
data=[["Alice", "Engineering"], ["Bob", "Sales"]],
headers=["Name", "Department"]
)
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"))
Features
Content Types
- Headings: Multiple levels (H1-H5) with custom styling
- Paragraphs: Rich text with formatting options
- Lists: Bullet and numbered lists with nesting
- Tables: Data tables with headers and styling
- Images: Inline images with captions
- Quotes: Blockquotes with attribution
- Code Blocks: Formatted code snippets
- Page Breaks: Manual page control
- Table of Contents: Automatic TOC generation
Document Features
- Templates: Built-in templates for reports, memos, proposals, etc.
- Placeholders:
{{PLACEHOLDER}}syntax for dynamic content - Headers/Footers: Configurable with page numbers
- Page Setup: Custom sizes, margins, orientation
- Styling: Brand colors, fonts, and formatting
Deployment Options
- CLI Tool:
willcommand for terminal usage - Python Library: Full API for programmatic use
- REST API: FastAPI server for cloud deployment
- Docker: Containerized deployment
- GCP Cloud Run: One-click deployment script
CLI Commands
| Command | Description |
|---|---|
will create |
Create a new document |
will generate |
Generate from YAML/JSON spec |
will inspect |
Inspect document or template |
will new |
Interactive document creation |
will add |
Add content to existing document |
will replace |
Replace placeholders |
will template |
Template management |
will cloud |
Cloud API commands |
Templates
Built-in templates for common document types:
default- Clean, professional defaultreport- Business report with header/footermemo- Internal memo formatletter- Formal business letteracademic- Academic paper (APA-style)proposal- Project proposalmanual- Technical documentationcontract- Legal contract format- And more...
# List templates
will template list
# Use a template
will create -o doc.docx --template report --title "Report"
# Initialize YAML from template
will template init proposal -o my-proposal.yaml
REST API
Deploy as a REST API for cloud-based document generation:
# Start the server
uvicorn will.api:app --host 0.0.0.0 --port 8000
# Or with Docker
docker build -t schopenhauer .
docker run -p 8000:8000 schopenhauer
Endpoints
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/templates |
GET | List templates |
/generate |
POST | Generate document |
/inspect |
POST | Inspect template |
/replace |
POST | Replace placeholders |
/batch/generate |
POST | Batch generation |
Example Request
curl -X POST "http://localhost:8000/generate" \
-H "Content-Type: application/json" \
-d '{
"title": "My Report",
"sections": [
{"type": "heading", "title": "Introduction", "level": 1},
{"type": "content", "text": "Hello, World!"}
]
}' \
--output report.docx
Cloud Deployment
GCP Cloud Run
# Deploy to Cloud Run
./deploy.sh --project my-project --region us-central1
# Build only
./deploy.sh --build-only --local
Docker
# Build image
docker build -t schopenhauer .
# Run container
docker run -p 8000:8000 schopenhauer
# Access API
curl http://localhost:8000/health
Documentation
Full documentation is available at schopenhauer.github.io/schopenhauer.
Building Docs Locally
pip install schopenhauer[docs]
mkdocs serve
Development
Setup
# Clone repository
git clone https://github.com/schopenhauer/schopenhauer.git
cd schopenhauer
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Run linters
black src tests
ruff check src tests
mypy src
Running Tests
# All tests
pytest
# With coverage
pytest --cov=will --cov-report=html
# Specific test file
pytest tests/test_core.py
Contributing
Contributions are welcome! Please read our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Named after Arthur Schopenhauer (1788-1860), German philosopher
- Built with python-docx
- CLI powered by Click
- API built with FastAPI
The Will to Document
Made with ♥ by the Schopenhauer Contributors
Metadata
Release files for schopenhauer 0.2.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 | |
|---|---|---|---|
| schopenhauer-0.2.0.tar.gz | 22.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| schopenhauer-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.5 MB
Release files / schopenhauer-0.2.0.tar.gz
| Download URL | schopenhauer-0.2.0.tar.gz |
|---|---|
| Size | 22.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
182299e9f8dc192295302e825bb10ee8749a117267dbe79c68982783e9e15a47
|
|
BLAKE2b-256 checksum How to use checksums |
6852ef710c81b494c812268293720608d4bafd69c8a91b77d69b4f1393981ae8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.
Transparency logRelease files / schopenhauer-0.2.0-py3-none-any.whl
| Download URL | schopenhauer-0.2.0-py3-none-any.whl |
|---|---|
| Size | 43.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ddcbfa64fafe04b1e666e48d8f3ecb2873c783bb5c37bdf0519ada43035cf4f0
|
|
BLAKE2b-256 checksum How to use checksums |
5d382b4c6824a93629e4354152160e3ccf969c66202ed54a1f4d84b9364371cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.
Transparency log