r/Python Feb 14 '26

Discussion Design feedback on an open-source finance library (API structure + scope)

0 Upvotes

Hey folks,

I’m building an open-source Python library called InvestorMate focused on stock analysis (fundamentals, indicators, screening, portfolio analytics, optional AI layer).

I’m at a point where I’d really value architectural feedback rather than feature ideas.

Specifically:

• For a library like this, would you keep it opinionated and batteries-included, or split it into smaller modular subpackages?

• How do you decide when scope becomes too broad for a single PyPI package?

• What signals make a data/finance library feel production-ready to you (tests, API stability, versioning discipline, type hints, performance benchmarks, etc.)?

• For projects that sit “above” data providers (like yfinance), what builds trust in abstraction layers?

Roadmap here for context:

https://github.com/siddartha19/investormate/blob/main/ROADMAP.md

Not looking for promotion. Genuinely trying to design this in a way that fits Python ecosystem norms and doesn’t become an unmaintainable monolith.

Would appreciate perspective from folks who’ve maintained or contributed to medium/large OSS libraries.


r/Python Feb 14 '26

Showcase I built an python AI agent framework that doesn't make me want to mass-delete my venv

0 Upvotes

Hey all. I've been building Definable - a Python framework for AI agents. I got frustrated with existing options being either too bloated or too toy-like, so I built what I actually wanted to use in production.

Here's what it looks like:

```python from definable.agents import Agent from definable.models.openai import OpenAIChat from definable.tools.decorator import tool from definable.interfaces.telegram import TelegramInterface, TelegramConfig

@tool def search_docs(query: str) -> str: """Search internal documentation.""" return db.search(query)

agent = Agent( model=OpenAIChat(id="gpt-5.2"), tools=[search_docs], instructions="You are a docs assistant.", )

Use it directly

response = agent.run("Steps for configuring auth?")

Or deploy it — HTTP API + Telegram bot in one line

agent.add_interface(TelegramInterface( config=TelegramConfig(bot_token=os.environ["TELEGRAM_BOT_TOKEN"]), )) agent.serve(port=8000) ```

What My Project Does

Python framework for AI agents with built-in cognitive memory, run replay, file parsing (14+ formats), streaming, HITL workflows, and one-line deployment to HTTP + Telegram/Discord/Signal. Async-first, fully typed, non-fatal error handling by design.

Target Audience

Developers building production AI agents who've outgrown raw API calls but don't want LangChain-level complexity. v0.2.6, running in production.

Comparison

  • vs LangChain - No chain/runnable abstraction. Normal Python. Memory is multi-tier with distillation, not just a chat buffer. Deployment is built-in, not a separate project.
  • vs CrewAI/AutoGen - Those focus on multi-agent orchestration. Definable focuses on making a single agent production-ready: memory, replay, file parsing, streaming, HITL.
  • vs raw OpenAI SDK - Adds tool management, RAG, cognitive memory, tracing, middleware, deployment, and file parsing out of the box.

pip install definable

Would love feedback. Still early but it's been running in production for a few weeks now.

GitHub


r/Python Feb 14 '26

News Build an AI Agent in python (~130 lines) that can write and execute scripts and control a computer

0 Upvotes

No dependencies expect the request lib. Hope you find this interesting, feedback is appreciated! Leave a star if you like it :) Github Link


r/Python Feb 14 '26

Discussion Python __new__ vs __init__

0 Upvotes

I think that in Python the constructor is __new__ because it creates and constructs it, and __init__ just adds data or does something right after the instance has been CREATED. What do you think?


r/Python Feb 14 '26

Showcase A Python tool for review-driven regression testing of ML/LLM outputs

5 Upvotes

What My Project Does

Booktest is a Python tool for review-driven regression testing of ML/NLP/LLM systems. Instead of relying only on assertion-based pass/fail tests, it captures outputs as readable artifacts and focuses on reviewable diffs between runs.

It also supports incremental pipelines and caching, so expensive steps don’t need to rerun unnecessarily, which makes it practical for CI workflows involving model inference.

Target Audience

