Skip to main content

silkworm-rs

PyPI - Version Tests Docs PyPI Downloads

Silkworm is an async-first Python web scraping framework built on wreq and scraper-rs. It combines a small, typed Spider/Request/Response API with middleware, output pipelines, and production crawl controls.

Documentation · Getting started · Examples · API reference

Highlights

  • Async crawling with concurrency, priorities, request deduplication, timeouts, and deadlock-free queue backpressure.
  • Browser-impersonating HTTP through wreq, with redirects, proxies, cookies, retries, throttling, and robots.txt support.
  • Push-style typed callbacks using await self.emit(...) and await response.follow(...).
  • Async CSS/XPath selection and optional declarative Item, Text, and Attr extraction.
  • File, database, cloud, queue, and message-stream pipelines, with batch processing available on every built-in pipeline.
  • Production controls for failure policies, stop limits, pause/resume, caching, graceful shutdown, metrics, and structured crawl statistics.
  • Optional CDP, Servo, and OnionLink clients for rendered or onion-service pages.

Install

Silkworm supports Python 3.11–3.15, including PyPy 3.11 and PyPy 3.12 (beta) on Linux x86-64.

pip install silkworm-rs

With uv:

uv add silkworm-rs

Integrations are installed as optional extras. For example:

pip install "silkworm-rs[rsloop,polars]"

See Getting Started for the complete extras and Python-version compatibility table.

Quick start

from silkworm import HTMLResponse, Response, Spider, run_spider
from silkworm.pipelines import JsonLinesPipeline


class QuotesSpider(Spider):
    name = "quotes"
    start_urls = ("https://quotes.toscrape.com/",)

    async def parse(self, response: Response) -> None:
        if not isinstance(response, HTMLResponse):
            return

        for quote in await response.select(".quote"):
            text = await quote.select_first(".text")
            author = await quote.select_first(".author")
            if text is not None and author is not None:
                await self.emit({"text": text.text, "author": author.text})

        next_link = await response.select_first("li.next > a")
        if next_link is not None and (href := next_link.attr("href")):
            await response.follow(href, callback=self.parse)


run_spider(
    QuotesSpider,
    item_pipelines=[JsonLinesPipeline("data/quotes.jl")],
)

Callbacks return None; they report items and requests with emit and follow, which apply backpressure while the callback is running.

Command line

Run a spider module or test its parser without writing a runner script:

silkworm crawl examples/quotes_spider.py -o data/quotes.jl -s max_items=100
silkworm parse https://quotes.toscrape.com/ --spider examples/quotes_spider.py

See the CLI reference for configuration, output formats, and exit codes.

Documentation

Topic Guide
Installation, extras, and first spider Getting Started
Spider, request, response, selectors, and callbacks Core Concepts
Declarative item extraction Declarative Extraction
Engine, HTTP, CDP, Servo, and OnionLink Engine and HTTP Client
Request and response middleware Middlewares
Output destinations and batch processing Pipelines
asyncio, rsloop, uvloop, winloop, and Trio Runners
Resumable and observable crawls Production Crawling
Version changes Migration Guide
Constraints and workarounds Limitations

Development

uv venv --python python3.13
uv sync --group dev
just fmt && just lint && just typecheck && just test

See the development workflow and open an issue or pull request on GitHub.

Acknowledgements

Silkworm builds on wreq, scraper-rs, fast-h2m, turboxml, and optional integrations including OnionLink and Servo. Thank you to their maintainers and contributors.

License

MIT. See LICENSE.

Metadata

Release files for silkworm-rs 0.15.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for silkworm-rs 0.15.0
File Size Uploaded
silkworm_rs-0.15.0.tar.gz 551.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for silkworm-rs 0.15.0
File Interpreter ABI Platform
silkworm_rs-0.15.0-py3-none-any.whl Python 3 none any Details

Total release size: 743.2 kB

Release files / silkworm_rs-0.15.0.tar.gz

Download URL silkworm_rs-0.15.0.tar.gz
Size 551.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e23754046e8b818b9319836791d6ac36126e855dc994b433fb19b133b09e763c
BLAKE2b-256 checksum
How to use checksums
d1ad9f60a4873514840a4b2740f6335455af499cfbe1fb4d867c4b0697707400
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 6, 2026.

Transparency log

Release files / silkworm_rs-0.15.0-py3-none-any.whl

Download URL silkworm_rs-0.15.0-py3-none-any.whl
Size 191.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
206bd945f1206fd8b74c089640293a4ee05a9bb7499552be110b97ef00356f30
BLAKE2b-256 checksum
How to use checksums
56ab2ccee52dd817bda13cdcc03e0ace5d6b219770f5a53c2dece283a4be24ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.15.0 This release

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.12.0

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.41

2 release files

0.2.39

2 release files

0.2.38

2 release files

0.2.36

2 release files

0.2.34

2 release files

0.2.33

2 release files

0.2.32

2 release files

0.2.31

2 release files

0.2.30

2 release files

0.2.28

2 release files

0.2.27

2 release files

0.2.26

2 release files

0.2.25

2 release files

0.2.24

2 release files

0.2.23

2 release files

0.2.22

2 release files

0.2.21

2 release files

0.2.20

2 release files

0.2.19

2 release files

0.2.18

2 release files

0.2.17

2 release files

0.2.16

2 release files

0.2.15

2 release files

0.2.14

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page