r/Python • • Mar 03 '26

Showcase ༄ streamable - sync/async iterable streams for Python

30 Upvotes

https://github.com/ebonnal/streamable

What my project does

A stream[T] wraps any Iterable[T] or AsyncIterable[T] with a lazy fluent interface covering concurrency, batching, buffering, rate limiting, progress observation, and error handling.

Chain lazy operations:

import logging
from datetime import timedelta
import httpx
from httpx import Response, HTTPStatusError
from streamable import stream

pokemons: stream[str] = (
    stream(range(10))
    .map(lambda i: f"https://pokeapi.co/api/v2/pokemon-species/{i}")
    .throttle(5, per=timedelta(seconds=1))
    .map(httpx.get, concurrency=2)
    .do(Response.raise_for_status)
    .catch(HTTPStatusError, do=logging.warning)
    .map(lambda poke: poke.json()["name"])
)

Consume it (sync or async):

>>> list(pokemons)
['bulbasaur', 'ivysaur', 'venusaur', 'charmander', 'charmeleon', 'charizard', 'squirtle', 'wartortle', 'blastoise']

>>> [pokemon async for pokemon in pokemons]
['bulbasaur', 'ivysaur', 'venusaur', 'charmander', 'charmeleon', 'charizard', 'squirtle', 'wartortle', 'blastoise']

Target Audience

If you find yourself writing verbose iterable plumbing, streamable will probably help you keep your code expressive, concise, and memory-efficient.

  • You may need advanced behaviors like time-windowed grouping by key, concurrent flattening, periodic observation of the iteration progress, buffering (decoupling upstream production rate from downstream consumption rate), etc.
  • You may want a unified interface for sync and async behaviors, e.g. to switch seamlessly between httpx.Client.get and httpx.AsyncClient.get in your .map (or anywhere else), consume the stream as a sync or as an async iterable, from sync or async context.
  • You may simply want to chain .maps and .filters without overhead vs builtins.map and builtins.filter.

Comparison

Among similar libraries, streamable's proposal is an interface that is:

  • targeting I/O intensive use cases: a minimalist set of a dozen expressive operations particularly elegant to tackle ETL use cases.
  • unifying sync and async: Create streams that are both Iterable and AsyncIterable, with operations adapting their behavior to the type of iteration and accepting sync and async functions.

The README gives a complete tour of the library, and I’m also happy to answer any questions you may have in the comments.

About 18 months ago I presented here the 1.0.0.
I'm glad to be back to present this matured 2.0.0 thanks to your feedback and contributions!


r/Python • • Mar 03 '26

Showcase PDF Oxide -- Fast PDF library for Python with engine in Rust (0.8ms mean, MIT/Apache license)

203 Upvotes

pdf_oxide is a PDF library for text extraction, markdown conversion, PDF creation, OCR. Written in Rust, Python bindings via PyO3. MIT licensed.

    pip install pdf_oxide

    from pdf_oxide import PdfDocument
    doc = PdfDocument("paper.pdf")
    text = doc.extract_text(0)

GitHub: https://github.com/yfedoseev/pdf_oxide
Docs: https://oxide.fyi

Why this exists: I needed fast text extraction with a permissive license. PyMuPDF is fast but AGPL, rules it out for a lot of commercial work. pypdf is MIT but 15x slower and chokes on ~2% of files. pdfplumber is great at tables but not at batch speed.

So I read the PDF spec cover to cover (~1,000 pages) and wrote my own. First version took 23ms per file. Profiled it, found an O(n2) page tree traversal -- a 10,000 page PDF took 55 seconds. Cached it into a HashMap, got it down to 332ms. Kept profiling, kept fixing. Now it's at 0.8ms mean on 3,830 real PDFs.

Numbers on that corpus (veraPDF, Mozilla pdf.js, DARPA SafeDocs):

