Skip to main content

Render websites and videos inside Jupyter notebooks

Project description

kartik-webframe

Tests PyPI version Python 3.7+ License: MIT

A simple Python library to embed websites and YouTube videos in Jupyter notebooks.

📦 PyPI: https://pypi.org/project/kartik-webframe/

What's New (v0.2.0)

  • PDF and Google Doc embedding: render_pdf(url)
  • Grid layout for multiple embeds: render_grid(urls, ncols=2)
  • 100% test coverage, improved error handling, and more natural code style

Why?

When working in Jupyter notebooks, I got tired of switching between browser tabs to check documentation or watch tutorials. This library lets you view websites and videos right inside your notebook cells.

Installation

pip install kartik-webframe

Or install from source:

git clone https://github.com/KartikSuryavanshi/Webframe-Package.git
cd Webframe-Package
pip install -e .

Usage

Quick Start

# Install the package
# pip install kartik-webframe

# Import and use
from webframe import render_site, render_youtube_video

# Render a website
render_site("https://docs.python.org")

# Render a YouTube video
render_youtube_video("https://www.youtube.com/watch?v=dQw4w9WgXcQ")

Embed a Website

from webframe import render_site

render_site("https://docs.python.org")
render_site("https://github.com", width=1200, height=800)

Embed YouTube Videos

from webframe import render_youtube_video

render_youtube_video("https://www.youtube.com/watch?v=VIDEO_ID")

# Short URLs work too
render_youtube_video("https://youtu.be/VIDEO_ID")

# Custom size and autoplay
render_youtube_video("https://youtu.be/VIDEO_ID", width=1000, height=600, autoplay=True, mute=True)

Embed PDFs and Google Docs

from webframe import render_pdf

render_pdf("https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf")
render_pdf("https://docs.google.com/document/d/1A2B3C4D5E6F7G8H9I0J/edit")

Embed Multiple Items in a Grid

from webframe import render_grid

render_grid([
    "https://docs.python.org/3/",
    "https://www.wikipedia.org/",
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
], ncols=2)

How It Works

Uses IPython's display functionality to render IFrames for websites and HTML embeds for YouTube videos. Only works in Jupyter notebooks or Google Colab.

Requirements

  • Python 3.7+
  • IPython ≥ 7.0.0

Development

Running Tests

pytest

Building Package

python -m build

License

MIT - Copyright (c) 2026 Kartik Suryavanshi


Made with ❤️

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kartik_webframe-0.2.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kartik_webframe-0.2.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file kartik_webframe-0.2.0.tar.gz.

File metadata

  • Download URL: kartik_webframe-0.2.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.20

File hashes

Hashes for kartik_webframe-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8fe1c88d045f69ed32a85d7b7389b230d1aab5ea932ad1656bcb612ef1c02dce
MD5 b7bd4a3a810a1265d20f7860ea057d9b
BLAKE2b-256 ddbfcda3a7509f591231ac88c4ef97ecacb36ea304ccb418ee37745c40a3e3db

See more details on using hashes here.

File details

Details for the file kartik_webframe-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kartik_webframe-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aef7c088ecfa05f89a6f7ba36af9ca5a13715bd220fd328176a96592c8c5b1df
MD5 f28437bdabc9e6644491550db4fe25dc
BLAKE2b-256 25ff154991f9941d16fbfbc45d7c387308e3bacee624d935c428852b9d2db191

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page