lightpanda-py
Lightpanda for Python, a fast headless browser for AI agents and web automation. Zero dependencies, browser included. The whole thing is one file of about 300 lines: fetch, serve and mcp are the CLI commands, and keyword arguments are the CLI flags.
Installation
pip install lightpanda-py
# or
uv add lightpanda-py
Example usage
import lightpanda
response = lightpanda.fetch("https://example.com", dump="markdown")
print(response.text)
Output formats
import lightpanda
html = lightpanda.fetch("https://example.com").text
markdown = lightpanda.fetch("https://example.com", dump="markdown").text
data = lightpanda.fetch("https://httpbin.org/ip").json()
# JSON-LD, OpenGraph, Twitter card and meta tags
meta = lightpanda.fetch("https://example.com", dump="structured_data").json()
# Text-only rendering as PNG or PDF
png = lightpanda.fetch("https://example.com", dump="png").content
Waiting and stripping
import lightpanda
# Wait for network idle, or for an element to appear
lightpanda.fetch("https://example.com", wait_until="networkidle")
lightpanda.fetch("https://example.com", wait_selector="h1", dump_selector="h1")
# Drop scripts and styles, or keep only the main content
lightpanda.fetch("https://example.com", strip_mode=["js", "css"])
lightpanda.fetch("https://example.com", dump="markdown", strip_mode="clutter")
Status and multiple URLs
json=True adds the HTTP status, headers and page diagnostics:
import lightpanda
status = lightpanda.fetch("https://example.com", dump="markdown", json=True).json()
print(status["http_status"], status["content"])
results = lightpanda.fetch(["https://example.com", "https://example.org"], dump="markdown").json()
for result in results["results"]:
print(result["url"], result["http_status"])
Any CLI flag
Underscores become dashes, True adds a bare flag, and lists repeat the flag:
import lightpanda
response = lightpanda.fetch(
"https://example.com",
http_header=["Authorization: Bearer token"], # --http-header ...
user_agent_suffix="my-crawler", # --user-agent-suffix my-crawler
obey_robots=True, # --obey-robots
cookie_jar="cookies.json", # --cookie-jar cookies.json
)
Errors raise lightpanda.LightpandaError with returncode, stdout and stderr. Pass fail_on_http_error=True to also raise on HTTP 4xx/5xx.
Using Playwright or Puppeteer
import lightpanda
from playwright.sync_api import sync_playwright
proc = lightpanda.serve(host="127.0.0.1", port=9222)
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()
import lightpanda
# Write logs to files
proc = lightpanda.serve(stdout=open("lightpanda.out.log", "w"), stderr=open("lightpanda.err.log", "w"))
# CDP on / and WebDriver BiDi on /session, same port
proc = lightpanda.serve(protocol=["cdp", "webdriver"])
# CDP over a Unix-domain socket instead of TCP
proc = lightpanda.serve(unix_socket="/tmp/lightpanda.sock")
Running an MCP server
import json
import lightpanda
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()
# Or over HTTP, clients POST JSON-RPC to /mcp
proc = lightpanda.mcp(port=8080)
Running tests
The bundled browser version is pinned in .browser-version. Download it for your platform, then run pytest:
scripts/get-browser lightpanda-x86_64-linux
uv run pytest
Available platforms:
lightpanda-aarch64-macos- macOS arm64 (default)lightpanda-x86_64-macos- macOS x86_64lightpanda-aarch64-linux- Linux arm64lightpanda-x86_64-linux- Linux x86_64
License
MIT
Metadata
Release files for lightpanda-py 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| lightpanda_py-0.3.0-py3-none-manylinux_2_38_aarch64.whl | Python 3 | none | Linux glibc 2.38+ ARM64 | Details |
| lightpanda_py-0.3.0-py3-none-manylinux_2_35_x86_64.whl | Python 3 | none | Linux glibc 2.35+ x86-64 | Details |
| lightpanda_py-0.3.0-py3-none-macosx_14_0_x86_64.whl | Python 3 | none | macOS 14.0+ x86-64 | Details |
| lightpanda_py-0.3.0-py3-none-macosx_14_0_arm64.whl | Python 3 | none | macOS 14.0+ ARM64 | Details |
Total release size: 114.8 MB
Release files / lightpanda_py-0.3.0-py3-none-manylinux_2_38_aarch64.whl
| Download URL | lightpanda_py-0.3.0-py3-none-manylinux_2_38_aarch64.whl |
|---|---|
| Size | 27.2 MB |
| Tags | Linux glibc 2.38+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
13a856038a2c9cca65940d525a9794bf11d1e86dc8abfb5fda08708720fe5760
|
|
BLAKE2b-256 checksum How to use checksums |
c449dedb78979ad221668d6b4c2817c415735b62c74cb0447d58cb19bd13fcf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / lightpanda_py-0.3.0-py3-none-manylinux_2_35_x86_64.whl
| Download URL | lightpanda_py-0.3.0-py3-none-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 28.6 MB |
| Tags | Linux glibc 2.35+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
b0e1025a0ac9b36de2434cf9a80db2be07febd1577884320b217ff942470de00
|
|
BLAKE2b-256 checksum How to use checksums |
452543dec7d1cd7b6a6b882e770b5604e44062d6b7a8b4740756d0c55da11dd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / lightpanda_py-0.3.0-py3-none-macosx_14_0_x86_64.whl
| Download URL | lightpanda_py-0.3.0-py3-none-macosx_14_0_x86_64.whl |
|---|---|
| Size | 30.4 MB |
| Tags | Python 3 macOS 14.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
bc3a2cb93662b89812525d05ba83dee02f0f2d218e8eba02663d0cf18df26aed
|
|
BLAKE2b-256 checksum How to use checksums |
84556919de9b712d4f1212844b29891866634e769bcecc55e30ecb1f9df52339
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / lightpanda_py-0.3.0-py3-none-macosx_14_0_arm64.whl
| Download URL | lightpanda_py-0.3.0-py3-none-macosx_14_0_arm64.whl |
|---|---|
| Size | 28.6 MB |
| Tags | Python 3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
90b5fb7b998c28ace25edc241753c7dd4b20322c672720a4fe470700f9465410
|
|
BLAKE2b-256 checksum How to use checksums |
36772b4c689aa792e38098bcbcb052e3b0f5e73f807b86199cd8b3d903a7f685
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logSecurity for lightpanda-py 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for lightpanda_py-0.3.0-py3-none-manylinux_2_38_aarch64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.