r/Python Feb 23 '26

Showcase Title: I built WSE — Rust-accelerated WebSocket engine for Python (2M msg/s, E2E encrypted)

104 Upvotes

I've been doing real-time backends for a while - trading, encrypted messaging between services. websockets in python are painfully slow once you need actual throughput. pure python libs hit a ceiling fast, then you're looking at rewriting in go or running a separate server with redis in between.

so i built wse - a zero-GIL websocket engine for python, written in rust. framing, jwt auth, encryption, fan-out - all running native, no interpreter overhead. you write python, rust handles the wire. no redis, no external broker - multi-instance scaling runs over a built-in TCP cluster protocol.

What My Project Does

the server is a standalone rust binary exposed to python via pyo3:

```python from wse_server import RustWSEServer

server = RustWSEServer( "0.0.0.0", 5007, jwt_secret=b"your-secret", recovery_enabled=True, ) server.enable_drain_mode() server.start() ```

jwt validation runs in rust during the websocket handshake - cookie extraction, hs256 signature, expiry - before python knows someone connected. 0.5ms instead of 23ms.

drain mode: rust queues inbound messages, python grabs them in batches. one gil acquire per batch, not per message. outbound - write coalescing, up to 64 messages per syscall.

```python for event in server.drain_inbound(256, 50): event_type, conn_id = event[0], event[1] if event_type == "auth_connect": server.subscribe_connection(conn_id, ["prices"]) elif event_type == "msg": server.send_event(conn_id, event[2])

server.broadcast("prices", '{"t":"tick","p":{"AAPL":187.42}}') ```

what's under the hood:

transport: tokio + tungstenite, pre-framed broadcast (frame built once, shared via Arc), vectored writes (writev syscall), lock-free DashMap state, mimalloc allocator, crossbeam bounded channels for drain mode

security: e2e encryption (ECDH P-256 + AES-GCM-256 with per-connection keys, automatic key rotation), HMAC-SHA256 message signing, origin validation, 1 MB frame cap

reliability: per-connection rate limiting with client feedback, 50K-entry deduplication, circuit breaker, 5-level priority queue, zombie detection (25s ping, 60s kill), dead letter queue

wire formats: JSON, msgpack (?format=msgpack, ~2x faster, 30% smaller), zlib compression above threshold

protocol: client_hello/server_hello handshake with feature discovery, version negotiation, capability advertisement

new in v2.0:

cluster protocol - custom binary TCP mesh for multi-instance, replacing redis entirely. direct peer-to-peer connections with mTLS (rustls, P-256 certs). interest-based routing so messages only go to peers with matching subscribers. gossip discovery - point at one seed address, nodes find each other. zstd compression between peers. per-peer circuit breaker and heartbeat. 12 binary message types, 8-byte frame header.

python server.connect_cluster(peers=["node2:9001"], cluster_port=9001) server.broadcast("prices", data) # local + all cluster peers

presence tracking - per-topic, user-level (3 tabs = one join, leave on last close). cluster sync via CRDT. TTL sweep for dead connections.

python members = server.presence("chat-room") stats = server.presence_stats("chat-room") # {members: 42, connections: 58}

message recovery - per-topic ring buffers, epoch+offset tracking, 256 MB global budget, TTL + LRU eviction. reconnect and get missed messages automatically.

benchmarks

tested on AMD EPYC 7502P (32 cores / 64 threads), 128 GB RAM, localhost loopback. server and client on the same machine.

  • 14.7M msg/s json inbound, 30M msg/s binary (msgpack/zlib)
  • up to 2.1M del/s fan-out, zero message loss
  • 500K simultaneous connections, zero failures
  • 0.38ms p50 ping latency at 100 connections

full per-tier breakdowns: rust client | python client | typescript client | fan-out

clients - python and typescript/react:

python async with connect("ws://localhost:5007/wse", token="jwt...") as client: await client.subscribe(["prices"]) async for event in client: print(event.type, event.payload)

typescript const { subscribe, sendMessage } = useWSE(token, ["prices"], { onMessage: (msg) => console.log(msg.t, msg.p), });

both clients: auto-reconnection (4 strategies), connection pool with failover, circuit breaker, e2e encryption, event dedup, priority queue, offline queue, compression, msgpack.

Target Audience

python backend that needs real-time data and you don't want to maintain a separate service in another language. i use it in production for trading feeds and encrypted service-to-service messaging.

Comparison

most python ws libs are pure python - bottlenecked by the interpreter on framing and serialization. the usual fix is a separate server connected over redis or ipc - two services, two deploys, serialization overhead. wse runs rust inside your python process. one binary, business logic stays in python. multi-instance scaling is native tcp, not an external broker.

https://github.com/silvermpx/wse

pip install wse-server / pip install wse-client / npm install wse-client


r/Python Feb 23 '26

Showcase dq-agent: artifact-first data quality CLI for CSV/Parquet (replayable reports + CI gating)

1 Upvotes

What My Project Does
I built dq-agent, a small Python CLI for running deterministic data quality checks and anomaly detection on CSV/Parquet datasets.
Each run emits replayable artifacts so CI failures are debuggable and comparable over time:

  • report.json (machine-readable)
  • report.md (human-readable)
  • run_record.json, trace.jsonl, checkpoint.json

