revealpy


Namerevealpy JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/davyssonlucas/revealpy
SummaryRevealPy is a Python library for creating beautiful and interactive presentations programmatically. It provides a simple yet powerful API to create presentations with various content types and layouts
upload_time2025-02-09 00:23:03
maintainerNone
docs_urlNone
authorDavysson Santana
requires_python>=3.12
licenseMIT
keywords presentations python-pptx slides interactive presentations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RevealPy Documentation

RevealPy is a Python library for creating beautiful and interactive presentations programmatically. It provides a simple yet powerful API to create presentations with various content types and layouts.

## Installation

```bash
pip install revealpy
```

## Quick Start

```python
from revealpy import Presentation
from revealpy import LayoutType

# Create a new presentation
presentation = Presentation(theme="black", transition="fade")

# Create a title slide
slide = presentation.create_slide("My First Presentation")
slide.add_text("Created with RevealPy")

# Export the presentation
presentation.export("my_presentation.html")
```

## Core Components

### Presentation Class

The main class for creating presentations.

```python
presentation = Presentation(
    theme="black",     # Presentation theme
    transition="fade"  # Slide transition effect
)
```

Methods:
- `create_slide(title: str) -> SlideBuilder`: Creates a new slide
- `render() -> str`: Renders the presentation as HTML
- `export(filename: str)`: Exports the presentation to HTML
- `export_pptx(filename: str)`: Exports the presentation to PowerPoint format

### SlideBuilder Class

Used to build individual slides with various content types and layouts.

#### Basic Methods

```python
slide = presentation.create_slide("Slide Title")

# Add different types of content
slide.add_text("Simple text content")
slide.add_bullet_points(["Point 1", "Point 2", "Point 3"])
slide.add_numbered_list(["First item", "Second item"])
slide.add_code("print('Hello World')", language="python")
```

#### Layout Configuration

```python
slide.set_layout(LayoutType.TWO_COLUMNS)
slide.configure_layout(
    title_size="h2",
    content_align="left",
    background="#f0f0f0",
    extra_classes=["custom-class"]
)
```

## Available Layout Types

- `TITLE`: Only title
- `TITLE_CONTENT`: Title and content
- `TWO_COLUMNS`: Title and two columns
- `TITLE_TWO_CONTENT`: Title and content in two rows
- `COMPARISON`: Title and two columns with headers
- `SECTION`: Big title for section breaks
- `BLANK`: Blank slide for custom content
- `IMAGE_WITH_CAPTION`: Centered image with caption
- `QUOTE`: Quote with optional attribution

## Content Types

### Text Content
```python
slide.add_text("Regular paragraph text")
```

### Lists
```python
slide.add_bullet_points([
    "First bullet point",
    "Second bullet point",
    "Third bullet point"
])

slide.add_numbered_list([
    "First numbered item",
    "Second numbered item"
])
```

### Code Blocks
```python
slide.add_code(
    code="def hello_world():\n    print('Hello, World!')",
    language="python"
)
```

### Images
```python
slide.add_image(
    url="path/to/image.jpg",
    caption="Optional image caption"
)
```

### Equations
```python
slide.add_equation(
    equation="E = mc^2",
    description={
        "E": "Energy",
        "m": "Mass",
        "c": "Speed of light"
    }
)
```

### Tables
```python
slide.add_table(
    headers=["Name", "Age", "City"],
    rows=[
        ["John", "25", "New York"],
        ["Alice", "30", "London"]
    ]
)
```

### Diagrams
```python
slide.add_diagram("""
    graph TD
    A[Start] --> B[Process]
    B --> C[End]
""")
```

### Media
```python
slide.add_media(
    url="path/to/video.mp4",
    media_type="video"  # or "audio"
)
```

### Markdown
```python
slide.add_markdown("""
# Markdown Title
- Point 1
- Point 2

```python
print('Code block')
```
""")
```

## Working with Two-Column Layouts

When using `TWO_COLUMNS` or `COMPARISON` layouts:

```python
slide = presentation.create_slide("Two Columns Example")
slide.set_layout(LayoutType.TWO_COLUMNS)

# Add content to left column
slide.add_to_column(0, Content(ContentType.TEXT, "Left column content"))

# Add content to right column
slide.add_to_column(1, Content(ContentType.TEXT, "Right column content"))
```

For comparison layouts:
```python
slide = presentation.create_slide("Comparison")
slide.set_layout(LayoutType.COMPARISON)
slide.add_comparison("Before", "After")
```

## Export Options

### HTML Export
```python
# Export to HTML
presentation.export("presentation.html")
```

### PowerPoint Export
```python
# Export to PowerPoint
presentation.export_pptx("presentation.pptx")
```

## Best Practices

1. **Consistent Layouts**: Use consistent layouts throughout your presentation for better visual coherence.
2. **Content Organization**: Break down complex content into multiple slides.
3. **Visual Hierarchy**: Use different title sizes and layouts to create clear visual hierarchy.
4. **Media Usage**: Optimize images and media files before adding them to the presentation.
5. **Transitions**: Use subtle transitions for professional presentations.

## Examples

### Creating a Complete Presentation

