Skip to main content

Python wrapper for Lightpanda browser with CDP server and Playwright integration for lightweight web scraping and automation

Project description

lightpanda-py

Embedded Lightpanda for Python, a fast headless browser for AI agents and web automation.

Installation

pip install lightpanda-py
# or
uv add lightpanda-py

No extra setup — the Lightpanda binary is bundled in the package.

Usage

Fetch

Spin up an ephemeral browser to fetch a page:

import lightpanda

response = lightpanda.fetch("https://example.com")
print(response.text)

# JSON APIs
response = lightpanda.fetch("https://httpbin.org/ip")
data = response.json()

# Markdown output
response = lightpanda.fetch("https://example.com", dump="markdown")

# Strip JS/CSS from output
response = lightpanda.fetch("https://example.com", strip_mode="js,css")

# Wait for network idle before dump
response = lightpanda.fetch("https://example.com", wait_until="networkidle")

CDP Server

Start a CDP server to use with Playwright, Puppeteer, or any CDP client:

import lightpanda

proc = lightpanda.serve(host="127.0.0.1", port=9222)
# 🐼 Running Lightpanda's CDP server... { pid: 12345 }

# Connect with your favorite CDP client...

proc.kill()

With Playwright:

import lightpanda
from playwright.sync_api import sync_playwright

proc = lightpanda.serve()

with sync_playwright() as p:
    browser = p.chromium.connect_over_cdp("http://127.0.0.1:9222")
    page = browser.new_page()
    page.goto("https://example.com")
    print(page.content())
    browser.close()

proc.kill()

MCP Server

Start a Model Context Protocol server over stdio:

import lightpanda, json

proc = lightpanda.mcp()

proc.stdin.write(b'{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}\n')
proc.stdin.flush()
print(json.loads(proc.stdout.readline()))  # list of available tools

proc.kill()

Version

import lightpanda

print(lightpanda.version())

License

MIT

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

lightpanda_py-0.2.7-py3-none-manylinux_2_35_x86_64.whl (33.5 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

lightpanda_py-0.2.7-py3-none-manylinux_2_35_aarch64.whl (33.2 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ ARM64

lightpanda_py-0.2.7-py3-none-macosx_11_0_arm64.whl (19.1 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file lightpanda_py-0.2.7-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for lightpanda_py-0.2.7-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 f55c88a3c238e111314c440f076ff987f7cb7dca7cd319ea048aa3c1616fc851
MD5 ecc9e4b37300efc2cfa61c31caedc20a
BLAKE2b-256 745a60ee06e08ac2e14028a4824387e219faf0091d3732622535abbfbc471a89

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightpanda_py-0.2.7-py3-none-manylinux_2_35_x86_64.whl:

Publisher: publish.yml on tclesius/lightpanda-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightpanda_py-0.2.7-py3-none-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for lightpanda_py-0.2.7-py3-none-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 a4fb20d64013ae3e57187580660092c55c4c7972b2c38d95d17dfb48074e70dc
MD5 9bccec6715febd990e15a373ed8edee5
BLAKE2b-256 910bf8f81904d59f6b65ff74a3546fa91d5a8bef0fd04d959c428d6ca887b1d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightpanda_py-0.2.7-py3-none-manylinux_2_35_aarch64.whl:

Publisher: publish.yml on tclesius/lightpanda-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightpanda_py-0.2.7-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightpanda_py-0.2.7-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb3905aa29a510782560d995472ddac7b1ad61232c89956bf2715163ac9c6631
MD5 7b5124febb81ea23667937b26818965a
BLAKE2b-256 54fdadfbf2807093a7a09167141ad9c34054c47e40bdd3eb6534cc9a83f42280

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightpanda_py-0.2.7-py3-none-macosx_11_0_arm64.whl:

Publisher: publish.yml on tclesius/lightpanda-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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