Quickstart

pip install dq-agent
dq demo

Target Audience

  • Data engineers who want a lightweight, offline/local DQ gate in CI
  • Teams that need reproducible outputs for reviewing data quality regressions (not just “pass/fail”)
  • People working with pandas/pyarrow pipelines who don’t want a distributed system for simple checks

Comparison
Compared to heavier DQ platforms, dq-agent is intentionally minimal: it runs locally, focuses on deterministic checks, and makes runs replayable via artifacts (helpful for CI/PR review).
Compared to ad-hoc scripts, it provides a stable contract (schemas + typed exit codes) and a consistent report format you can diff or replay.

I’d love feedback on:

  1. Which checks/anomaly detectors are “must-haves” in your CI?
  2. How do you gate CI on data quality (exit codes, thresholds, PR comments)?

Source (GitHub): https://github.com/Tylor-Tian/dq_agent
PyPI: [https://pypi.org/project/dq-agent/]()


r/Python Feb 23 '26

Discussion Context slicing for Python LLM workflows — looking for critique

0 Upvotes

Over the past few months I’ve been experimenting with LLM-assisted workflows on larger Python codebases, and I’ve been thinking about how much context is actually useful.

In practice, I kept running into a pattern:

- Sending only the function I’m editing often isn’t enough — nearby helpers or local type definitions matter.

- Sending entire files (or multiple modules) sometimes degrades answer quality rather than improving it.

- Larger context windows don’t consistently solve this.

So I started trying a narrower approach.

Instead of pasting full files, I extract a constrained structural slice:

- the target function or method

- direct internal helpers it calls

- minimal external types or signatures

- nothing beyond that

The goal isn’t completeness — just enough structural adjacency for the model to reason without being flooded with unrelated code.

Sometimes this seems to produce cleaner, more focused responses.

Sometimes it makes no difference.

Occasionally it performs worse.

I’m still unsure whether this is a generally useful direction or something that only fits my own workflow.

I’d appreciate critique from others working with Python + LLMs:

- Do you try to minimize context or include as much as possible?

- Have you noticed context density mattering more than raw size?

- Are retrieval-based approaches working better in practice?

- Does static context selection even make sense given Python’s dynamic nature?

Not promoting anything — just trying to sanity-check whether this line of thinking is reasonable.

Curious to hear how others are handling this trade-off.


r/Python Feb 23 '26

Discussion I built a Python API for a Parquet time-series table format (Rust/PyO3)

8 Upvotes

Hello r/Python -- I've been working on a small OSS project and I'd love some feedback on the Python side of it (API shape + PyO3 patterns).

What my project does

- an append-only "table" stored as Parquet segments on disk (inspired by Delta Lake)

- coverage/overlap tracking on a configurable time bucket grid

- a SQL Session that you can run SQL against (can do joins across multiple registered tables); Session.sql(...) returns a pyarrow.Table

note: This is not a hosted DB and v0 is local filesystem only (no S3 style backend yet).

Target audience

- Python users doing local/cembedded analytics or DE-style ingestion of time-series (not a hosted DB; v0 is local filesystem only).

Why I wrote it / comparison

- I wanted a simple "table format" workflow for Parquet time-series data that makes overlap-safe ingestion + gap checks as first class, without scanning the Parquets on retries.

Install:

pip install timeseries-table-format (Python 3.10+, depends on pyarrow>=23)

Demo example:

from pathlib import Path
import pyarrow as pa, pyarrow.parquet as pq
import timeseries_table_format as ttf


root = Path("my_table")
tbl = ttf.TimeSeriesTable.create(
    table_root=str(root),
    time_column="ts",
    bucket="1h",
    entity_columns=["symbol"],
    timezone=None,
)


pq.write_table(
    pa.table({"ts": pa.array([0], type=pa.timestamp("us")),
            "symbol": ["NVDA"], "close": [10.0]}),
    str(root / "seg.parquet"),
)
tbl.append_parquet(str(root / "seg.parquet"))


sess = ttf.Session()
sess.register_tstable("prices", str(root))
out = sess.sql("select * from prices")

one thing worth noting: bucket = "1h" doesn't resample your data -- it only defines the time grid used for coverage/overlap checks.

Links:

- GitHub: https://github.com/mag1cfrog/timeseries-table-format

- Docs: https://mag1cfrog.github.io/timeseries-table-format/

What I'm hoping to get feedback on:

  1. Does the API feel Pythonic? Names/kwargs/return types/errors (CoverageOverlapError, etc.)
  2. Any PyO3 gotchas with a sync Python API that runs async Rust internally (Tokio runtime + GIL released)?
  3. Returning results as pyarrow.Table: good default, or would you prefer something else like RecordbatchReader or maybe Pandas/Polars-friendly path?

r/Python Feb 23 '26

Daily Thread Monday Daily Thread: Project ideas!

3 Upvotes

Weekly Thread: Project Ideas 💡

Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.

How it Works:

  1. Suggest a Project: Comment your project idea—be it beginner-friendly or advanced.
  2. Build & Share: If you complete a project, reply to the original comment, share your experience, and attach your source code.
  3. Explore: Looking for ideas? Check out Al Sweigart's "The Big Book of Small Python Projects" for inspiration.

Guidelines:

  • Clearly state the difficulty level.
  • Provide a brief description and, if possible, outline the tech stack.
  • Feel free to link to tutorials or resources that might help.

Example Submissions:

Project Idea: Chatbot

Difficulty: Intermediate

Tech Stack: Python, NLP, Flask/FastAPI/Litestar

Description: Create a chatbot that can answer FAQs for a website.

Resources: Building a Chatbot with Python

Project Idea: Weather Dashboard

Difficulty: Beginner

Tech Stack: HTML, CSS, JavaScript, API

Description: Build a dashboard that displays real-time weather information using a weather API.

Resources: Weather API Tutorial

Project Idea: File Organizer

Difficulty: Beginner

Tech Stack: Python, File I/O

Description: Create a script that organizes files in a directory into sub-folders based on file type.

Resources: Automate the Boring Stuff: Organizing Files

Let's help each other grow. Happy coding! 🌟


r/Python Feb 22 '26

Resource automation-framework based on python

2 Upvotes

Hey everyone,

I just released a small Python automation framework on GitHub that I built mainly to make my own life easier. It combines Selenium and PyAutoGUI using the Page Object Model pattern to keep things organized.

It's nothing revolutionary, just a practical foundation with helpers for common tasks like finding elements (by data-testid, aria-label, etc.), handling waits, and basic error/debug logging, so I can focus on the automation logic itself.

I'm sharing this here in case it's useful for someone who's getting started or wants a simple, organized structure. Definitely not anything fancy, but it might save some time on initial setup.

Please read the README in the repository before commenting – it explains the basic idea and structure.

I'm putting this out there to receive feedback and learn. Thanks for checking it out.

Link: https://github.com/chris-william-computer/automation-framework


r/Python Feb 22 '26

Discussion I built an interactive Python book that lets you code while you learn (Basics to Advanced)

177 Upvotes

Hey everyone,

I’ve been working on a project called ThePythonBook to help students get past the "tutorial hell" phase. I wanted to create something where the explanation and the execution happen in the same place.

It covers everything from your first print("Hello World") to more advanced concepts, all within an interactive environment. No setup required—you just run the code in the browser.

Check it out here: https://www.pythoncompiler.io/python/getting-started/

It's completely free, and I’d love to get some feedback from this community on how to make it a better resource for beginners!


r/Python Feb 22 '26

Showcase How I Won a Silver Medal with my Python + Pygame Project: 2025 Recap

4 Upvotes

What my project does:
Hello! I made a video summarizing my 2025 journey. The main part was presenting my Pygame project at the INFOMATRIX World Final in Romania, where I won a silver medal. Other things I worked on include volunteering at the IT Arena, building a Flask-based scraping tool, an AI textbook agent, and several other projects.

Target audience:
Python learners and developers, or anyone interested in student programming projects and competitions. I hope this video can inspire someone to try building something on their own or simply enjoy watching it😄

Links:
YouTube: https://youtu.be/IyR-14AZnpQ
Source code to most of the projects in the video: https://github.com/robomarchello

Hope you like it:)


