Markdown Pipe Python SDK (beta, pre-1.0): Python client for structured web scraping and fluent queries. APIs may change; initial PyPI release is intended as 0.1.0.
Project description
Markdown Pipe — Python SDK
Deterministic content extraction for AI pipelines, SEO, and data intelligence.
Discover, fetch, and extract clean, structured data from thousands of pages — with schema checksums, credit-based billing, and a fluent DSL.
Why Markdown Pipe?
Traditional scrapers return noisy HTML. Markdown Pipe returns structured, stable contracts:
- ✅ Global preset configurations — high-clean content pipeline for articles, products, SERP results out-of-the-box
- ✅ Fluent DSL (
Qbuilder) — surgical field-by-field extraction with type-safe syntax - ✅ Full discovery engine — sitemap, RSS, and link graph traversal in one call
- ✅ Decoupled pipeline — fetch once, reprocess many times without extra network cost
- ✅ Schema checksums — detect layout changes, enable server-side caching
- ✅ Transparent pricing — pay for infrastructure (
credits), not opaque AI tokens
Installation
# Recommended
uv add markdownpipe
# pip
pip install markdownpipe
Python 3.10+
Quick Examples
1. Article Extraction (Preset)
import asyncio
from markdownpipe import MarkdownPipe
async def main():
async with MarkdownPipe(api_key="sk-...") as client:
article = await client.article("https://techcrunch.com/2024/01/15/ai-news/")
print(article.title)
print(article.author)
print(article.markdown[:300])
asyncio.run(main())
2. Custom Schema Extraction
Define exactly what data you need using the Q builder:
from markdownpipe import MarkdownPipe, Q
PRODUCT_SCHEMA = {
"name": Q("h1").text(),
"price": Q(".price-current").text(),
"images": Q("img.product-photo").all().attr("src"),
"description": Q(".product-desc").cleanup(".ads").markdown(),
"specs": Q("table.specs-table").table(), # → structured JSON
}
async with MarkdownPipe(api_key="sk-...") as client:
result = await client.extract(
"https://shop.example.com/product/widget-pro",
schema=PRODUCT_SCHEMA
)
print(result.data["name"]) # "Widget Pro"
print(result.data["specs"]) # [{"Feature": "Weight", "Value": "120g"}, ...]
print(f"{result.usage.credits} credits · {result.usage.latency}ms")
3. Domain-Scale Harvesting
Discover every article → extract all of them, concurrently:
async with MarkdownPipe(api_key="sk-...") as client:
async for result in client.harvest(
"https://blog.example.com",
depth=1,
concurrency=10,
filter_func=lambda item: "/2024/" in item.url,
show_progress=True,
):
save_to_database(result.data)
4. Fetch → Markdown Pipeline
Decouple acquisition from processing — useful for async queues and storage pipelines:
async with MarkdownPipe(api_key="sk-...") as client:
# Fetch and store (1 credit) — HTML stored server-side
fetch_res = await client.fetch("https://docs.python.org/3/library/asyncio.html")
# Retrieve the HTML (decompressed automatically)
html = await client.get_stored_html(fetch_res.storage_url)
# Convert to clean Markdown (0.5 credits)
md_res = await client.markdown(html, url="https://docs.python.org/3/")
print(md_res.markdown)
5. Raw DSL Engine
Run DSL on HTML you already have — no network call for fetching:
html = open("cached_report.html").read()
async with MarkdownPipe(api_key="sk-...") as client:
result = await client.engine(
url="https://example.com/report",
html=html,
schema={
"title": "h1::text",
"financials": "table.financials::table",
"summary": ".exec-summary::markdown",
}
)
print(result.data["financials"])
6. CSV → Markdown Table
async with MarkdownPipe(api_key="sk-...") as client:
result = await client.csv("Name,Price\nWidget Pro,$49.99\nWidget Lite,$19.99")
print(result.markdown)
# | Name | Price |
# |---|---|
# | Widget Pro | $49.99 |
# | Widget Lite | $19.99 |
7. Schema Checksums for Production Caching
Pre-validate once → reuse on every request for reduced latency:
async with MarkdownPipe(api_key="sk-...") as client:
# Validate schema (free)
v = await client.validate(MY_SCHEMA)
CHECKSUM = v.checksum
print(f"Estimated cost: {v.credits} credits/request")
# Use checksum to enable server-side caching
result = await client.extract(url, schema=MY_SCHEMA, checksum=CHECKSUM)
API Surface
| SDK Method | Endpoint | Description |
|---|---|---|
client.article(url) |
POST /pipe |
Preset article extraction → Article |
client.process(url, namespace) |
POST /pipe |
Preset extraction (article/product/serp) |
client.pipe(url, schema) |
POST /pipe |
Custom schema + full pipeline → ExtractResponse |
client.extract(url, schema) |
POST /extract |
Lightweight custom schema extraction |
client.engine(url, schema, html) |
POST /engine |
DSL on raw HTML (no fetch) |
client.fetch(url) |
POST /fetch |
Acquire + store raw HTML → RawPipeResponse |
client.markdown(html) |
POST /markdown |
HTML → Markdown converter |
client.csv(csv_text) |
POST /markdown/csv |
CSV → Markdown table |
client.csv_batch(items) |
POST /markdown/csv/batch |
Batch CSV → Markdown tables |
client.map(url, depth) |
POST /map |
URL discovery (sitemap + RSS + link graph) |
client.rss(url) |
POST /map/rss |
RSS/Atom feed parser |
client.sitemap(url) |
POST /map/sitemap |
XML sitemap parser |
client.validate(schema) |
OPTIONS /validate |
Schema validation + checksum + cost estimate |
client.get_stored_html(url) |
HTTP GET | Retrieve gzip-compressed HTML from storage |
client.get_job(job_id) |
GET /jobs/<id> |
Retrieve stored job result |
client.farm(items, concurrency) |
— | Concurrent batch extraction via process() |
client.harvest(seed_url, ...) |
— | Discovery → filter → farm pipeline |
client.health() |
GET /health |
Service health check |
Synchronous Client
All async methods are available synchronously via PipeClient:
from markdownpipe import PipeClient
with PipeClient(api_key="sk-...") as client:
article = client.article("https://example.com/blog-post")
print(article.title)
Documentation
| Document | Description |
|---|---|
| Docs Overview | Introduction to the Micro-Orchestrator pattern |
| Quickstart | Step-by-step guide from zero to production |
| API Reference | Full method signatures and response models |
| DSL Guide | Fluent Q builder and logic configuration |
| Pseudo-Classes Reference | Complete operator catalogue |
| Advanced DSL Patterns | Surgical extraction recipes for complex sites |
| Infrastructure Patterns | Mass scale, concurrency, and observability |
| Cookbook | Ready-to-use recipes: RAG pipelines, monitoring, news scraping |
| Integrations | Framework-specific setups (FastAPI, LangChain, etc.) |
| Troubleshooting | Common errors and fixes |
License
Apache 2.0 © Markdown Pipe Team
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 Distribution
Built Distribution
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 markdownpipe-0.1.1.tar.gz.
File metadata
- Download URL: markdownpipe-0.1.1.tar.gz
- Upload date:
- Size: 131.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3a4afb7bc8369331851ed3a39988ef4ebb434e3d3e7bda614bf2968618633a3
|
|
| MD5 |
30e48d3e9ca2fbecbf7ea86c3d29f089
|
|
| BLAKE2b-256 |
98570908c1318b1412ddaa0552a6cdb40e9f65643c18a0452c0ee1d8d4179c6e
|
Provenance
The following attestation bundles were made for markdownpipe-0.1.1.tar.gz:
Publisher:
publish-pypi.yml on markdownpipe/markdown-pipe-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
markdownpipe-0.1.1.tar.gz -
Subject digest:
c3a4afb7bc8369331851ed3a39988ef4ebb434e3d3e7bda614bf2968618633a3 - Sigstore transparency entry: 1419863153
- Sigstore integration time:
-
Permalink:
markdownpipe/markdown-pipe-python-sdk@e7cf24793e3e9a1c91a9070b974bd97b26733e0b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/markdownpipe
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e7cf24793e3e9a1c91a9070b974bd97b26733e0b -
Trigger Event:
push
-
Statement type:
File details
Details for the file markdownpipe-0.1.1-py3-none-any.whl.
File metadata
- Download URL: markdownpipe-0.1.1-py3-none-any.whl
- Upload date:
- Size: 34.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e0c5728a71b2d93360cd58cbda78bfc4f9c75cbb8331e1019b3c58dead64f9b
|
|
| MD5 |
9163f32060e778c14b1f7845abf242ac
|
|
| BLAKE2b-256 |
926a6fbac9c13ecdb9f801c9ddea172d1f79f07d648d05498bb61d53c59825ec
|
Provenance
The following attestation bundles were made for markdownpipe-0.1.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on markdownpipe/markdown-pipe-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
markdownpipe-0.1.1-py3-none-any.whl -
Subject digest:
2e0c5728a71b2d93360cd58cbda78bfc4f9c75cbb8331e1019b3c58dead64f9b - Sigstore transparency entry: 1419863241
- Sigstore integration time:
-
Permalink:
markdownpipe/markdown-pipe-python-sdk@e7cf24793e3e9a1c91a9070b974bd97b26733e0b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/markdownpipe
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e7cf24793e3e9a1c91a9070b974bd97b26733e0b -
Trigger Event:
push
-
Statement type: