Skip to main content

mudfish

Python bindings for Mudfish Crawler, a Rust-native web crawling and intelligence engine.

This package wraps the Rust crawl engine directly (via PyO3) — there is no subprocess or network hop to a separate server. It exposes a typed, Pythonic API over the engine; the Rust project itself is at an early stage (see the main repo's ROADMAP_HONEST.md for full status).

Install

pip install mudfish

Usage

import mudfish

result = mudfish.crawl("https://example.com", depth=2, concurrency=30)

print(result.stats.urls_fetched, result.stats.duration_secs)
for page in result:                          # CrawlResult is iterable over its pages
    print(page.status_code, page.url, page.title)

crawl() blocks until the crawl finishes (or hits max_urls / max_duration_secs) and returns a typed CrawlResult:

Object Fields
CrawlResult crawl_id, pages: list[Page], errors: list[CrawlError], stats: CrawlStats — iterable over pages, len() is the page count, plus ok_pages
Page url, final_url, status_code, content_type, depth, metadata: PageMetadata, links: list[Link], body_bytes, fetched_via: FetchMethod — helpers title, is_ok
PageMetadata title, meta_description, canonical
Link url, anchor_text, rel
CrawlError url, message
CrawlStats urls_discovered, urls_fetched, urls_skipped, errors, bytes_downloaded, duration_ms — helpers duration_secs, throughput_per_sec
FetchMethod FetchMethod.HTTP ("Http") / FetchMethod.BROWSER ("Browser")

Every typed object also supports the raw engine dict shape (result["stats"], page["status_code"], page.to_dict()), so code written against earlier versions keeps working. If you only want the raw dict, use mudfish.crawl_dict(...).

Async

crawl_async() runs the blocking engine on a worker thread, so it composes with asyncio and several crawls can run concurrently:

import asyncio
import mudfish

async def main() -> None:
    results = await asyncio.gather(
        mudfish.crawl_async("https://a.example"),
        mudfish.crawl_async("https://b.example"),
    )
    for result in results:
        print(result.stats.urls_fetched)

asyncio.run(main())

Reusable configuration

crawler = mudfish.Crawler(depth=1, concurrency=10)
home = crawler.crawl("https://example.com")
blog = await crawler.crawl_async("https://example.com/blog")

Errors

try:
    mudfish.crawl("not-a-url")
except mudfish.InvalidURLError:      # also a ValueError
    ...
except mudfish.CrawlFailedError:     # also a RuntimeError
    ...

Everything derives from mudfish.MudfishError.

Options

All keyword-only, matching the CLI's flags (also available as the CrawlOptions dataclass):

Parameter Default Meaning
depth 3 Max link-following depth
concurrency 50 Max requests in flight, whole crawl
per_host_concurrency 4 Max requests in flight per host
same_domain True Restrict crawl to the seed's resolved domain
max_urls 10000 Hard cap on URLs fetched
max_duration_secs None Optional wall-clock budget
timeout_secs 30 Per-request timeout
request_delay_ms 0 Min delay between requests to the same host
max_response_bytes 20 MB Per-response size cap
respect_robots True Honor robots.txt
allow_private_networks False Permit loopback/private targets (internal use only)
render_js False Re-render JS-dependent pages in headless Chrome (needs Chrome on the host; much slower)
render_settle_ms 2000 When render_js is on, settle time before capturing a rendered page
proxies () Proxy URLs to route requests through; supply several to rotate a pool
proxy_rotate_after 50 Requests through a proxy before rotating to the next
chrome_path None Explicit Chrome/chrome-headless-shell binary for render_js; defaults to the bundled binary, then host autodetection

Limitations

  • Chrome is not bundled in the PyPI wheel. With render_js=True the engine drives a headless Chrome that must already be installed on the host; if it cannot be launched, the crawl logs a warning and falls back to static HTML. A separate bundled wheel that ships a chrome-headless-shell (so render_js works with no host install) is attached to the GitHub release for each version — look for the asset named mudfish-<version>+chrome-*.whl.
  • Single-platform wheels initially. Built and published from the maintainer's machine, not a cross-platform CI matrix yet — check PyPI for which platforms have wheels; others will need a Rust toolchain to build from source.

Bundled-Chrome builds

To build the bundled wheel locally:

python3 tools/fetch_chrome_headless_shell.py   # pins + downloads chrome-headless-shell
cd crates/python && maturin build --release

The binary is fetched (never committed) into python/mudfish/_chrome/, the wheel picks it up automatically, and at runtime mudfish.bundled_chrome_path() returns it (overridable with MUDFISH_CHROME).

License

Apache-2.0.

Metadata

Release files for mudfish 0.2.3

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

Source distribution (sdist)

Source distribution for mudfish 0.2.3
File Size Uploaded
mudfish-0.2.3.tar.gz 94.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for mudfish 0.2.3
File
mudfish-0.2.3-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details
mudfish-0.2.3-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
mudfish-0.2.3-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
mudfish-0.2.3-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
mudfish-0.2.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
mudfish-0.2.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
mudfish-0.2.3-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
mudfish-0.2.3-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 41.4 MB

Release files / mudfish-0.2.3.tar.gz

Download URL mudfish-0.2.3.tar.gz
Size 94.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2dee6476a096c05d4bd7fd5a4b1753f2ed2639a550e1827653c404d39bddd7fd
BLAKE2b-256 checksum
How to use checksums
580c9586a8cc9757d850caf7ef346f9f45e1234f850e9ccef75b725fdc317c7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / mudfish-0.2.3-cp39-abi3-win_arm64.whl

Download URL mudfish-0.2.3-cp39-abi3-win_arm64.whl
Size 4.8 MB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
965ed5a8f4f954a00b20c834537f691770fa93182965297846628ad1d9bee732
BLAKE2b-256 checksum
How to use checksums
827555255db76248cd613b2f16fcd6168b0dccdc3c79c47db4220c434d1d30e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / mudfish-0.2.3-cp39-abi3-win_amd64.whl

Download URL mudfish-0.2.3-cp39-abi3-win_amd64.whl
Size 5.0 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
dcb3bf0b37ccf524b0c63af1bdf17c23e146db17d13f96ed78f3ecc199d11ad7
BLAKE2b-256 checksum
How to use checksums
cf7160a559293e0c2b6fd960386f806e794f0c211b7bc7cda2aebf31c59d5fed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / mudfish-0.2.3-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL mudfish-0.2.3-cp39-abi3-musllinux_1_2_x86_64.whl
Size 5.6 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
f633c35c60da9c9e3c6d42ce5b702a6e5900c82582251f2cd2b683be33684326
BLAKE2b-256 checksum
How to use checksums
ad73669606ab49e1ef9dfb5e1c5da96d3a88278def521ab762e2510ee155299d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / mudfish-0.2.3-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL mudfish-0.2.3-cp39-abi3-musllinux_1_2_aarch64.whl
Size 5.3 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
d43c5f544e7e04cc14e365fff46954d00cb152672fc3dbb2c9c78ebbb342f3a9
BLAKE2b-256 checksum
How to use checksums
60fda4a29706dbabf09e8ea0b7df37a11a743ee029ebece3f00bb2ef7b3e1f77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / mudfish-0.2.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mudfish-0.2.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.4 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
49b21f2bfef6f2c6f0fd6277ffe97c0a1cc181e2f64c75c0f308438db859abf6
BLAKE2b-256 checksum
How to use checksums
614101bfed541a639a2f7fff0b1d8ca2102b286b37f2653338ead0285492dc79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / mudfish-0.2.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL mudfish-0.2.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.2 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
c7e0a679e2b6e1db6956129a89b3e614f5caa6a4287642ecec2d992c47579177
BLAKE2b-256 checksum
How to use checksums
391eaf9cfb951f2db049b5880dbe33ee46bc1e7b2db89e98b89d10e21e647f85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / mudfish-0.2.3-cp39-abi3-macosx_11_0_arm64.whl

Download URL mudfish-0.2.3-cp39-abi3-macosx_11_0_arm64.whl
Size 4.9 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d668659d79632eb4998deace0cc80cf9ba7ea83f5796d4de4bfc5f8feef9d317
BLAKE2b-256 checksum
How to use checksums
1ce447b252c83f98d7b99a310006812a62e78e83a2aed8537da70942893dae64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / mudfish-0.2.3-cp39-abi3-macosx_10_12_x86_64.whl

Download URL mudfish-0.2.3-cp39-abi3-macosx_10_12_x86_64.whl
Size 5.2 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
1062ca0a5909526dc5f90cd77f3ae3b3e670b1372194a832d8a70721b7f395e3
BLAKE2b-256 checksum
How to use checksums
5d31f0b449cbaca73ee20f5961bf44de1a2610f2eb8d9ca9f8929002b6f4eace
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.2.4

2 release files

This release

0.2.3 This release

9 release files

0.2.2

9 release files

0.2.1

9 release files

0.2.0

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