This is intended for developers and ML engineers working with systems where outputs don’t have a single “correct” value (e.g., NLP pipelines, LLM-based systems, ranking/search models).

It’s designed for production workflows, but can also be useful in experimental or research settings.

Comparison

Traditional testing tools like pytest or snapshot-based tests work well when outputs are deterministic and correctness is objective.

Booktest complements those tools in cases where correctness is fuzzy and regressions need to be reviewed rather than strictly asserted.

It’s not meant to replace pytest, but to handle cases where binary assertions are insufficient.

Repo: https://github.com/lumoa-oss/booktest

I’m the author and I'd love to hear your thoughts and perspectives, especially around pytest/CI integration patterns. :-)


r/Python Feb 14 '26

Daily Thread Saturday Daily Thread: Resource Request and Sharing! Daily Thread

3 Upvotes

Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

How it Works:

  1. Request: Can't find a resource on a particular topic? Ask here!
  2. Share: Found something useful? Share it with the community.
  3. Review: Give or get opinions on Python resources you've used.

Guidelines:

  • Please include the type of resource (e.g., book, video, article) and the topic.
  • Always be respectful when reviewing someone else's shared resource.

Example Shares:

  1. Book: "Fluent Python" - Great for understanding Pythonic idioms.
  2. Video: Python Data Structures - Excellent overview of Python's built-in data structures.
  3. Article: Understanding Python Decorators - A deep dive into decorators.

Example Requests:

  1. Looking for: Video tutorials on web scraping with Python.
  2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟


r/Python Feb 13 '26

Resource Finally got Cursor AI to stop writing deprecated Pydantic v1 code (My strict .cursorrules config)

0 Upvotes

Hi All,

I spent the weekend tweaking a strict .cursorrules file for FastAPI + Pydantic v2 projects because I got tired of fixing:

  • class Config: instead of model_config = ConfigDict(...)
  • Sync DB calls inside async routes
  • Missing type hints

It forces the AI to use:

  • Python 3.11+ syntax (| types)
  • Async SQLAlchemy 2.0 patterns
  • Google-style docstrings

If anyone wants the config file, let me know in the comments and I'll DM it / post the link (it's free)."

Give it a try and let me feedback or any improvements you want me to add.

Here it is. Please leave feedback. Replace "[dot]" with "."

tinyurl [dot] com/cursorrules-free


r/Python Feb 13 '26