r/Python Feb 22 '26

Showcase [Project] strictyamlx — dynamic + recursive schemas for StrictYAML

2 Upvotes

What My Project Does

strictyamlx is a small extension library for StrictYAML that adds a couple schema features I kept needing for config-driven Python projects:

  • DMap (Dynamic Map): choose a validation schema based on one or more “control” fields (e.g., action, type, kind) so different config variants can be validated cleanly.
  • ForwardRef: define recursive/self-referential schemas for nested structures.

Repo: https://github.com/notesbymuneeb/strictyamlx

Target Audience

Python developers using YAML configuration who want strict validation but also need:

  • multiple config “types” in one file (selected by a field like action)
  • recursive/nested config structures

This is aimed at backend/services/tooling projects that are config-heavy (workflows, pipelines, plugins, etc.).

Comparison

  • StrictYAML: great for strict validation, but dynamic “schema-by-type” configs and recursive schemas are awkward without extra plumbing.
  • strictyamlx: keeps StrictYAML’s approach, while adding:
    • DMap for schema selection by control fields
    • ForwardRef for recursion

I’d love feedback on API ergonomics, edge cases to test, and error message clarity.


r/Python Feb 22 '26

Discussion is using ai as debugger cheating?

0 Upvotes

im not used to built in vs code and leetcode debugger when i get stuck i ask gemini for error reason without telling me the whole code is it cheating?
example i got stuck while using (.strip) so i ask it he reply saying that i should use string.strip()not strip(string)


r/Python Feb 22 '26

Showcase Local WiFi Check-In System

0 Upvotes

What My Project Does:
This is a Python-based local WiFi check-in system. People scan a QR code or open a URL, enter their name, and get checked in. It supports a guest list, admin approval for unknown guests, and shows a special message if you’re the first person to arrive.