```python
from revealpy import Presentation
from revealpy import LayoutType

# Create presentation
pres = Presentation(theme="black")

# Title slide
title_slide = pres.create_slide("RevealPy Presentation")
title_slide.add_text("Created with Python")

# Content slide
content_slide = pres.create_slide("Key Features")
content_slide.add_bullet_points([
    "Easy to use API",
    "Multiple layout options",
    "Support for various content types",
    "Export to HTML and PowerPoint"
])

# Two-column slide
compare_slide = pres.create_slide("Comparison")
compare_slide.set_layout(LayoutType.COMPARISON)
compare_slide.add_comparison("Traditional", "RevealPy")
compare_slide.add_to_column(0, Content(ContentType.TEXT, "Manual creation"))
compare_slide.add_to_column(1, Content(ContentType.TEXT, "Programmatic creation"))

# Export
pres.export("example_presentation.html")
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/davyssonlucas/revealpy",
    "name": "revealpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "presentations, python-pptx, slides, interactive presentations",
    "author": "Davysson Santana",
    "author_email": "davyssonlucas@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f8/a9/fbdbb1fd6b0d7d3c383014a03b5ea34ce9bac9faa628b7ad2e2db0826b59/revealpy-0.1.5.tar.gz",
    "platform": null,
    "description": "# RevealPy Documentation\n\nRevealPy is a Python library for creating beautiful and interactive presentations programmatically. It provides a simple yet powerful API to create presentations with various content types and layouts.\n\n## Installation\n\n```bash\npip install revealpy\n```\n\n## Quick Start\n\n```python\nfrom revealpy import Presentation\nfrom revealpy import LayoutType\n\n# Create a new presentation\npresentation = Presentation(theme=\"black\", transition=\"fade\")\n\n# Create a title slide\nslide = presentation.create_slide(\"My First Presentation\")\nslide.add_text(\"Created with RevealPy\")\n\n# Export the presentation\npresentation.export(\"my_presentation.html\")\n```\n\n## Core Components\n\n### Presentation Class\n\nThe main class for creating presentations.\n\n```python\npresentation = Presentation(\n    theme=\"black\",     # Presentation theme\n    transition=\"fade\"  # Slide transition effect\n)\n```\n\nMethods:\n- `create_slide(title: str) -> SlideBuilder`: Creates a new slide\n- `render() -> str`: Renders the presentation as HTML\n- `export(filename: str)`: Exports the presentation to HTML\n- `export_pptx(filename: str)`: Exports the presentation to PowerPoint format\n\n### SlideBuilder Class\n\nUsed to build individual slides with various content types and layouts.\n\n#### Basic Methods\n\n```python\nslide = presentation.create_slide(\"Slide Title\")\n\n# Add different types of content\nslide.add_text(\"Simple text content\")\nslide.add_bullet_points([\"Point 1\", \"Point 2\", \"Point 3\"])\nslide.add_numbered_list([\"First item\", \"Second item\"])\nslide.add_code(\"print('Hello World')\", language=\"python\")\n```\n\n#### Layout Configuration\n\n```python\nslide.set_layout(LayoutType.TWO_COLUMNS)\nslide.configure_layout(\n    title_size=\"h2\",\n    content_align=\"left\",\n    background=\"#f0f0f0\",\n    extra_classes=[\"custom-class\"]\n)\n```\n\n## Available Layout Types\n\n- `TITLE`: Only title\n- `TITLE_CONTENT`: Title and content\n- `TWO_COLUMNS`: Title and two columns\n- `TITLE_TWO_CONTENT`: Title and content in two rows\n- `COMPARISON`: Title and two columns with headers\n- `SECTION`: Big title for section breaks\n- `BLANK`: Blank slide for custom content\n- `IMAGE_WITH_CAPTION`: Centered image with caption\n- `QUOTE`: Quote with optional attribution\n\n## Content Types\n\n### Text Content\n```python\nslide.add_text(\"Regular paragraph text\")\n```\n\n### Lists\n```python\nslide.add_bullet_points([\n    \"First bullet point\",\n    \"Second bullet point\",\n    \"Third bullet point\"\n])\n\nslide.add_numbered_list([\n    \"First numbered item\",\n    \"Second numbered item\"\n])\n```\n\n### Code Blocks\n```python\nslide.add_code(\n    code=\"def hello_world():\\n    print('Hello, World!')\",\n    language=\"python\"\n)\n```\n\n### Images\n```python\nslide.add_image(\n    url=\"path/to/image.jpg\",\n    caption=\"Optional image caption\"\n)\n```\n\n### Equations\n```python\nslide.add_equation(\n    equation=\"E = mc^2\",\n    description={\n        \"E\": \"Energy\",\n        \"m\": \"Mass\",\n        \"c\": \"Speed of light\"\n    }\n)\n```\n\n### Tables\n```python\nslide.add_table(\n    headers=[\"Name\", \"Age\", \"City\"],\n    rows=[\n        [\"John\", \"25\", \"New York\"],\n        [\"Alice\", \"30\", \"London\"]\n    ]\n)\n```\n\n### Diagrams\n```python\nslide.add_diagram(\"\"\"\n    graph TD\n    A[Start] --> B[Process]\n    B --> C[End]\n\"\"\")\n```\n\n### Media\n```python\nslide.add_media(\n    url=\"path/to/video.mp4\",\n    media_type=\"video\"  # or \"audio\"\n)\n```\n\n### Markdown\n```python\nslide.add_markdown(\"\"\"\n# Markdown Title\n- Point 1\n- Point 2\n\n```python\nprint('Code block')\n```\n\"\"\")\n```\n\n## Working with Two-Column Layouts\n\nWhen using `TWO_COLUMNS` or `COMPARISON` layouts:\n\n```python\nslide = presentation.create_slide(\"Two Columns Example\")\nslide.set_layout(LayoutType.TWO_COLUMNS)\n\n# Add content to left column\nslide.add_to_column(0, Content(ContentType.TEXT, \"Left column content\"))\n\n# Add content to right column\nslide.add_to_column(1, Content(ContentType.TEXT, \"Right column content\"))\n```\n\nFor comparison layouts:\n```python\nslide = presentation.create_slide(\"Comparison\")\nslide.set_layout(LayoutType.COMPARISON)\nslide.add_comparison(\"Before\", \"After\")\n```\n\n## Export Options\n\n### HTML Export\n```python\n# Export to HTML\npresentation.export(\"presentation.html\")\n```\n\n### PowerPoint Export\n```python\n# Export to PowerPoint\npresentation.export_pptx(\"presentation.pptx\")\n```\n\n## Best Practices\n\n1. **Consistent Layouts**: Use consistent layouts throughout your presentation for better visual coherence.\n2. **Content Organization**: Break down complex content into multiple slides.\n3. **Visual Hierarchy**: Use different title sizes and layouts to create clear visual hierarchy.\n4. **Media Usage**: Optimize images and media files before adding them to the presentation.\n5. **Transitions**: Use subtle transitions for professional presentations.\n\n## Examples\n\n### Creating a Complete Presentation\n\n```python\nfrom revealpy import Presentation\nfrom revealpy import LayoutType\n\n# Create presentation\npres = Presentation(theme=\"black\")\n\n# Title slide\ntitle_slide = pres.create_slide(\"RevealPy Presentation\")\ntitle_slide.add_text(\"Created with Python\")\n\n# Content slide\ncontent_slide = pres.create_slide(\"Key Features\")\ncontent_slide.add_bullet_points([\n    \"Easy to use API\",\n    \"Multiple layout options\",\n    \"Support for various content types\",\n    \"Export to HTML and PowerPoint\"\n])\n\n# Two-column slide\ncompare_slide = pres.create_slide(\"Comparison\")\ncompare_slide.set_layout(LayoutType.COMPARISON)\ncompare_slide.add_comparison(\"Traditional\", \"RevealPy\")\ncompare_slide.add_to_column(0, Content(ContentType.TEXT, \"Manual creation\"))\ncompare_slide.add_to_column(1, Content(ContentType.TEXT, \"Programmatic creation\"))\n\n# Export\npres.export(\"example_presentation.html\")\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "RevealPy is a Python library for creating beautiful and interactive presentations programmatically. It provides a simple yet powerful API to create presentations with various content types and layouts",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/davyssonlucas/revealpy",
        "Repository": "https://github.com/davyssonlucas/revealpy"
    },
    "split_keywords": [
        "presentations",
        " python-pptx",
        " slides",
        " interactive presentations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "daba9ada3adda2362d5c3897c5950d7543f6eb10524dbb326f69607bd42b94dd",
                "md5": "13f8af487a4cf1679d5555848d759c8b",
                "sha256": "382e8995a13a0482b9d2b3b37ffc2847d475a8b5eb3c30923ae32fbc3fac9373"
            },
            "downloads": -1,
            "filename": "revealpy-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "13f8af487a4cf1679d5555848d759c8b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 15097,
            "upload_time": "2025-02-09T00:23:02",
            "upload_time_iso_8601": "2025-02-09T00:23:02.284520Z",
            "url": "https://files.pythonhosted.org/packages/da/ba/9ada3adda2362d5c3897c5950d7543f6eb10524dbb326f69607bd42b94dd/revealpy-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f8a9fbdbb1fd6b0d7d3c383014a03b5ea34ce9bac9faa628b7ad2e2db0826b59",
                "md5": "bf6e63f07b16ed3f251b75146d5cc613",
                "sha256": "301399c1469c1e04ee1b5b7a5c576a5f0f96712c590a73e12b936b8291f670ff"
            },
            "downloads": -1,
            "filename": "revealpy-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "bf6e63f07b16ed3f251b75146d5cc613",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 13237,
            "upload_time": "2025-02-09T00:23:03",
            "upload_time_iso_8601": "2025-02-09T00:23:03.967090Z",
            "url": "https://files.pythonhosted.org/packages/f8/a9/fbdbb1fd6b0d7d3c383014a03b5ea34ce9bac9faa628b7ad2e2db0826b59/revealpy-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-09 00:23:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "davyssonlucas",
    "github_project": "revealpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "revealpy"
}
        
Elapsed time: 0.82235s