惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
博客园 - 三生石上(FineUI控件)
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
Y
Y Combinator Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
D
Docker
罗磊的独立博客
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net
B
Blog
Vercel News
Vercel News
Recent Announcements
Recent Announcements
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志
T
The Blog of Author Tim Ferriss
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
宝玉的分享
宝玉的分享

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - PyPlumber/Incorporator: A schema-free data mappe...
PyPlumber · 2026-05-16 · via Hacker News: Show HN

A schema-free data mapper that turns JSON, XML, or CSV into a unified Python object graph with dot-notation and access-at-runtime.

PyPI version Python Versions Downloads

CI mypy: strict Code style: black Linter: ruff

Pydantic v2 HTTPX

License: MIT GitHub stars

✨ Highlights

  • Works with unpredictable JSON APIs—and effortlessly digests XML, CSV, NDJSON, SQLite, and columnar Parquet—without writing a single line of schema.
  • Turns raw data into native Python objects instantly, bypassing the need for manual model definitions or brittle classes.
  • Handles changing JSON structures at runtime, absorbing missing keys or mutating data types without throwing validation errors.
  • Harnesses Pydantic and HTTPX under the hood without forcing you to write data classes, connection poolers, or pagination while loops.

🎯 Use this when:

  • You are working with evolving, undocumented, or heavily nested JSON APIs.
  • You need a universal bridge to map legacy XML, flat CSVs, or columnar Parquet into the exact same Python object graph.
  • You are exhausted by writing boilerplate models and validation logic just to explore a new data source.
  • You need to extract deeply nested web data, transform it, and pivot it straight into a local SQL database or columnar data lake.

🛠️ How it Works: Zero-Schema Ingestion

Imagine receiving this spacecraft telemetry JSON. Notice how the nested "st" dictionary changes its structure completely for every subsystem (pos vs sig vs bat). Standard parsers would crash instantly.

The Input (telemetry.json):

[
  {"id":"NAV", "st":{"pos":[12,44], "ok":1}},
  {"id":"COM", "st":{"sig":78, "ok":1}},
  {"id":"PWR", "st":{"bat":92, "ok":1}},
  {"id":"THR", "st":{"lvl":63, "ok":0}}
]

The Incorporator Way: Feed it the unpredictable JSON. Incorporator dynamically unifies the changing structures into a single object graph and gives you instant dot-notation access.

import asyncio
from incorporator import Incorporator

class System(Incorporator): pass     # Subclass; everything else hangs off it.

async def main():
    # 1. Parse unpredictable JSON directly into Python objects. No models defined!
    systems = await System.incorp(
        inc_file="telemetry.json",
        inc_code="id" # Sets 'id' as the O(1) Memory Registry lookup key
    )

    # 2. Instantly access the unified Python object graph via dot-notation
    print(f"Navigation Position: {systems.inc_dict['NAV'].st.pos}")   # Output: [12, 44]
    print(f"Power Battery Level: {systems.inc_dict['PWR'].st.bat}%")  # Output: 92%

    # 3. Interpret and manipulate data effortlessly at runtime
    thr = systems.inc_dict["THR"]
    if not thr.st.ok:
        print(f"⚠️ THRUST FAILURE! Efficiency dropped to {thr.st.lvl}")

asyncio.run(main())

🤷‍♂️ Wait, what if my data isn't JSON?

It doesn't matter. Incorporator automatically infers the format from the URL or file extension. The syntax never changes.

Out of the box: JSON, NDJSON, CSV, TSV, PSV, XML, SQLite, and HTML (HTML is parse-only). Opt-in extras unlock Apache Parquet, Feather (Arrow IPC), ORC, Apache Avro, and Excel (XLSX) — same incorp() / export() surface, no syntax changes.

If that exact same telemetry data comes from a legacy system as XML or CSV:

# The syntax doesn't change for XML...
systems_xml = await System.incorp(inc_file="telemetry.xml", inc_code="id")
print(systems_xml.inc_dict["NAV"].st.pos) # Output:['12', '44']

# ...and it works instantly for CSV, TSV, or streaming NDJSON logs!
systems_csv = await System.incorp(inc_file="telemetry.csv", inc_code="id")

📦 Installation

