scrapy-lightpanda
Scrape JavaScript-rendered sites with Scrapy + scrapy-playwright on Lightpanda, a headless browser built for web scraping and automation. In our benchmark it used about half the CPU and a third of the memory of headless Chromium.
It is a single PLAYWRIGHT_BROWSER_PROVIDER for scrapy-playwright. It starts lightpanda serve on a free local port when the first browser page is needed, connects over CDP, and stops the process when the crawl ends. Your spiders do not change.
Install
pip install scrapy-lightpanda
Install the Lightpanda binary and put it on your PATH (see Lightpanda install docs):
# macOS (Apple Silicon)
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/latest/download/lightpanda-aarch64-macos
chmod +x lightpanda && mv lightpanda ~/.local/bin/
Usage
# settings.py
DOWNLOAD_HANDLERS = {
"http": "scrapy_playwright.handler.ScrapyPlaywrightDownloadHandler",
"https": "scrapy_playwright.handler.ScrapyPlaywrightDownloadHandler",
}
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
PLAYWRIGHT_BROWSER_PROVIDER = "scrapy_lightpanda.LightpandaBrowserProvider"
Then request pages with meta={"playwright": True}, as with any scrapy-playwright spider.
Runnable spiders (JS pagination, infinite scroll, delayed content) are in examples/.
Options
PLAYWRIGHT_LAUNCH_OPTIONS is reused for the Lightpanda process:
| Key | Default | Meaning |
|---|---|---|
executable_path |
lightpanda on PATH |
Path to the binary |
args |
[] |
Extra lightpanda serve flags, e.g. ["--disable-features", "cors"] |
env |
{} |
Extra environment variables |
timeout |
10000 |
Milliseconds to wait for Lightpanda to start |
Any other key raises NotConfigured, because Lightpanda is not launched through Playwright.
Telemetry: Lightpanda sends usage telemetry by default. This provider sets LIGHTPANDA_DISABLE_TELEMETRY=true unless you set it yourself.
Benchmark
Measured on an Apple Silicon Mac (macOS 26, Python 3.14, Lightpanda 1.0.2, Chromium Headless Shell 151, Camoufox 156.0.1-beta.36), October 2026. CPU time is user + system time summed over every process involved, and stands in for energy use. Your numbers will differ; rerun the scripts in benchmarks/.
Full Scrapy crawl
The test spider crawls all 10 pages of quotes.toscrape.com/js (JavaScript-rendered). Median of 3 runs. Numbers cover the whole crawl: Scrapy, the Playwright driver and the browser.
| Browser | Complete items per run | CPU time (s) | Peak RAM (MB) | Wall time (s) |
|---|---|---|---|---|
| Lightpanda | 100/100/100 | 2.03 | 434 | 8.2 |
| Chromium headless | 100/100/100 | 3.69 | 1340 | 4.7 |
| Chromium headless, 1 page at a time | 100/100/100 | 3.86 | 695 | 13.3 |
python benchmarks/scrapy_bench.py 3
Lightpanda used about half the CPU and a third of the memory of Chromium. Chromium finished faster because it loads pages in parallel; with the same one-page limit, it was slower than Lightpanda.
Browser only
Each browser launched and loaded the page 5 times, driven by Playwright. Single run.
| Site | Lightpanda | Chromium headless | Camoufox |
|---|---|---|---|
| Hacker News | 0.27 s CPU · 55 MB | 0.76 s · 338 MB | 35.3 s · 2672 MB (4/5 loads) |
| Wikipedia article | 0.81 s · 90 MB | 1.70 s · 496 MB | 39.6 s · 2370 MB |
| BBC News | 4.41 s · 144 MB | 6.88 s · 758 MB | 42.4 s · 2510 MB |
python benchmarks/browsers_bench.py (needs camoufox)
Camoufox is an anti-detection Firefox and pays a large fixed startup cost. Use it only for sites that block other browsers.
Limitations
- One page at a time. A Lightpanda CDP connection holds a single browser context with a single page, so the provider sets
PLAYWRIGHT_MAX_PAGES_PER_CONTEXT = 1and browser requests queue instead of failing. Named contexts (playwright_contextmeta) other than the default are not supported. Plain (non-playwright) requests still run concurrently. - Lightpanda does not implement every Web API yet. Complex single-page apps may fail; fall back to the default provider for those.
- No screenshots (Lightpanda does not render pixels).
- No persistent contexts (
user_data_dir). - Lightpanda's text extraction can include text that a real browser would hide with CSS.
Tests
The tests crawl a real JavaScript-rendered site (quotes.toscrape.com/js) and check the scraped content, not just the item count.
pip install -e '.[test]'
pytest # needs network and the lightpanda binary
pytest -m "not network"
License
BSD-3-Clause, same as Scrapy and scrapy-playwright. Not affiliated with Lightpanda or the Scrapy project.
Metadata
Release files for scrapy-lightpanda 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapy_lightpanda-0.1.0.tar.gz | 10.0 kB | With provenance | Details for scrapy_lightpanda-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapy_lightpanda-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for scrapy_lightpanda-0.1.0-py3-none-any.whl |
Total release size: 16.2 kB
Release files / scrapy_lightpanda-0.1.0.tar.gz
| Download URL | scrapy_lightpanda-0.1.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61631248e7d5d493c27e7a1e61f92dd4bd9e855ad53bc9b1ccb9d8ab5f7efdec
|
|
BLAKE2b-256 checksum How to use checksums |
ffc86d5790f1aa7e71cedf219335a34a702a9fb0454015b4627f1d2b628b650c
|
| 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 29, 2026.
Transparency logRelease files / scrapy_lightpanda-0.1.0-py3-none-any.whl
| Download URL | scrapy_lightpanda-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11809cfd3e7766c0eda813a87a5c69c0511006e016efc2c713ba7222117e1943
|
|
BLAKE2b-256 checksum How to use checksums |
119299e4e6f95016bf78903bef4f3a1fe1b4eec86cb3f621cfcbb5a6d48a3d17
|
| 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 29, 2026.
Transparency logSecurity for scrapy-lightpanda 0.1.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
Both files in this release have been uploaded with provenance metadata.
Attestation for scrapy_lightpanda-0.1.0.tar.gz
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 29, 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.