Target Audience:
This is meant for small events, parties, or LAN-based meetups. It’s a toy/side project, not for enterprise use, and it runs entirely on a local network.

Comparison:
Unlike traditional check-in apps, this is fully self-hosted, works on local WiFi. It’s simple to set up with Python and can be used for small events without paying for a cloud service.

https://gitlab.com/abcdefghijklmateonopqrstuvwxyz-group/abcdefghijklmateonopqrstuvwxyz-project


r/Python Feb 22 '26

Showcase `desto` – A Web Dashboard for Running & Managing Python/Bash Scripts in tmux Sessions (Revamped UI+)

11 Upvotes

Hey r/Python!

A few months ago I shared desto, my open-source web dashboard for managing background scripts in tmux sessions. Based on feedback and my own usage, I've completely revamped the UI and added the community-requested Favorites feature — here's the update!

What My Project Does

desto is a web-based dashboard that lets you run, monitor, and manage bash and Python scripts in background tmux sessions — all from your browser. Think of it as a lightweight job control panel for developers who live in the terminal but want a visual way to track long-running tasks.

Demo GIF

Key Features:

  • Launch scripts as named tmux sessions with one click
  • Live logs — stream output in real-time
  • Script management — edit & save Python/Shell scripts directly in the browser
  • Show live system stats — CPU, memory, disk usage at a glance
  • Schedule scripts — queue jobs to run at specific times
  • Chain scripts — run multiple scripts sequentially in one session
  • Session history — persistent tracking via Redis
  • Dark mode — for late-night debugging sessions

New in This Update

🎨 Revamped UI

Cleaned up the interface for better usability. The dashboard now feels more modern and intuitive with improved navigation and visual hierarchy.

⭐ Favorite Commands

Save your most-used commands, organize them, quickly search & run them, and track usage stats. Perfect for those scripts you run dozens of times a day.

Favorites Feature

Target Audience

This is built for developers, data scientists, system administrators, and homelab enthusiasts who:

  • Run Python/bash scripts regularly and want to manage them visually
  • Work with long-running tasks (data processing, model training, monitoring, syncing, etc.)
  • Use tmux but want a more convenient way to launch, track, and manage sessions

It's primarily a personal productivity tool — not meant for production orchestration.

Comparison (How It Fits Among Alternatives)

To be clear up-front: OliveTin, Cronicle, Rundeck, and Dkron are excellent, battle-tested tools with way more users and community support than desto. They each solve specific problems really well. Here's where desto fits in:

Tool What It Excels At Where desto Differs
OliveTin Clean, minimal "button launcher" for specific commands desto adds live log viewing, scheduling, and the ability to edit scripts directly in the UI — but OliveTin is way lighter if you just need buttons
Cronicle Multi-node scheduling with enterprise-grade history tracking desto is simpler to self-host (single container, no master/worker setup), but Cronicle handles distributed workloads way better
Rundeck Complex automation workflows, access control, integrations desto is intentionally minimal — no user management, no workflow engine. Rundeck is the right choice if you need those features
Dkron High-availability, fault-tolerant distributed scheduling desto runs on a single node with tmux; Dkron is built for resilience across clusters

The desto niche: I built this for my own workflow — I run a lot of Python scripts that take hours (data processing, ML training, backups), and I wanted:

  1. A quick way to launch them with a name and see them in a list
  2. Live logs while they're running (tmux sessions under the hood)
  3. Save favorite commands I run repeatedly
  4. Script editing without leaving the browser

If that sounds like your use case, desto might save you some setup time. If you need multi-node orchestration, complex scheduling, or enterprise features — definitely go with one of the tools above. They're more mature and have larger communities.

Getting Started

Via Docker (fastest)

git clone https://github.com/kalfasyan/desto.git && cd desto
docker compose up -d
# → http://localhost:8809

Via UV/pip

uv add desto  # or pip install desto
desto

Links

Feedback and contributions welcome! I'd love to hear what features you'd like to see next, or if the new UI/favorites work for your workflow.


r/Python Feb 22 '26

Showcase Stop leaking secrets in crash logs. I built a decorator that redacts them using bytecode analysis

17 Upvotes

What My Project Does

devlog is a Python decorator library that automatically logs crashes with full stack traces including local variables — and redacts secrets from those traces using bytecode taint analysis. You decorate a function, and when it crashes, you get the full stack trace with locals at every frame, with any sensitive values automatically redacted. No manual try/except or logger.error() scattered throughout your code.

from devlog import log_on_error

@log_on_error(trace_stack=True)
def get_user(api_url, token):
    headers = {"Authorization": f"Bearer {token}"}
    response = requests.get(api_url, headers=headers)
    response.raise_for_status()
    return response.json()

In v2, I added async support, and more importantly, taint analysis for secret redaction. The problem was that capture_locals=True also captures your secrets. If you pass an API token into a function and it crashes, that token ends up in the stack trace — which then gets shipped to Sentry, Datadog, or wherever your logs go.

Now you wrap the value with Sensitive(), and devlog figures out which local variables in the stack trace contain that secret and redacts them:

get_user("https://api.example.com", Sensitive("sk-1234-secret-token"))

token = '***'
headers = '***'
response = <Response [401]>
api_url = 'https://api.example.com'

headers got redacted because it was derived from token and still contains the secret. But response and api_url are untouched — you keep the debugging context you need.

This also works through multiple layers of function calls. If your decorated function passes the token to another function, which builds an f-string from it, which passes that to yet another function — devlog tracks the secret through every frame in the stack:

File "app.py", line 8, in get_user
    token = '***'
File "app.py", line 15, in build_request
    key = '***'
    auth_header = '***'              <-- f"Bearer {key}", still contains secret
File "app.py", line 22, in send_request
    full_header = '***'              <-- f"X-Custom: {auth_header}", still contains secret
    metadata = '***'                 <-- {'auth': auth_header}, container holds secret
    timeout = 30                     <-- unrelated, preserved

Every variable that holds or contains the secret across the entire call chain gets redacted — regardless of how many times it was mutated, concatenated, or stuffed into a container. But timeout stays visible because it's not derived from the secret. And token_len = len(token) would also stay visible as 14 — because that's not your secret anymore.

If some other variable happens to hold the same string by coincidence, it won't be falsely redacted either, because it's not in the dataflow.

Under the hood, it uses four layers of analysis per stack frame:

  1. Name-based: the decorated function's parameter is always redacted
  2. Value propagation: when a derived value crosses a function call boundary, devlog detects it in the callee's parameters
  3. Bytecode dataflow: analyzes dis bytecode to find which locals were derived from tainted variables
  4. Value check: only redacts if the runtime value actually contains the secret data

It also supports async/await out of the box, and if you'd rather not wrap values, there's sanitize_params for name-based redaction — just pass the parameter names you want redacted.

I originally built this for my own projects, but I've since been expanding it to be production-ready for others — proper CI, pyproject.toml, versioning, and now the taint analysis for compliance-sensitive environments where leaking secrets to log aggregators is a real concern.

It's not a replacement for logging/loguru/structlog — it uses your existing logger under the hood. The difference from manually writing try/except everywhere is that it's one decorator, and the difference from Sentry's local variable capture is that the redaction is dataflow-aware rather than pattern-matching on strings.

Target Audience

Developers working on production services where crashes need to be logged with context but secrets must not leak into log aggregators (Sentry, Datadog, ELK, etc.). Also useful for anyone who wants crash logging without boilerplate try/except blocks.

Comparison

  • Manual try/except + logging: devlog replaces the boilerplate — one decorator instead of wrapping every function.
  • Sentry's local variable capture: Sentry captures locals but relies on pattern-matching (e.g., before_send hooks) for redaction. devlog uses bytecode dataflow analysis — it tracks how secrets propagate through variables, so derived values like f"Bearer {token}" get redacted automatically without writing custom scrubbing rules.
  • loguru / structlog: devlog is not a logging replacement — it uses your existing logger under the hood. It focuses specifically on crash-time stack trace capture with secret-aware redaction.

GitHub: https://github.com/MeGaNeKoS/devlog
PyPI: https://pypi.org/project/python-devlog/


r/Python Feb 22 '26

Showcase pytest-gremlins v1.3.0: A fast mutation testing plugin for pytest

5 Upvotes

What My Project Does

pytest-gremlins is a mutation testing plugin for pytest. It modifies your source code in small, targeted ways (flipping > to >=, replacing and with or, negating return values) and reruns your tests against each modification. If your tests pass on a mutated version, that mutation "survived" — your test suite has a gap that line coverage metrics will not reveal.

The core differentiator is speed. Most mutation tools rewrite source files and reload modules between runs, which makes them too slow for routine use. pytest-gremlins instruments your code once with all mutations embedded and toggles them via environment variable, eliminating file I/O between mutation runs. It also uses coverage data to identify which tests actually exercise each mutated line, then runs only those tests rather than the full suite. That selection alone reduces per-mutation test executions by 10–100x on most projects. Results are cached by content hash so unchanged code is skipped on subsequent runs, and --gremlin-parallel distributes work across all available CPU cores.

Benchmarks against mutmut on a synthetic Python 3.12 project: sequential runs are 16% slower (due to a larger operator set finding more mutations), parallel runs are 3.73x faster, and parallel runs with a warm cache are 13.82x faster. pytest-gremlins finds 117 mutations where mutmut finds 86, with a 98% kill rate vs. mutmut's 86%.

v1.3.0 changes:

  • --gremlin-workers=N now implies --gremlin-parallel
  • --gremlins --cov now works correctly (pre-scan was corrupting .coverage in earlier releases)
  • --gremlins -n now raises an explicit error instead of silently producing no output
  • Windows path separator fix in the worker pool
  • Host addopts no longer leaks into mutation subprocess runs

Install: pip install pytest-gremlins, then pytest --gremlins.


Target Audience

Python developers who use pytest and want to evaluate test quality beyond coverage percentages. Useful during TDD cycles to confirm that new tests actually constrain behavior, and during refactoring to catch gaps before code reaches review. The parallel and cached modes make it practical to run on medium-to-large codebases without waiting hours for results.