Built on Pydantic V2 metaprogramming, HTTPX, and Tenacity. No system dependencies.

pip install incorporator

Core dependencies: pydantic (>=2.0), httpx, tenacity.

Opt in to format and performance extras as you need them:

pip install incorporator[speedups]    # orjson + lxml + cramjam (GIL-releasing parsers, Rust compression)
pip install incorporator[parquet]     # pyarrow — unlocks Parquet, Feather, and ORC
pip install incorporator[avro]        # fastavro — Apache Avro binary streams
pip install incorporator[xlsx]        # openpyxl — Excel (.xlsx) read/write
pip install incorporator[orchestrate] # typer + prefect — CLI + Prefect task wrappers
pip install incorporator[all]         # everything except [parquet] (pyarrow is ~30 MB — opt in explicitly)

🧰 The Verbs

Every method you'll call on an Incorporator subclass, in order of increasing power.

incorp() — fetch, parse, build the object graph

class Launch(Incorporator): pass

launches = await Launch.incorp(inc_url="https://ll.thespacedevs.com/2.2.0/launch/upcoming/")
print(launches[0].name)

Tutorial 1 — First Steps with Incorporator

test() — let the framework write your incorp() kwargs for you

await Launch.test(inc_url="https://api.unknown.com/v1/users")
# Prints payload tree + suggested inc_code, rec_path, conv_dict.

refresh() — re-fetch live data into existing instances

await Launch.refresh(instance=launches)

The seed call's network context — params, headers, rec_path, conv_dict, payload_list, sql_query, etc. — is auto-replayed on every refresh, so stateful polling against a URL that needed query parameters (CoinGecko's ?vs_currency=usd, paginated SQL, custom POST bodies) works without re-declaring anything. Caller-supplied kwargs win on conflicts.

export() — serialise to any format

CSV, JSON, NDJSON, XML, SQLite, Parquet, Feather, ORC, Avro, XLSX. All share the same call.

await Launch.export(instance=launches, file_path="launches.parquet")

Formats & compression cheat sheet

stream() — a long-running data pipeline

Periodic fetch + optional stateful refresh + optional periodic export, running as a daemon. The kwargs are the pipeline definition. A Wave per chunk is the built-in observability stream — a DX bonus, not the purpose.

async for wave in Launch.stream(
    incorp_params={"inc_url": "https://ll.thespacedevs.com/2.2.0/launch/upcoming/"},
    refresh_interval=60,                              # re-fetch every 60s
    export_params={"file_path": "launches.parquet"},
    export_interval=300,                              # flush to disk every 5 min
):
    if wave.failed_sources: print(wave)               # observability bonus

Streaming & pagination guide

fjord() — a multi-source data pipeline

Fans out across N concurrent sources, fuses them through a user-defined outflow(state) function, exports the combined output.

async for wave in Incorporator.fjord(
    stream_params=[
        {"cls": Coin,  "incorp_params": {"inc_url": "..."}, "refresh_interval": 30},
        {"cls": Order, "incorp_params": {"inc_url": "..."}, "refresh_interval": 5},
    ],
    outflow="outflow.py",                             # outflow(state) -> list[dict] OR dict[name, list[dict]]
    export_params={"file_path": "fusion.parquet"},   # single output
):
    if wave.failed_sources: print(wave)

Advanced fjord() patterns (Tutorial 7):

When sources depend on each other — e.g., one source needs to resolve foreign-key URLs against already-loaded objects from another — define an inflow(state) callable in inflow.py; fjord feeds it each prior source's live snapshot before seeding the next dependent source. When outflow(state) should write to multiple destination files, return dict[ClassName, list[dict]] instead of a flat list; fjord builds one derived class per key and exports one file per class per tick.

Tutorial 7 — Multi-Source Fjord

display() — REPL debug print

launches[0].display()   # <Launch id="..." name="...">

stream() and fjord() are the production verbs — and they're what the CLI runs against a pipeline.json.


🚀 From Code to Production — CLI & Docker

The CLI runs the same stream() / fjord() engines from a pipeline.json. No Python required for single- or multi-source ETLs.