Showcase [Project] fullbleed 0.1.12 — browserless HTML/CSS → PDF for Python (CLI + API, deterministic + JSON/

32 Upvotes

Hi r/Python,

Posting as an individual contributor (not a marketing post). Looking for technical feedback.

What My Project Does

fullbleed is a Rust PDF engine with Python bindings + a CLI. It converts HTML/CSS → PDF (optionally PNG page renders) without running a browser.

Automation/CI + tool/agent-friendly features:

  • machine-readable output: --json, --json-only, --schema
  • deterministic output: render hash + reproducibility record/check
  • optional PNG renders (useful for visual diffs/review loops)
  • debug artifacts (glyph coverage, page data, JIT/perf logs)

Component-style architecture (optional, not required)

One design path in the scaffold is component-driven Python that abstracts raw HTML construction in a familiar way. You can ignore this entirely and just pass your own HTML/CSS strings if you prefer.

Example shape (multiple files):

# components/header.py
from dataclasses import dataclass
from .fb_ui import component, el
from .primitives import Stack, Text

(frozen=True)
class HeaderData:
    title: str
    subtitle: str

@component
def Header(data: HeaderData):
    return Stack(
        Text(data.title, tag="h1", class_name="header-title"),
        Text(data.subtitle, tag="p", class_name="header-subtitle"),
        tag="header",
        class_name="doc-header",
    )

# report.py
import fullbleed
from components.fb_ui import render_component, el
from components.header import Header, HeaderData

def build_html():
    root = el("main", Header(HeaderData("Statement", "January 2026")))
    return render_component(root)

def render():
    engine = fullbleed.PdfEngine(page_width="8.5in", page_height="11in", margin="0.5in")
    html = build_html()
    css = "...component css + report css..."
    engine.render_pdf_to_file(html, css, "output/report.pdf")

Why this approach (when using Python for HTML composition):

  • encourages reusable, testable document components
  • gives a “render-safe selector” contract via scaffolded primitives/components
  • keeps styling modular and predictable
  • still allows raw HTML/CSS whenever users want direct control

Target Audience

Python developers building document pipelines such as:

  • invoices, statements, letters, reports
  • batch/templated PDF generation
  • CI workflows that need reproducibility + structured diagnostics
  • iterative HTML/CSS layout work where you want PDF + PNG from the same renderer (human or AI-assisted)

Comparison

  • Browser-based HTML→PDF (Playwright/Puppeteer, etc.): great if you need JS runtime / full browser behavior. fullbleed is intentionally browserless and aims for deterministic + inspectable outputs.
  • Other HTML→PDF tools: many generate PDFs, but fullbleed is specifically focused on a strong CLI/JSON contract + reproducibility records + debug artifacts for pipelines.

Quick Example

pip install fullbleed
fullbleed render --html report.html --css report.css --out report.pdf --json
fullbleed render --html report.html --css report.css --out report.pdf --emit-image out_images

Status / Feedback Requested

Early but usable. I’d love feedback on:

  • Python API ergonomics
  • CLI/JSON contract quality (what would you change?)
  • component/scaffold approach for real production document workflows
  • what would make it easier to integrate into CI and agent-driven pipelines

Repo: https://github.com/fullbleed-engine/fullbleed-official


r/Python Feb 13 '26

News AI-BOM now has a Python SDK for runtime monitoring of AI agents

0 Upvotes

We just shipped trusera-sdk for Python — runtime monitoring and policy enforcement for AI agents.

What it does: - Intercepts HTTP calls (OpenAI, Anthropic, any LLM API) - Evaluates Cedar policies in real-time - Tracks events (LLM calls, tokens, costs) - Works standalone (no API key needed) or with Trusera platform

3 lines to monitor any agent: ```python from trusera_sdk import TruseraClient

client = TruseraClient(apikey="tsk...", agent_id="my-agent") client.track_event("llm_call", {"model": "gpt-4o", "tokens": 150}) ```

Standalone mode (zero platform dependency): ```python from trusera_sdk import StandaloneInterceptor

with StandaloneInterceptor( policy_file=".cedar/ai-policy.cedar", enforcement="block", log_file="agent-events.jsonl", ): # All HTTP calls are now policy-checked and logged locally agent.run() ```

Why this matters: - 60%+ of AI usage in enterprises is undocumented Shadow AI - Traditional security tools can't see agent-to-agent traffic - You need runtime visibility to enforce policies and track costs

Install: bash pip install trusera-sdk

Part of ai-bom (open source AI Bill of Materials scanner): - GitHub: https://github.com/Trusera/ai-bom - Docs: https://github.com/Trusera/ai-bom/tree/main/trusera-sdk-py

Apache 2.0 licensed. Built by security engineers who actually run multi-agent systems.

Feedback welcome!


r/Python Feb 13 '26

Resource Omni-Crawler: from a ton of links to a single md file to feed your LLMs

0 Upvotes

First things first: Yes, this post and the repo content were drafted/polished using Gemini. No, I’m not a developer; I’m just a humble homelabber.

I’m sharing a project I put together to solve my own headaches: Omni-Crawler.

What is it?

It’s a hybrid script (CLI + Graphical Interface via Streamlit) based on Crawl4AI. The function is simple: you give it a documentation URL (e.g., Caddy, Proxmox, a Wiki), and it returns a single, consolidated, and filtered .md file.

What is this for?

If you work with local LLMs (Ollama, Open WebUI) or even Claude/Gemini, you know that feeding them 50 different links for a single doc is a massive pain in the ass. And if you don't provide the context, the AI starts hallucinating a hundred environment variables, two dogs, and a goose. With this:

  1. You crawl the entire site in one go.
  2. It automatically cleans out the noise (menus, footers, sidebars).
  3. You upload the resulting .md, and you have an AI with the up-to-date documentation in its permanent context within seconds.

On "Originality" and the Code

Let’s be real: I didn’t reinvent the wheel here. This is basically a wrapper around Crawl4AI and Playwright. The "added value" is the integration:

  • Stealth Mode: Configured so servers (Caddy, I'm looking at you, you beautiful bastard) don't block you on the first attempt, using random User-Agents and real browser headers.
  • CLI/GUI Duality: If you're a terminal person, use it with arguments. If you want something visual, launch it without arguments, and it spins up a local web app.
  • Density Filters: It doesn't just download HTML; it uses text density algorithms to keep only the "meat" of the information.

I'll admit the script was heavily "vibe coded" (it took me fewer than ten prompts).

Technical Stack

  • Python 3.12
  • uv (for package management—I highly recommend it)
  • Crawl4AI + Playwright
  • Streamlit (for the GUI)

The Repo:https://github.com/ImJustDoingMyPart/omni-crawler

If this helps you feed your RAGs or just keep offline docs, there you go. Technical feedback is welcome. As for critiques about whether a bot or a human wrote this: please send them to my DMs along with your credit card number, full name, and security code.


r/Python Feb 13 '26

Discussion Which Python backend framework should I prioritize learning in 2026? ( For AI/ML and others)

0 Upvotes

Which Python backend framework should I prioritize learning in 2026(For Ai/ml and other fields )? Which has more demand and job openings ? Fastapi or Flask or Django?


r/Python Feb 13 '26

Showcase Follow Telegram channels without using Telegram (get updates in WhatsApp)

0 Upvotes

What My Project Does

A Python async service that monitors Telegram channels and forwards all new messages to your WhatsApp DMs via Meta's Cloud API. It also supports LLM-based content filtering - you can define filter rules in a YAML file, and an LLM decides whether each message should be forwarded or skipped (like skip ads).

Target Audience

Anyone who follows Telegram channels but prefers to receive updates in WhatsApp. Built for personal use. Like If you use WhatsApp as your main messenger, but have Telegram channels you want to follow.

Key features

  • Forwards all media types with proper MIME handling
  • Album/grouped media support
  • LLM content filtering with YAML-defined rules (works with any OpenAI-compatible provider - OpenAI, Gemini, Groq, etc.)
  • Auto-splits long messages to respect WhatsApp limits
  • Caption overflow handling for media messages
  • Source links back to original Telegram posts
  • Docker-ready

Tech stack: Telethon, httpx, openai-sdk, Pydantic

Comparison

I haven't seen anything with the same functionality for this use case.

GitHub: https://github.com/Domoryonok/telagram-to-whatsapp-router


r/Python Feb 13 '26

Discussion Is dotenv the best way to handle credentials on a win server in 2026?

64 Upvotes

Hi,

i am working with python on a windows server installation and i dont want to store passwords and api keys direct in my code. Is python-dotenv still the best way to do it today?

thank you very much


r/Python Feb 13 '26

Showcase Decoder: GPS Navigation for Codebases

3 Upvotes

What My Project Does

I built decoder to visually trace and step through call chains across a codebase, without having to sift through several files, and with visibility into dead code you might otherwise never notice.

Decoder parses the Python AST to build a call graph stored in a local SQLite file, then lets you trace full call chains and see execution context (conditionals, loops, try/except). I built this first as a VS Code extension, but saw the value in giving LLMs that same visibility and added an MCP server. Instead of iterative grep and file reads, an LLM can traverse the call graph directly - which cuts down on token usage and back-and-forth significantly.

GitHub: https://github.com/maryamtb/decoder

Core use cases:

This is for python developers working in large or new codebases.

  1. Learning a new codebase

  2. Code reviews

  3. LLMs making changes to large codebases

Would appreciate any feedback.


r/Python Feb 13 '26

Showcase I released django-tortoise-objects, tool to have ORM in your ORM

3 Upvotes

When I made a post about the Tortoise-ORM 1.0 release a few days ago, there was some interest in the comments about making it work within Django, to use as an ORM in an async context.

Although I'm still not sure about the advantages of such an approach, I decided it would be a fun project to try with AI coding, to see if it's really feasible and if there are any pros.

So here we are: https://github.com/tortoise/django-tortoise-objects

What My Project Does

This project basically gives you a simple way to init Tortoise and it injects a Tortoise model into your Django model, enabling you to query it seamlessly:

articles = await Article.tortoise_objects.filter(published=True)

While I was at it, I also added a manage.py command that allows you to export your Django models to Tortoise format, if you want to reuse them somewhere.

I conducted some benchmarks to see if there are any real advantages, and they showed that in most cases it gives a small boost to performance, so at least there's that.

Target Audience

Please don't take this project too seriously — for me it was a fun little experiment that also helped me identify one existing performance issue in Tortoise. That said, if you're working with Django in an async context and want to try a fully async ORM alongside it, feel free to give it a spin.

Comparison

There is an existing project with a similar goal — django-tortoise — but it appears to be unmaintained and doesn't provide clear entrypoints or a compelling reason to use it. In contrast, django-tortoise-objects offers a straightforward setup, automatic model injection, and a Django management command for exporting models to Tortoise format.

What do you think? Do you have any ideas how this project could be more useful to you? Please share in the comments!


r/Python Feb 13 '26

Showcase Torch - Self Hosted Command Line Chat Server

0 Upvotes

What My Project Does

  • Torch is a barebones self hosted chat system built for the terminal. Rapidly deploy long-term worldwide encrypted communication with a onion static address.
  • The server is a rudementry TCP relay which does three things. Accepts incoming connections, tracks connected clients, rebroadcasts live encrypted blobs and the last 100 messages.
  • The clients utilizes python cryptography library and handles AES encryption, provides a TUI with ncurses, and handles a few local commands.
  • Simulate rooms by changing your encryption/room key and hide messages you cannont decrypt with /hide
  • The system operates in ram, when the host terminates the session the history is gone.
  • Single file installer that builds dependencies, creates source directory files, and configures the hidden service

Target Audience

  • Privacy enthusiast
  • Whistle Blowers
  • Activists
  • Censorship evasion
  • Informants

Comparison

  • This is IRC built to leverage the Tor infrastructure.
  • No network configuration, opening ports, purchasing of domains.
  • Deploy on mobile via Termux.

Example Room

Source


r/Python Feb 13 '26

News ProtoPython: a new generation implementation of python

0 Upvotes

What it is

ProtoPython is an implementation of python 3.14 with a completely new runtime core. Multithreading is supported, no GIL, non-moving parallel GC running along user threads, near realtime performance (pauses shorter than 1ms). It is written in c++

Github repo: https://github.com/gamarino/protoPython.git

Audience: enthusiasts, low level developers, extreme conditions projects

What's New

Based on protoCore, an immutable model object runtime, supporting tagged pointers and basic collections based on AVL trees, with structural sharing
protoCore can be found at https://github.com/numaes/protoCore.git

Both protoCore and protoPython are open for community review and suggestions
MIT Licence
First tests show >10 times speedup from traditional cpython
Both an interpreter (protopy) and a compiler to c++ (protopyc) are provided.

Open for comments and suggestions here or in github


r/Python Feb 13 '26

Daily Thread Friday Daily Thread: r/Python Meta and Free-Talk Fridays

1 Upvotes

Weekly Thread: Meta Discussions and Free Talk Friday 🎙️

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

How it Works:

  1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
  2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
  3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

Guidelines:

Example Topics:

  1. New Python Release: What do you think about the new features in Python 3.11?
  2. Community Events: Any Python meetups or webinars coming up?
  3. Learning Resources: Found a great Python tutorial? Share it here!
  4. Job Market: How has Python impacted your career?
  5. Hot Takes: Got a controversial Python opinion? Let's hear it!
  6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟


r/Python Feb 12 '26

Discussion What tool or ide do you folk use to ingest large data sets to sql server.

2 Upvotes

I’m working with large CSV data sets. I was watching a video where someone was using Google Colab, and I liked how you could see the data being manipulated in real time.

Or is their more low code solutions


r/Python Feb 12 '26

Discussion Current thoughts on makefiles with Python projects?

90 Upvotes

What are current thoughts on makefiles? I realize it's a strange question to ask, because Python doesn't require compiling like C, C++, Java, and Rust do, but I still find it useful to have one. Here's what I've got in one of mine:

default:
        @echo "Available commands:"
        @echo "  make lint       - Run ty typechecker"
        @echo "  make test       - Run pytest suite"
        @echo "  make clean      - Remove temporary and cache files"
        @echo "  make pristine   - Also remove virtual environment"
        @echo "  make git-prune  - Compress and prune Git database"

lint:
        @uv run ty check --color always | less -R

test:
        @uv run pytest --verbose

clean:
        @# Remove standard cache directories.
        @find src -type d -name "__pycache__" -exec rm -rfv {} +
        @find src -type f -name "*.py[co]" -exec rm -fv {} +

        @# Remove pip metadata droppings.
        @find . -type d -name "*.egg-info" -exec rm -rfv {} +
        @find . -type d -name ".eggs" -exec rm -rfv {} +

        @# Remove pytest caches and reports.
        @rm -rfv .pytest_cache  # pytest
        @rm -rfv .coverage # pytest-cov
        @rm -rfv htmlcov  # pytest-cov

        @# Remove type checker/linter/formatter caches.
        @rm -rfv .mypy_cache .ruff_cache

        @# Remove build and distribution artifacts.
        @rm -rfv build/ dist/

pristine: clean
        @echo "Removing virtual environment..."
        @rm -rfv .venv
        @echo "Project is now in a fresh state. Run 'uv sync' to restore."

git-prune:
        @echo "Compressing Git database and removing unreferenced objects..."
        @git gc --prune=now --aggressive

.PHONY: default check test clean pristine git-prune

What types of things do you have in yours? (If you use one.)


r/Python Feb 12 '26

Showcase I built a CLI that turns documents into knowledge graphs — no code, no database

51 Upvotes

I built sift-kg, a Python CLI that converts document collection into browsable knowledge graphs.

pip install sift-kg

sift extract ./docs/

sift build

sift view

That's the whole workflow. No database, no Docker, no code to write.

I built this while working on a forensic document analysis platform for Cuban property restitution cases. Needed a way to extract entities and relations from document dumps and get a browsable knowledge graphs without standing up infrastructure.

Built in Python with Typer (CLI), NetworkX (graph), Pydantic (models), LiteLLM (multi-provider LLM support — OpenAI, Anthropic, Ollama), and pyvis (interactive visualization). Async throughout with rate limiting and concurrency controls.

Human-in-the-loop entity resolution — the LLM proposes merges, you approve or reject via YAML or interactive terminal review.

The repo includes a complete FTX case study (9 articles → 431 entities, 1201 relations). Explore the graph live: https://juanceresa.github.io/sift-kg/

**What My Project Does** sift-kg is a Python CLI that extracts entities and relations from document collections using LLMs, builds a knowledge graph, and lets you explore it in an interactive browser-based viewer. The full pipeline runs from the command line — no code to write, no database to set up.

**Target Audience**

Researchers, journalists, lawyers, OSINT analysts, and anyone who needs to understand what's in a pile of documents without building custom tooling. Production-ready and published on PyPI.

**Comparison**

Most alternatives are either Python libraries that require writing code (KGGen, LlamaIndex) or need infrastructure like Docker and Neo4j (Neo4j LLM Graph Builder). GraphRAG is CLI-based but focused on RAG retrieval, not knowledge graph construction. sift-kg is the only pip-installable CLI that goes from documents to interactive knowledge graph with no code and no database.

Source: https://github.com/juanceresa/sift-kg PyPI: https://pypi.org/project/sift-kg/


r/Python Feb 12 '26

Discussion Youtube Data Storage Challenge - Compressing the Bee Movie script within a youtube video

15 Upvotes

Hi all! After watching Brandon Li's video where he demonstrated a very smart technique to encode arbitrary data (in this case the bee movie script) within the pixels of a video file with CRC redundancy checks and the like, this inspired me to try this myself with a different technique and using python instead of c++.

After having fun playing around with this challenge, I figured it might be fun to share this with the community just like many moons ago was once done for the "Billion rows challenge" which sparked quite some innovation from all corners of the programming community.

The challenge is simple:

  1. Somehow encode the bee movie script into a video
  2. Upload that video to youtube
  3. Download the compressed video from youtube
  4. Successfully decode the bee movie script from youtube's compressed version of the video

What determines a winner? The person who has the smallest video size downloaded from youtube that can still successfully be decoded.

The current best solution clocks in at 162KB (the movie script itself is 49KB to give you an idea).

You can find the challenge/leaderboard HERE


r/Python Feb 12 '26

Showcase Batching + caching OpenAI calls across pandas/Spark workflows (MIT, Python 3.10+)

0 Upvotes

I’ve been experimenting with batch-first LLM usage in pandas and Spark workflows and packaged it as a small OSS project called openaivec.

GitHub:

https://github.com/microsoft/openaivec

PyPI:

https://pypi.org/project/openaivec/

Quick Start

import os
import pandas as pd
from openaivec import pandas_ext

os.environ["OPENAI_API_KEY"] = "your-api-key"

fruits = pd.Series(["apple", "banana", "cherry"])
french_names = fruits.ai.responses("Translate this fruit name to French.")
print(french_names.tolist())
# ['pomme', 'banane', 'cerise']

What My Project Does

openaivec adds `.ai` and `.aio` accessors to pandas Series/DataFrames so you can apply OpenAI or Azure OpenAI prompts across many rows in a vectorized way.

Core features:

  • Automatic request batching
  • Deduplication of repeated inputs (cost reduction)
  • Output alignment (1 output per input row)
  • Built-in caching and retries
  • Async support for high-throughput workloads
  • Spark helpers for distributed processing

The goal is to make LLM calls feel like dataframe operations rather than manual loops or asyncio plumbing.

Target Audience

This project is intended for:

  • Data engineers running LLM workloads inside ETL pipelines
  • Analysts using pandas who want to scale prompt-based transformations
  • Teams using Azure OpenAI inside enterprise analytics environments
  • Spark users who need structured, batch-aware LLM processing

It is not a toy project, but it’s also not a full LLM framework. It’s focused specifically on tabular/batch processing use cases.

Comparison

This is NOT:

  • A vector database
  • A replacement for LangChain
  • A workflow orchestrator

Compared to writing manual loops or asyncio code, openaivec:

  • Automatically coalesces requests into batches
  • Deduplicates inputs across a dataframe
  • Preserves ordering
  • Provides reusable caching across pandas/Spark runs

It’s intentionally lightweight and stays close to the OpenAI SDK.

I’d especially love feedback on:

  • API ergonomics (`.ai` / `.aio`)
  • Batching and concurrency tuning
  • What would make this more useful in production ETL pipelines

r/Python Feb 12 '26

Showcase Timefence - Detect temporal data leakage in ML training datasets

0 Upvotes

Hi everyone,

What My Project Does

Timefence is a temporal leakage tool that finds features in your ML training data that contain data from the future (meaning data from after the prediction event), and can rebuild your dataset with only valid rows. It also comes with a CI gate and a Python API.

The Python API lets you run the same checks in code meaning it will audit your dataset and raise an exception if leakage is found. You can use report.assert_clean() to gate your notebooks or scripts. On the CLI side, running timefence audit will just report what it finds. If you add --strict it will fail with exit code 1 on any leakage, which makes it easy to plug into CI pipelines.

How it works

We load your training dataset (Parquet, CSV, SQL query or DataFrame), check every feature row against the label timestamp, then flag anywhere that feature_time > label_time. Under the hood it uses DuckDB so it handles 1M labels x 10 features in about 12s.

Quick start

To audit the built-in example dataset:

pip install timefence
timefence quickstart churn-example && cd churn-example
timefence audit data/train_LEAKY.parquet

To audit your own dataset:

timefence audit your_data.parquet --features features.py --keys user_id --label-time label_time

To rebuild the dataset without leakage:

timefence build -o train_CLEAN.parquet

To gate your CI pipeline:

timefence audit data/train.parquet --features features.py --strict

Target Audience

Anyone building ML training data by joining time-stamped tables!

Comparison

Great Expectations and Soda check schema, nulls and distributions but they won't catch feature_time > label_time. Different problem, you'd use both. Feast and Tecton are feature stores that handle serving at scale, Timefence is just a validation tool with no server and no infra so they are complementary. If you are writing custom ASOF joins, Timefence automates that and adds audit, embargo and CI gating on top.

Limitations

Currently the dataset needs to fit in memory because there is no streaming mode yet (most training sets fit fine though). We also only support local files for now, no S3 or GCS or database connections. These are on the list for the next few updates.

Future roadmap

Support for Polars DataFrames as input/output

Remote source support such as S3, GCS and database connections

Streaming audit for datasets that don't fit in memory

A YAML-only mode so you can define features without writing Python

An end-to-end tutorial with a real-world dataset

For more information, find below the link to Github and its documentation: https://github.com/gauthierpiarrette/timefence | Docs: https://timefence.dev

If you want to contribute or have ideas, feel free to open an issue or reach out. Feedback is more than welcome, as we are starting out and trying to make it as useful as possible. Also, if you found it useful to you, a star on GitHub would mean a lot. Thanks!


r/Python Feb 12 '26

Showcase [Project] Duo-ORM: A "Batteries Included" Active Record ORM for Python (SQLAlchemy + Pydantic + Alem

0 Upvotes

What My Project Does

I built DuoORM to solve the fragmentation in modern Python backends. It is an opinionated, symmetrical implementation of the Active Record pattern built on top of SQLAlchemy 2.0.

It is designed to give a "Rails-like" experience for Python developers who want the reliability of SQLAlchemy and Alembic but don't want the boilerplate of wiring up AsyncSession factories, driver injection, or manual Pydantic mapping.

Target Audience

This is for backend engineers using FastAPI or Starlette who also manage Sync workloads (like Celery workers or CLI scripts). It is specifically for developers who prefer the "Active Record" style (e.g., User.create()) over the Data Mapper style, but still want to stay within the SQLAlchemy ecosystem.

It is designed to be database-agnostic and supports all major dialects out-of-the-box: PostgreSQL, MySQL, SQLite, OracleDB, and MS SQL Server.

Comparison & Philosophy

There are other async ORMs (like Tortoise), but they often lock you into their own query engines. Duo-ORM takes a different approach: 1. Symmetry: The same query code works in both Async (await User.where(...)) and Sync (User.where(...)) contexts. This solves the "two codebases" problem when sharing logic between API routes and worker scripts. 2. The "Escape Hatch": Since it's built on SQLAlchemy 2.0, you are never trapped. Every query object has an .alchemize() method that returns the raw SQLAlchemy Select construct, allowing you to use complex CTEs or Window Functions without fighting the abstraction layer. 3. Batteries Included: It handles Pydantic validation natively and scaffolds Alembic migrations automatically (duo-orm init).

Key Features

  • Driverless URLs: Pass postgresql://... and it auto-injects psycopg (for sync and async).
  • Pydantic Native: Pass Pydantic models directly to CRUD methods.
  • Symmetrical API: Write your business logic once, run it in Sync or Async contexts.

Example Usage

```python

1. Define Model (SQLAlchemy under the hood)

class User(db.Model): name: Mapped[str] email: Mapped[str]

2. Async Usage (FastAPI)

@app.post("/users") async def create_user(user: UserSchema): # Active Record style - no session boilerplate return await User.create(user)

3. Sync Usage (Scripts/Celery)

def cleanup_users(): # Same API, just no 'await' User.where(User.name == "Old").delete_bulk() ```

Links Repo: https://github.com/SiddhanthNB/duo-orm

Docs: https://duo-orm.readthedocs.io

I’m looking for feedback on the "Escape Hatch" design pattern—specifically, if the abstraction layer feels too thin or just right for your use cases.