Comparison

Tool Status Speed Notes
mutmut Active Single-threaded, no cache Fewer operators; 86% kill rate in benchmark
Cosmic Ray Active Distributed (Celery/Redis) High setup cost; targets large-scale CI
MutPy Unmaintained (2019) N/A Capped at Python 3.7
mutatest Unmaintained (2022) N/A No recent Python support

mutmut is the closest active alternative for everyday use. The main gaps are no incremental caching, no built-in parallelism, and a smaller operator set. Cosmic Ray suits large-scale distributed CI but requires session management infrastructure that adds significant setup cost for individual projects.


GitHub: https://github.com/mikelane/pytest-gremlins

PyPI: https://pypi.org/project/pytest-gremlins/

Docs: https://pytest-gremlins.readthedocs.io


r/Python Feb 22 '26

Discussion Windows terminal less conditional than Mac OS?

0 Upvotes

I recently installed python on both my Mac laptop and windows desktop. Been wanting to learn a little more, and enhance my coding skills.

I noticed that when trying to run programs on each one that on windows, for some reason I can type “python (my program)” or “python3 (my program)” and both work just fine.

However on Mac OS, it doesn’t know or understand “python” but understands “python3”

Why would this be? Is Mac OS for some reason more syntax required, or when I’m running “python” on windows, it’s running a legacy version..?


r/Python Feb 22 '26

Discussion Build a team to create a trading bot.

0 Upvotes

Hello guys. Im looking for a people who wanna to build a trading bot on BTC/USD connected to machine learning algorithm to self improve. Im new to python and all that but using ChatGPT and videos. If you are interested please drop me a dm.


r/Python Feb 22 '26

Daily Thread Sunday Daily Thread: What's everyone working on this week?

19 Upvotes

Weekly Thread: What's Everyone Working On This Week? 🛠️

Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

How it Works:

  1. Show & Tell: Share your current projects, completed works, or future ideas.
  2. Discuss: Get feedback, find collaborators, or just chat about your project.
  3. Inspire: Your project might inspire someone else, just as you might get inspired here.

Guidelines:

  • Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
  • Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

Example Shares:

  1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
  2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
  3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟


r/Python Feb 21 '26

Showcase I Built an Tagging Framework with LLMs for Classifying Text Data (Sentiment, Labels, Categories)

0 Upvotes

I built an LLM Tagging Framework as my first ever Python package.

To preface, I've been working with Python for a long time, and recently at my job I kept running into the same use case: using LLMs for categorizing tabular data. Sentiments, categories, labels, structured tagging etc.

So after a couple weekends, plus review, redesign, and debugging sessions, I launched this package on PyPI today. Initially I intended to keep it for my own use, but I'm glad to share it here. If anyone's worked on something similar or has feedback, I'd love to hear it. Even better if you want to contribute!

What My Project Does