LibraryMeanp99Pass RateLicense
pdf_oxide0.8ms9ms100%MIT
PyMuPDF4.6ms28ms99.3%AGPL-3.0
pypdfium24.1ms42ms99.2%Apache-2.0
pdftext7.3ms82ms99.0%GPL-3.0
pypdf12.1ms97ms98.4%BSD-3
pdfminer16.8ms124ms98.8%MIT
pdfplumber23.2ms189ms98.8%MIT
markitdown108.8ms378ms98.6%MIT

Give it a try, let me know what breaks.

What My Project Does

Rust PDF library with Python bindings. Extracts text, converts to markdown and HTML, creates PDFs, handles encrypted files, built-in OCR. MIT licensed.

Target Audience

Anyone who needs to pull text out of PDFs in Python without AGPL restrictions, or needs speed for batch processing.

Comparison

5-30x faster than other text extraction libraries on a 3,830-PDF corpus. PyMuPDF is more mature but AGPL. pdfplumber is better at tables. pdf_oxide is faster with a permissive license.


r/Python • • Mar 03 '26

Showcase Building Post4U - a self-hosted social media scheduler with FastAPI + APScheduler

1 Upvotes

Been working on Post4U for a couple of weeks, an open source scheduler that cross-posts to X, Telegram, Discord and Reddit from a single REST API call.

What My Project Does

Post4U exposes a REST API where you send your content, a list of platforms, and an optional scheduled time. It handles the rest — posting to each platform at the right time, tracking per-platform success or failure, and persisting scheduled jobs across container restarts.

Target Audience

Developers and technically inclined people who want to manage their own social posting workflow without handing API keys to a third party. Not trying to replace Buffer for non-technical users - this is for people comfortable with Docker and a .env file. Toy project for now, with the goal of making it production-ready.

Comparison

Most schedulers (Buffer, Hootsuite, Typefully) are SaaS, your credentials live on their servers and you pay monthly. The self-hosted alternatives I found were either abandoned, overly complex, or locked to one platform. Post4U is intentionally minimal — one docker-compose up, your keys stay on your machine, codebase small enough to actually read and modify.

The backend decision I keep second-guessing is APScheduler with a MongoDB job store instead of Celery + Redis. MongoDB was already there for post history so it felt natural - jobs persist across restarts with zero extra infrastructure. Curious if anyone here has run APScheduler in production and hit issues at scale.

Started the Reflex frontend today. Writing a web UI in pure Python is a genuinely interesting experience, built-in components are good for scaffolding fast but the moment you need full layout control you have to drop into rx.html. State management is cleaner than expected though, extend rx.State, define your vars, changes auto re-render dependent components. Very React-like without leaving Python.

Landing page done, dashboard next.

Would love feedback on the problem itself, the APScheduler decision, or feature suggestions.

GitHub: https://github.com/ShadowSlayer03/Post4U-Schedule-Social-Media-Posts


r/Python • • Mar 03 '26

Discussion Anyone in here in the UAS Flight Test Engineer industry using python?

8 Upvotes

Specifically using python to read & analyze flight data logs and even for testing automations.

I’m looking to expand my uas experience and grow into a FTE role. Most roles want experience using python, CPP, etc. I’m pretty new to python. Wanted to know if anyone can give some advice.


r/Python • • Mar 03 '26

Showcase cMCP v0.4.0 released!

0 Upvotes

What My Project Does

cMCP is a command-line utility for interacting with MCP servers - basically curl for MCP.

New in v0.4.0: mcp.json configuration support! 🎉

Installation

pip install cmcp

Quickstart

Create .cmcp/mcp.json:

{
  "mcpServers": { 
    "my-server": { 
      "command": "python",
      "args": ["server.py"]
    } 
  } 
}

Use it:

cmcp :my-server tools/list
cmcp :my-server tools/call name=add arguments:='{"a": 1, "b": 2}'

Compatible with Cursor, Claude Code, and FastMCP format.

GitHub: https://github.com/RussellLuo/cmcp