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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lightpanda_py-0.2.7-py3-none-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: lightpanda_py-0.2.7-py3-none-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 33.5 MB
- Tags: Python 3, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f55c88a3c238e111314c440f076ff987f7cb7dca7cd319ea048aa3c1616fc851
|
|
| MD5 |
ecc9e4b37300efc2cfa61c31caedc20a
|
|
| BLAKE2b-256 |
745a60ee06e08ac2e14028a4824387e219faf0091d3732622535abbfbc471a89
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightpanda_py-0.2.7-py3-none-manylinux_2_35_x86_64.whl -
Subject digest:
f55c88a3c238e111314c440f076ff987f7cb7dca7cd319ea048aa3c1616fc851 - Sigstore transparency entry: 1185858791
- Sigstore integration time:
-
Permalink:
tclesius/lightpanda-py@79b42a7a87c6655bbd9281fd18b36611ad0ac00b -
Branch / Tag:
refs/tags/0.2.7 - Owner: https://github.com/tclesius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@79b42a7a87c6655bbd9281fd18b36611ad0ac00b -
Trigger Event:
release
-
Statement type:
File details
Details for the file lightpanda_py-0.2.7-py3-none-manylinux_2_35_aarch64.whl.
File metadata
- Download URL: lightpanda_py-0.2.7-py3-none-manylinux_2_35_aarch64.whl
- Upload date:
- Size: 33.2 MB
- Tags: Python 3, manylinux: glibc 2.35+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4fb20d64013ae3e57187580660092c55c4c7972b2c38d95d17dfb48074e70dc
|
|
| MD5 |
9bccec6715febd990e15a373ed8edee5
|
|
| BLAKE2b-256 |
910bf8f81904d59f6b65ff74a3546fa91d5a8bef0fd04d959c428d6ca887b1d7
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightpanda_py-0.2.7-py3-none-manylinux_2_35_aarch64.whl -
Subject digest:
a4fb20d64013ae3e57187580660092c55c4c7972b2c38d95d17dfb48074e70dc - Sigstore transparency entry: 1185858799
- Sigstore integration time:
-
Permalink:
tclesius/lightpanda-py@79b42a7a87c6655bbd9281fd18b36611ad0ac00b -
Branch / Tag:
refs/tags/0.2.7 - Owner: https://github.com/tclesius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@79b42a7a87c6655bbd9281fd18b36611ad0ac00b -
Trigger Event:
release
-
Statement type:
File details
Details for the file lightpanda_py-0.2.7-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: lightpanda_py-0.2.7-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 19.1 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb3905aa29a510782560d995472ddac7b1ad61232c89956bf2715163ac9c6631
|
|
| MD5 |
7b5124febb81ea23667937b26818965a
|
|
| BLAKE2b-256 |
54fdadfbf2807093a7a09167141ad9c34054c47e40bdd3eb6534cc9a83f42280
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightpanda_py-0.2.7-py3-none-macosx_11_0_arm64.whl -
Subject digest:
fb3905aa29a510782560d995472ddac7b1ad61232c89956bf2715163ac9c6631 - Sigstore transparency entry: 1185858795
- Sigstore integration time:
-
Permalink:
tclesius/lightpanda-py@79b42a7a87c6655bbd9281fd18b36611ad0ac00b -
Branch / Tag:
refs/tags/0.2.7 - Owner: https://github.com/tclesius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@79b42a7a87c6655bbd9281fd18b36611ad0ac00b -
Trigger Event:
release
-
Statement type: