Metadata-Version: 2.4
Name: papersmith
Version: 0.1.2
Summary: Programmatic Word document generation with LaTeX equations, style presets, citations, charts, and MCP server
Project-URL: Homepage, https://github.com/imnb57/PaperSmith
Project-URL: Documentation, https://imnb57.github.io/PaperSmith
Project-URL: Repository, https://github.com/imnb57/PaperSmith
Project-URL: Issues, https://github.com/imnb57/PaperSmith/issues
Project-URL: Changelog, https://github.com/imnb57/PaperSmith/blob/main/CHANGELOG.md
Author: PaperSmith Contributors
License-Expression: MIT
License-File: LICENSE
Keywords: academic,citations,document,docx,equations,latex,mcp,word
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business
Classifier: Topic :: Text Processing :: Markup :: LaTeX
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: anthropic>=0.20
Requires-Dist: bibtexparser>=2.0.0b0
Requires-Dist: docx2pdf>=0.1
Requires-Dist: google-generativeai>=0.5
Requires-Dist: kaleido>=0.2
Requires-Dist: latex2mathml>=3.0
Requires-Dist: lxml>=4.9
Requires-Dist: matplotlib>=3.8
Requires-Dist: mcp[cli]>=1.0
Requires-Dist: openai>=1.0
Requires-Dist: python-docx>=1.1.0
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: lxml-stubs>=0.5; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pre-commit>=3.7; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Description-Content-Type: text/markdown

# 🔨 PaperSmith

[![CI](https://github.com/imnb57/PaperSmith/actions/workflows/ci.yml/badge.svg)](https://github.com/imnb57/PaperSmith/actions/workflows/ci.yml)
[![PyPI version](https://badge.fury.io/py/papersmith.svg)](https://badge.fury.io/py/papersmith)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Typed](https://img.shields.io/badge/typed-yes-blue.svg)](https://peps.python.org/pep-0561/)

**Programmatic Word document generation with LaTeX equations, academic formatting, citations, charts, and MCP server.**

PaperSmith wraps `python-docx` into a fluent, high-level API that handles all the boilerplate for professional document generation. It bundles its own LaTeX-to-OMML equation pipeline, citation management with multiple styles, chart generation, metadata scrubbing, and exposes an MCP server so any LLM can generate documents directly.

---

## ✨ Features

- **📝 Fluent Document API** — Create professional Word documents with a clean, chainable API
- **📐 LaTeX Equations** — Inline `$...$` and display `$$...$$` equations rendered as native OMML (editable in Word)
- **🎨 Style Presets** — Academic, modern, report, formal, minimal — or define your own
- **📚 Citations & Bibliography** — APA, IEEE, Harvard, MLA, Chicago styles with BibTeX import
- **📊 Charts & Infographics** — Bar, line, pie, scatter charts via matplotlib, embedded as high-res images
- **🔍 Live Editing** — Open, navigate, find/replace, and modify existing documents
- **💬 Review Support** — Comments, footnotes, endnotes, and tracked changes
- **📋 Metadata Management** — Set or scrub author, dates, revision info — leave no generation fingerprints
- **🤖 MCP Server** — 25+ tools for LLM-powered document generation (works with Claude Desktop, Cursor, etc.)
- **⌨️ CLI Interface** — Generate documents from the command line
- **🔌 LLM Provider Abstraction** — Swap between OpenAI, Anthropic, Google with a config change

## 🚀 Quick Start

### Installation

```bash
# Full install (all features included)
pip install papersmith
```

### Create Your First Document

```python
from PaperSmith import SmithDocument

doc = SmithDocument(preset="academic")
doc.add_cover_page(
    title="Advanced Algorithms: Lab Solutions",
    author="Jane Smith",
    institution="MIT"
)
doc.add_heading("Question 1: Merge Sort Analysis", level=2)
doc.add_text("The time complexity of merge sort is $O(n \\log n)$.")
doc.add_equation(r"T(n) = 2T\left(\frac{n}{2}\right) + \Theta(n)")
doc.add_table(
    headers=["Algorithm", "Best", "Average", "Worst"],
    rows=[
        ["Merge Sort", "$O(n \\log n)$", "$O(n \\log n)$", "$O(n \\log n)$"],
        ["Quick Sort", "$O(n \\log n)$", "$O(n \\log n)$", "$O(n^2)$"],
    ]
)
doc.set_metadata(author="Jane Smith", scrub=True)
doc.save("solutions.docx")
```

### Citations

```python
from PaperSmith import SmithDocument

doc = SmithDocument(preset="academic")
doc.citations.style = "ieee"

doc.citations.add_source("knuth1997",
    author="Donald E. Knuth",
    title="The Art of Computer Programming",
    year=1997,
    publisher="Addison-Wesley",
)

doc.add_heading("Literature Review")
doc.add_text("Sorting algorithms are well studied {cite:knuth1997}.")
doc.add_bibliography()
doc.save("paper.docx")
```

### MCP Server (for LLM Integration)

```bash
# Start MCP server for Claude Desktop / Cursor
papersmith mcp-server --transport stdio
```

Claude Desktop config (`claude_desktop_config.json`):
```json
{
  "mcpServers": {
    "PaperSmith": {
      "command": "PaperSmith",
      "args": ["mcp", "--transport", "stdio"]
    }
  }
}
```

VS Code workspace MCP config: put the same server definition in [`.vscode/mcp.json`](.vscode/mcp.json).
This repository includes a working example at [examples/mcp_quickstart.py](examples/mcp_quickstart.py).

## 📦 Installation

`pip install papersmith` installs the full runtime feature set: documents, equations, citations, charts, PDF export, MCP, CLI, and LLM provider support.

For development tools only, install `pip install -e ".[dev]"`.

## 🛠️ CLI Usage

```bash
# Generate a document from markdown
papersmith convert notes.md -o notes.docx --preset academic

# Generate with LLM assistance
papersmith generate questions.md -o solutions.docx --provider openai

# Scrub metadata from a document
papersmith scrub report.docx --author "John Doe"

# List available presets
papersmith presets

# Start MCP server
papersmith mcp-server --transport stdio
```

## 📖 Documentation

Full documentation is available at [imnb57.github.io/PaperSmith](https://imnb57.github.io/PaperSmith).

## 🤝 Contributing

We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

```bash
# Clone and install for development
git clone https://github.com/imnb57/PaperSmith.git
cd PaperSmith
pip install -e ".[dev]"

# Run tests
pytest

# Lint and format
ruff check src/ tests/
ruff format src/ tests/

# Type check
mypy src/PaperSmith/
```

## 🚀 Releasing

This repository already includes a GitHub Actions release workflow at [`.github/workflows/release.yml`](.github/workflows/release.yml).
To publish without Twine, tag a release and push it:

```bash
git tag v0.1.1
git push origin v0.1.1
```

The workflow uses PyPI trusted publishing, so no local Twine account or API token is needed once the PyPI project is configured for this GitHub repository.

### Claiming `papersmith` on PyPI

1. Sign in to your PyPI account.
2. Open the `papersmith` project page on PyPI, or create the project by publishing the first release.
3. In the project settings, add a trusted publisher for this repository: `imnb57/PaperSmith`.
4. Keep the GitHub Actions workflow environment name as `pypi` to match the PyPI trusted publisher entry.
5. Tag `v0.1.1` and push it once the trusted publisher is saved.

## 📄 License

MIT License. See [LICENSE](LICENSE) for details.

