PythonHub
2.61K subscribers
2.35K photos
50.4K links
News & links about Python programming.
https://pythonhub.dev/
Download Telegram
Python: how time-machine is O(1) where freezegun is O(n)

A benchmark shows Python’s time-machine library stays O(1) when mocking time, while freezegun scales O(n) with the number of loaded module attributes and becomes dramatically slower as projects grow. The difference comes from time-machine swapping CPython function pointers directly, while freezegun scans loaded modules to replace references to date and time functions.

https://adamj.eu/tech/2026/08/03/python-time-machine-o1-freezegun-on/
2
Celery: from first task to advanced recipes

The article introduces Celery, a distributed task queue for Python, then walks through practical patterns for running, routing, batching, timing out, and retrying asynchronous tasks. It also covers advanced recipes such as preventing parallel execution with Redis locks and integrating Celery tasks with Python’s async/await workflows.

https://sgolev.github.io/blog/2026-07-28-celery-recipes/
👍1
Introducing Flex: Let the Model Write the Code

DSPy’s new Flex module allows optimizers like GEPA to improve programs by rewriting both their instructions and underlying Python code. This lets the optimizer route easy cases to fast deterministic code while reserving model calls for ambiguity, significantly reducing cost and latency while improving accuracy.

https://www.cmpnd.ai/blog/let-the-model-write-the-code.html
Agent Memory Guard

Agent Memory Guard is an OWASP Incubator Project that prevents AI agents from being weaponized through their own memory. It implements MITRE ATLAS mitigation AML.M0031 (Memory Hardening) to defend against context poisoning attacks (AML.T0080).

https://github.com/OWASP/www-project-agent-memory-guard
👀2
Model Genome: Fingerprinting Whether an LLM Was Trained From Scratch or Derived

Outsiders can assess whether a foundation model was truly built from scratch by analyzing architecture configurations, tokenizer overlap, and weight embeddings using a reproducible fingerprinting pipeline. While architecture and tokenizer artifacts provide the strongest evidence, weight analysis has limitations and cannot cleanly distinguish continued pretraining from training from scratch.

https://huggingface.co/blog/mayafree/model-dna
Python: introducing emojet, a fast emoji lookup library

emojet is an emoji library for Python: it converts between emoji and their names, in both directions, plus the searching and lookup functions that go with that. It covers the core API of the emoji package, a library that been available for this job since 2014, using the same names and the same data. The difference is that emojet does the work in Rust, running 3.5x faster for conversion, ...

https://adamj.eu/tech/2026/08/12/python-introducing-emojet/
👍3
A quick look at zero-knowledge proofs

In this post, the authors break down non-cryptocurrency zero-knowledge proofs (ZKPs) using graph theory and Python. By implementing Protocol 4 from Goldreich, Micali, and Wigderson, they show how a prover uses randomized color permutations, nonces, and cryptographic hashes to iteratively prove they hold a valid 3-coloring for a graph without revealing the actual solution to the verifier.

https://bernsteinbear.com/blog/zkp/
🤯1
From Routing Checks to Trajectory Testing: Evaluating an Agentic Chatbot

Traditional chatbot testing that checks only final responses misses many agent failures, so this article builds an evaluation framework that progresses from routing checks and task completion to full trajectory testing of tool use, conversations, and intermediate actions. It also shows how to combine LLM-as-a-judge evals, multi-turn testing, and telemetry to debug agent behavior and vali...

https://edcrewe.blogspot.com/2026/08/from-routing-checks-to-trajectory.html
👍1🤔1
Two lines of Python that segfault the interpreter

Two lines of Python could crash CPython 3.14 through 3.16 because SETADD assumed it was always operating on a real set, while PEP 749 madeconditionalannotationsrebindable from Python code. The post explains how that assumption broke, why it caused a type-confusion crash, and why stable releases and the development branch needed different fixes.

https://deadlovelll.github.io/2026-08-10-conditional-annotations-set-add-crash/
1
Composite: The Pattern Behind Menus, File Systems and Games

The Composite pattern lets you treat individual objects and entire object hierarchies through the same interface, making tree-like structures much easier to manage. Using a simple Python game engine, the video demonstrates how this pattern naturally applies to game scenes, UI frameworks, file systems, menus, and similar hierarchical designs.

https://www.youtube.com/watch?v=ss6je4-nDx8
2👍1
Numba in the Browser: Unlocking a New Scientific Python Stack in JupyterLite

Numba now runs entirely in the browser through JupyterLite, compiling Python functions to WebAssembly with a new LLVM-based execution engine and delivering substantial performance gains without a server. The work also unlocks browser-native support for the broader Numba ecosystem, including PyMC, PyTensor, and other scientific computing libraries.

https://notebook.link/blog/numba-in-the-browser/
🙏2