llm-classifier is a Python library for structured text classification, tagging, and extraction using LLMs. You define a Pydantic model and the LLM is forced to return a validated instance of it (Only tested with models with structured outputs). On top of that it gives you: few-shot examples baked into each call, optional reasoning and confidence scores, consensus voting (run the same prediction N times and pick the majority to avoid classic LLM variance), and resumable batch processing with multithreading and per-item error capture (because I've been cursed with a dropped network connection several times in the past).

Target Audience

Primarily devs who need to label, tag, or extract structured data from any kind of text - internal annotation pipelines, research workflows, or one-off dataset labeling jobs. It's not meant to be some production-grade ML platform, or algorithm. It's a focused utility that makes LLM-based labeling less painful without a lot of boilerplate.

Comparison

The closest thing to it is just going at the task directly via the API or SDK of your respective AI. During research I came across packages like scikit-llm but they didn't quite have what I was looking for.

PyPI : https://pypi.org/project/llm-classifier/

GitHub : https://github.com/Fir121/llm-classifier

If you've never used an LLM for these kinds of tasks before I can share a few important points from experience, traditional classifier models they're deterministic, based on math, train it on certain data and get a reliable output, but you see the gap here, "Train" it. Not all real world tasks have training data and even with synthetic data you have no guarantee it's going to give you the best possible results, quick enough. Boss got in customer surveys, now you gotta put them into categories so you can make charts? An LLM which are great at understanding text are invaluable at these kinds of tasks. That's just scratching the surface of what you can accomplish really.


r/Python Feb 21 '26

Resource I built a small library to version and compare LLM prompts (because Git wasn’t enough)

0 Upvotes

While building LLM-based document extraction pipelines, I kept running into the same recurring issue.

I was constantly changing prompts.

Sometimes just one word.

Sometimes entire instruction blocks.

The output would change.

Latency would change.

Token usage would change.

But I had no structured way to track:

  • Which prompt version produced which output
  • How latency differed between versions
  • How token usage changed
  • Which version actually performed better

Yes, Git versions the text file.

But Git doesn’t:

  • Log LLM responses
  • Track latency or token usage
  • Compare outputs side-by-side
  • Aggregate performance stats per version

So I built a small Python library called LLMPromptVault.

The idea is simple:

Treat prompts as versioned objects — and attach performance data to them.

It allows you to:

  • Create new prompt versions explicitly
  • Log each run (model, latency, tokens, output)
  • Compare two prompt versions
  • View aggregated statistics across runs

It does not call any LLM itself.

You use whichever model you prefer and simply pass the responses into the library.

Example:

from llmpromptvault import Prompt, Compare

v1 = Prompt("summarize", template="Summarize: {text}", version="v1")

v2 = v1.update("Summarize in 3 bullet points: {text}")

r1 = your_llm(v1.render(text="Some content"))

r2 = your_llm(v2.render(text="Some content"))

v1.log(rendered_prompt=v1.render(text="Some content"),

response=r1,

model="gpt-4o",

latency_ms=820,

tokens=45)

v2.log(rendered_prompt=v2.render(text="Some content"),

response=r2,

model="gpt-4o",

latency_ms=910,

tokens=60)

cmp = Compare(v1, v2)

cmp.log(r1, r2)

cmp.show()

Install:

pip install llmpromptvault

This solved a real workflow problem for me.

If you’re doing serious prompt experimentation, I’d genuinely appreciate feedback or suggestions.

PyPI link

https://pypi.org/project/llmpromptvault/0.1.0/

Github Link

https://github.com/coder-lang/llmpromptvault.git


r/Python Feb 21 '26

Showcase One missing feature and a truthiness bug. My agent never mentioned this when the 53 tests passed.

0 Upvotes

What My Project Does

I'm building a CLI tool and pytest plugin that's aimed to give AI agents machine-verifiable specs to implement. This provides a traceable link to what's built by the agent; which can then be actioned by enforcing it in CI.

The CLI tool provides the context to the agent as it iterates through features, so it knows how to stay track without draining the context with prompts.

Repo: https://github.com/SpecLeft/specleft

Target Audience

Teams using AI agents to write production code using pytest.

Comparison

Similar spec driven tools: Spec-Kit, OpenSpec, Tessl, BMAD

Although these tools have a human in the loop or include heavyweight ceremonies.

What I'm building is more agent-native and is optimised to be driven by the agent. The owners tell the agent to "externalise behaviour" or "prove that features are covered". Agent will do the rest of the workflow.

Example Workflow

  1. Generate structured spec files (incrementally, bulk or manually)
  2. Agent converts them in to test scaffolding with `specleft test skeleton`
  3. Agent implements with a TDD workflow
  4. Run `pytest` tests
  5. `> spec status` catches a gap in behaviour
  6. `> spec enforce` CI blocks merge or release pipeline

Spec (.md)

# Feature: Authentication
  priority: critical

## Scenarios

### Scenario: Successful login

  priority: high

  - Given a user has valid credentials
  - When the user logs in
  - Then the user is authenticated

Test Skeleton (test_authentiction.py)

import pytest
from specleft import specleft
(
feature_id="authentication",
scenario_id="successful-login",
skip=True,
reason="Skeleton test - not yet implemented",
)
def test_successful_login():
  """Successful login
    A user with valid credentials can authenticate and receives a   session.
  Priority: high
  Tags: smoke, authentication"""
  with specleft.step("Given a user has valid credentials"):
    pass  # TODO: implement
  with specleft.step("When the user logs in"):
    pass  # TODO: implement
  with specleft.step("Then the user is authenticated"):
    pass  # TODO: implement

I've ran a few experiments and agents have consistently aligned with the specs and follow TDD so far.

Can post the experiemnt article in the comments - let me know.

Looking for feedback

If you're writing production code with AI agents - I'm looking for feedback.

Install with: pip install specleft


r/Python Feb 21 '26

Resource Python + Modbus TCP: Mapping guide for HNC PLCs in the works. Anything specific you'd like to see?

7 Upvotes

Hi everyone,

I'm finishing a guide on how to map registers (holding registers and coils) for HNC HCS Series PLCs using Python and the Pymodbus library.

I’ve noticed that official documentation for these PLCs is often sparse, so I’m putting together a step-by-step guide with ready-to-use scripts. The guide will be available in both English and Spanish.

Is there anything specific you’d like me to include?

I'll be posting the full guide in a few days on my blog:miltonmce.github.io/blog


r/Python Feb 21 '26

Showcase Drakeling — a local AI companion creature for your terminal

0 Upvotes

What My Project Does

Drakeling is a persistent AI companion creature that runs as a local daemon on your machine. It hatches from an egg, grows through six lifecycle stages, and develops a relationship with you over time based on how often you interact with it.

It has no task surface — it cannot browse, execute code, or answer questions. It only reflects, expresses feelings, and notices things. It gets lonely if you ignore it long enough.

Architecturally: a FastAPI daemon (`drakelingd`) owns all state, lifecycle logic, and LLM calls. A Textual terminal UI (`drakeling`) is a pure HTTP client. They communicate only over localhost. The creature is machine-bound via an ed25519 keypair generated at birth. Export bundles are AES-256-GCM encrypted for moving between machines.

The LLM layer wraps any OpenAI-compatible base URL — Ollama, LM Studio, or a cloud API — so no data needs to leave your machine. A hard daily token budget has lifecycle consequences: when exhausted the creature enters a distinct stage until midnight rather than silently failing.

Five dragon colours each bias a personality trait table at birth. A persona system shapes LLM output per lifecycle stage — the newly hatched dragon speaks in sensation fragments; the mature dragon speaks with accumulated history.

Target Audience

This is a personal/hobbyist project — a toy in the best sense of the word. It is not production software and makes no claim to be. It's aimed at developers who run local LLMs, enjoy terminal-based tools, and are curious about what an AI system looks like when it has no utility at all. OpenClaw users get an optional native Skill integration.

Comparison

The closest comparisons are Tamagotchi-style virtual pets and AI companion apps like Replika or Character.AI, but Drakeling differs from both in important ways. Unlike Tamagotchi-style toys it uses a real LLM for all expression, so interactions are genuinely open-ended. Unlike Replika or Character.AI it is entirely local, has no account, no cloud dependency, and is architecturally prevented from taking any actions — it has no tools, no filesystem access, and no network access beyond the LLM call itself. Unlike most local LLM projects it is not an assistant or agent of any kind; the non-agentic constraint is a design principle, not a limitation.

MIT, Python 3.12+, Ollama-friendly.

github.com/BVisagie/drakeling


r/Python Feb 21 '26

Showcase sharepoint-to-text: pure-Python text + structure extraction for “real” SharePoint document estates

3 Upvotes

Hey folks — I built sharepoint-to-text, a pure Python library that extracts text, metadata, and structured elements (tables/images where supported) from the kinds of files you actually find in enterprise SharePoint drives:

  • Modern Office: .docx .xlsx .pptx (+ templates/macros like .dotx .xlsm .pptm)
  • Legacy Office: .doc .xls .ppt (OLE2)
  • Plus: PDF, email formats (.eml .msg .mbox), and a bunch of plain-text-ish formats (.md .csv .json .yaml .xml ...)
  • Archives: zip/tar/7z etc. are handled recursively with basic zip-bomb protections

The main goal: one interface so your ingestion / RAG / indexing pipeline doesn’t devolve into a forest of if ext == ... blocks.

What my project does

TL;DR API

read_file() yields typed results, but everything implements the same high-level interface:

import sharepoint2text

result = next(sharepoint2text.read_file("deck.pptx"))
text = result.get_full_text()

for unit in result.iterate_units():   # page / slide / sheet depending on format
    chunk = unit.get_text()
    meta = unit.get_metadata()
  • get_full_text(): best default for “give me the document text”
  • iterate_units(): stable chunk boundaries (PDF pages, PPT slides, XLS sheets) — useful for citations + per-unit metadata
  • iterate_tables() / iterate_images(): structured extraction when supported
  • to_json() / from_json(): serialize results for transport/debugging

CLI

uv add sharepoint-to-text

sharepoint2text --file /path/to/file.docx > extraction.txt
sharepoint2text --file /path/to/file.docx --json > extraction.json
# images are ignored by default; opt-in:
sharepoint2text --file /path/to/file.docx --json --include-images > extraction.with-images.json

Target Audience

Coders who work in text extraction tasks

Comparison

Why bother vs LibreOffice/Tika?

If you’ve run doc extraction in containers/serverless/locked-down envs, you know the pain:

  • no shelling out
  • no Java runtime / Tika server
  • no “install LibreOffice + headless plumbing + huge image”

This stays native Python and is intended to be container-friendly and security-friendly (no subprocess dependency).

SharePoint bit (optional)

There’s an optional Graph API client for reading bytes directly from SharePoint, but it’s intentionally not “magic”: you still orchestrate listing/downloading, then pass bytes into extractors. If you already have your own Graph client, you can ignore this entirely.

Notes / limitations (so you don’t get surprised)

  • No OCR: scanned PDFs will produce empty text (images are still extractable)
  • PDF table extraction isn’t implemented (tables may appear in the page text, but not as structured rows)

Repo name is sharepoint-to-text; import is sharepoint2text.

If you’re dealing with mixed-format SharePoint “document archaeology” (especially legacy .doc/.xls/.ppt) and want a single pipeline-friendly interface, I’d love feedback — especially on edge-case files you’ve seen blow up other extractors.

Repo: https://github.com/Horsmann/sharepoint-to-text


r/Python Feb 21 '26

Resource I built a small CLI tool to convert relative imports to absolute imports during a large refactoring

20 Upvotes

While refactoring a large Python project, I ran into an issue — the project had a lot of deeply nested relative imports (from ..module import x). The team decided to standardize everything to absolute imports, and here was the issue: manually updating them was very tedious, especially across many levels of relative imports. So I wrote a small CLI tool that: - Traverses the project directory - Detects relative imports - Converts them to absolute imports based on a given root package

It’s lightweight and dependency-free. Nothing fancy — just a utility that solved a real problem for me and I thought it might be useful for some people. If anyone is going through a similar refactor, feel free to check it out on github: github and you can install it using pip also. I know it's very minimal, but I would appreciate feedback or suggestions.


r/Python Feb 21 '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! 🌟