# Pergamos: Dynamic HTML Reporting for Python
**Pergamos** is a lightweight Python module for **automatically generating HTML reports** with support for:
- Markdown rendering 🗙️
- LaTeX equations using MathJax 💢
- Syntax-highlighted code blocks 🎨
- Tables from `numpy` arrays and `pandas` DataFrames 📊
- Static and interactive Matplotlib plots 📈
---
## 🚀 **Installation**
Install via `pip`:
```sh
pip install pergamos
```
For development:
```sh
pip install -e .[dev]
```
---
## 📌 **Features**
- 🗙️ **Markdown** rendering with `markdown` and `pygments`
- 🧬 **LaTeX support** via MathJax for equations
- 🎨 **Syntax-highlighted code blocks** (Python, JS, C++)
- 📊 **Tables** from lists, NumPy arrays, and Pandas DataFrames
- 📈 **Plots** using Matplotlib (both static & interactive)
- 📁 **Collapsible & Tabbed Containers** for better layout
---
## 🛠 **Usage Examples**
### **1️⃣ Creating an HTML Document**
```python
import pergamos as pg
doc = pg.Document("My Report")
doc.append(pg.Text("🚀 My Dynamic Report", tag='h1'))
doc.append(pg.Text("This is a dynamically generated report using Pergamos."))
doc.save("report.html")
```
🔹 Generates a simple **HTML report** with a title and text.
---
### **2️⃣ Adding Markdown Content**
```python
md_text = """
# Markdown Example
This is **bold**, *italic*, and `inline code`.
"""
doc.append(pg.Markdown(md_text))
```
🔹 Supports **headings, bold, italics, and inline code**.
---
### **3️⃣ Adding a Code Block with Syntax Highlighting**
```python
code = """
```python
def hello():
print("Hello, World!")
\```
"""
doc.append(pg.Markdown(code))
```
🔹 Renders Python **syntax-highlighted** inside a styled `<pre><code>` block.
---
### **4️⃣ Rendering LaTeX Equations**
```python
doc.append(pg.Latex(r"E = mc^2", inline=True))
doc.append(pg.Latex(r"\int_a^b x^2 \,dx", inline=False))
```
🔹 Supports **inline and block LaTeX equations**.
---
### **5️⃣ Displaying Tables**
```python
import numpy as np
import pandas as pd
array_data = np.random.randint(1, 100, (5, 5))
df = pd.DataFrame(array_data, columns=["A", "B", "C", "D", "E"])
doc.append(pg.Table(array_data)) # Numpy array
doc.append(pg.Table(df)) # Pandas DataFrame
```
🔹 Supports **tables from lists, NumPy, and Pandas**.
---
### **6️⃣ Adding a Static Plot**
```python
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3, 4], [10, 20, 25, 30])
doc.append(pg.Plot(fig))
```
🔹 Renders a **static Matplotlib plot** as an image.
---
### **7️⃣ Adding an Interactive Plot**
```python
doc.append(pg.InteractivePlot(fig))
```
🔹 Uses **Mpld3** to create **interactive zoomable plots**.
---
## 🏠 **Development & Contribution**
To contribute:
1. Clone the repo:
```sh
git clone https://github.com/manuelblancovalentin/pergamos.git
cd pergamos
```
2. Install dependencies:
```sh
pip install -e .[dev]
```
3. Run tests:
```sh
pytest
```
4. Submit a pull request 🚀
---
## 📍 **License**
This project is licensed under the **MIT License**.
📌 **GitHub Repository**: [Pergamos](https://github.com/manuelblancovalentin/pergamos)
Raw data
{
"_id": null,
"home_page": null,
"name": "pergamos",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "html, markdown, reporting, automation, dynamic, syntax-highlighting",
"author": null,
"author_email": "Manu B Valentin <manuel.blanco.valentin@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/58/e3/29facac0e7eb7c473d3323e42b0944bc6942296bdbb17d845eb2248fdaa1/pergamos-0.0.5.tar.gz",
"platform": null,
"description": "# Pergamos: Dynamic HTML Reporting for Python\n\n**Pergamos** is a lightweight Python module for **automatically generating HTML reports** with support for:\n- Markdown rendering \ud83d\uddd9\ufe0f\n- LaTeX equations using MathJax \ud83d\udca2\n- Syntax-highlighted code blocks \ud83c\udfa8\n- Tables from `numpy` arrays and `pandas` DataFrames \ud83d\udcca\n- Static and interactive Matplotlib plots \ud83d\udcc8\n\n---\n\n## \ud83d\ude80 **Installation**\nInstall via `pip`:\n```sh\npip install pergamos\n```\nFor development:\n```sh\npip install -e .[dev]\n```\n\n---\n\n## \ud83d\udccc **Features**\n- \ud83d\uddd9\ufe0f **Markdown** rendering with `markdown` and `pygments`\n- \ud83e\uddec **LaTeX support** via MathJax for equations\n- \ud83c\udfa8 **Syntax-highlighted code blocks** (Python, JS, C++)\n- \ud83d\udcca **Tables** from lists, NumPy arrays, and Pandas DataFrames\n- \ud83d\udcc8 **Plots** using Matplotlib (both static & interactive)\n- \ud83d\udcc1 **Collapsible & Tabbed Containers** for better layout\n\n---\n\n## \ud83d\udee0 **Usage Examples**\n\n### **1\ufe0f\u20e3 Creating an HTML Document**\n```python\nimport pergamos as pg\n\ndoc = pg.Document(\"My Report\")\ndoc.append(pg.Text(\"\ud83d\ude80 My Dynamic Report\", tag='h1'))\ndoc.append(pg.Text(\"This is a dynamically generated report using Pergamos.\"))\n\ndoc.save(\"report.html\")\n```\n\ud83d\udd39 Generates a simple **HTML report** with a title and text.\n\n---\n\n### **2\ufe0f\u20e3 Adding Markdown Content**\n```python\nmd_text = \"\"\"\n# Markdown Example\nThis is **bold**, *italic*, and `inline code`.\n\"\"\"\n\ndoc.append(pg.Markdown(md_text))\n```\n\ud83d\udd39 Supports **headings, bold, italics, and inline code**.\n\n---\n\n### **3\ufe0f\u20e3 Adding a Code Block with Syntax Highlighting**\n```python\ncode = \"\"\"\n```python\ndef hello():\n print(\"Hello, World!\")\n\\```\n\"\"\"\ndoc.append(pg.Markdown(code))\n```\n\n\ud83d\udd39 Renders Python **syntax-highlighted** inside a styled `<pre><code>` block.\n\n---\n\n### **4\ufe0f\u20e3 Rendering LaTeX Equations**\n```python\ndoc.append(pg.Latex(r\"E = mc^2\", inline=True))\ndoc.append(pg.Latex(r\"\\int_a^b x^2 \\,dx\", inline=False))\n```\n\ud83d\udd39 Supports **inline and block LaTeX equations**.\n\n---\n\n### **5\ufe0f\u20e3 Displaying Tables**\n```python\nimport numpy as np\nimport pandas as pd\n\narray_data = np.random.randint(1, 100, (5, 5))\ndf = pd.DataFrame(array_data, columns=[\"A\", \"B\", \"C\", \"D\", \"E\"])\n\ndoc.append(pg.Table(array_data)) # Numpy array\ndoc.append(pg.Table(df)) # Pandas DataFrame\n```\n\ud83d\udd39 Supports **tables from lists, NumPy, and Pandas**.\n\n---\n\n### **6\ufe0f\u20e3 Adding a Static Plot**\n```python\nimport matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\nax.plot([1, 2, 3, 4], [10, 20, 25, 30])\n\ndoc.append(pg.Plot(fig))\n```\n\ud83d\udd39 Renders a **static Matplotlib plot** as an image.\n\n---\n\n### **7\ufe0f\u20e3 Adding an Interactive Plot**\n```python\ndoc.append(pg.InteractivePlot(fig))\n```\n\ud83d\udd39 Uses **Mpld3** to create **interactive zoomable plots**.\n\n---\n\n## \ud83c\udfe0 **Development & Contribution**\nTo contribute:\n1. Clone the repo:\n ```sh\n git clone https://github.com/manuelblancovalentin/pergamos.git\n cd pergamos\n ```\n2. Install dependencies:\n ```sh\n pip install -e .[dev]\n ```\n3. Run tests:\n ```sh\n pytest\n ```\n4. Submit a pull request \ud83d\ude80\n\n---\n\n## \ud83d\udccd **License**\nThis project is licensed under the **MIT License**.\n\n\ud83d\udccc **GitHub Repository**: [Pergamos](https://github.com/manuelblancovalentin/pergamos)\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A lightweight dynamic module for automatic HTML reporting",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://github.com/manuelblancovalentin/pergamos",
"Issues": "https://github.com/manuelblancovalentin/pergamos/issues",
"Repository": "https://github.com/manuelblancovalentin/pergamos"
},
"split_keywords": [
"html",
" markdown",
" reporting",
" automation",
" dynamic",
" syntax-highlighting"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9a8b8f34bbd46fcf9e306d903e080794168037fd337dc325ebde5ca82553d8ac",
"md5": "eafcc43a2a1f4b8d4a9a229eccfccb1c",
"sha256": "4aa13b958f86aaa3e8402a87c9348e26fc02eda66a60ee812ab414a144546fdc"
},
"downloads": -1,
"filename": "pergamos-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eafcc43a2a1f4b8d4a9a229eccfccb1c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 20033,
"upload_time": "2025-03-20T14:11:21",
"upload_time_iso_8601": "2025-03-20T14:11:21.521426Z",
"url": "https://files.pythonhosted.org/packages/9a/8b/8f34bbd46fcf9e306d903e080794168037fd337dc325ebde5ca82553d8ac/pergamos-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "58e329facac0e7eb7c473d3323e42b0944bc6942296bdbb17d845eb2248fdaa1",
"md5": "814554cc8c499e9e976a36d092818b7a",
"sha256": "0c825d66215020fb2bd36d31b979b62c7951a0f01e260d836ecb225979ce828a"
},
"downloads": -1,
"filename": "pergamos-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "814554cc8c499e9e976a36d092818b7a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 20322,
"upload_time": "2025-03-20T14:11:22",
"upload_time_iso_8601": "2025-03-20T14:11:22.808428Z",
"url": "https://files.pythonhosted.org/packages/58/e3/29facac0e7eb7c473d3323e42b0944bc6942296bdbb17d845eb2248fdaa1/pergamos-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-20 14:11:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "manuelblancovalentin",
"github_project": "pergamos",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pergamos"
}