Command What it does
incorporator init --type stream Scaffold a starter pipeline.json (use --type fjord for multi-source + outflow.py).
incorporator validate pipeline.json Structural check before you ship — no network calls.
incorporator stream pipeline.json Run a stream pipeline.
incorporator fjord pipeline.json Run a multi-source fjord pipeline.
incorporator init --type stream --output-dir .
# Edit pipeline.json (inc_url, headers, export_params, ...)
incorporator validate pipeline.json
incorporator stream pipeline.json                # one-shot
# ...or run it as a Dockerised daemon:
cp .env.example .env && mkdir -p config data logs && mv pipeline.json config/
docker compose up -d && docker compose logs -f

Secrets stay out of pipeline.json — use ${API_KEY} for env vars or ${file:/run/secrets/api_key} for Docker / Kubernetes Secrets mounts. Set INCORPORATOR_SECRETS_ROOT=/run/secrets to sandbox ${file:...} references against directory-traversal at startup.

CLI reference · Deployment & secrets guide


🛠 Resilience & Batteries Included

  • GIL-free hyperthreading via the [speedups] extra (orjson, lxml). → Installation
  • Invisible decompression for .gz, .bz2, .lzma, .zip, .tar payloads — automatic, no extra calls; ZIP/TAR member paths are validated against directory-traversal attacks and a 1 GB decompression-bomb cap. → Formats
  • Connection pooling + retries + DLQ — HTTP/2-multiplexed httpx.AsyncClient, Tenacity exponential backoff, failed URLs surfaced via wave.failed_sources. Opt-in block_internal_redirects=True rejects 3xx Locations to RFC1918 / loopback / cloud-metadata IPs. → Library reference
  • Atomic writes for monolithic formats — Parquet, Feather, ORC, JSON, XML, and XLSX all build to a sibling tempfile and os.replace() on success, so a crash mid-write never leaves a corrupt-footer file. → Formats
  • Spreadsheet-injection guard — CSV / XLSX cells starting with = / @ / + / - are prefixed with ' on export so consumers in Excel / LibreOffice / Sheets render the literal text instead of evaluating formulas (OWASP-recommended default; opt out via csv_safe_formulas=False).
  • Zero-OOM IncorporatorList backed by a WeakValueDictionary for O(1) lookups without GC pressure. → Streaming
  • Non-blocking observability — subclass LoggedIncorporator; logs flow through a QueueHandler so disk I/O never blocks the event loop. → Library reference
  • Cross-format round-tripping — JSON ↔ Parquet ↔ SQLite ↔ Avro ↔ CSV ↔ XML, all share the same export() surface, governed by a small hand-maintained type bridge that turns adding a new format into a 2-row dict change. → Tutorial 2 — Universal Formats · Cross-format type bridge

📚 Tutorials (in order)

A focused 1-7 curriculum in increasing difficulty. Each slot introduces one new verb or technique. Runnable code lives under /examples.

  1. 🌱 First Steps with Incorporator — your first incorp() against CoinGecko market data.
  2. 📦 Universal Formats — One Verb, Any File — same call across .json / .csv / .parquet / .sqlite / .xlsx / .avro, with a comparison table.
  3. 🕵️‍♂️ DX Inspector — Let the Framework Write Your Kwargstest() profiles unknown APIs.
  4. 🚀 Drilling API Graphs — Parent → Childinc_parent + inc_child for HATEOAS APIs (SpaceX launches → rockets).
  5. 🔄 Keep It Live — Stateful Refreshrefresh() three ways against Binance's live ticker.
  6. 🌊 Streaming Daemonsstream() for long-running pipelines.
  7. 🌊 Multi-Source Fjord (capstone)fjord() fusing CoinGecko + Binance into a live spread metric.

📑 Reference

📎 Appendices

Patterns that earned their keep before the curriculum was reshaped — production-ready, just not on the learning path.


🤝 Philosophy & Contributing

Incorporator is built on strict OOP principles, non-blocking observability, and a forgiving metaprogramming shield. We trap standard library exceptions (JSONDecodeError, httpx.HTTPStatusError) and gracefully recast them as domain errors. Your event loop is safe with us.

Contributions: see CONTRIBUTING.md for the dev install, quality bar, and architecture conventions. Security disclosures: see SECURITY.md. Release notes: CHANGELOG.md.