---
title: "Python"
description: "252 posts about Python, summarised, each linking to the original."
---

# Python
> 252 posts about Python, summarised, each linking to the original.

## Articles

### [You don’t need to pick one: how Sentry and OpenTelemetry work together](https://yomu.fyi/post/you-don-t-need-to-pick-one-how-sentry-and-opentelemetry-work-together.md)
- Company: [Sentry](https://yomu.fyi/company/sentry.md)
- Author: Lazar Nikolov
- Published: May 27, 2026
- Type: Explainer

Integrating Sentry into systems already instrumented with OpenTelemetry does not require replacing existing backend SDKs or rewriting service instrumentation. A hybrid architecture pairs the Sentry SDK on the frontend for browser tracing, Session Replay, and logs with existing OpenTelemetry configurations across backend services. Frontend requests propagate W3C traceparent headers to backend endpoints, which then export traces and logs over OTLP directly to Sentry endpoints or through an intermediate OpenTelemetry Collector. Ingested telemetry attaches backend spans and standard Python logs to the initial frontend user actions, establishing a unified distributed trace across the entire request path. Although Sentry's OTLP ingest currently supports logs and traces rather than metrics, dedicated backend Sentry SDKs remain an optional addition later for backend exception tracking and profiling.


### [Introducing Arrow UDFs in PySpark: A Faster, Leaner Replacement for Pandas UDFs](https://yomu.fyi/post/introducing-arrow-udfs-in-pyspark-a-faster-leaner-replacement-for-pand.md)
- Company: [Databricks](https://yomu.fyi/company/databricks.md)
- Author: Ruifeng Zheng, Yicong Huang
- Published: May 20, 2026
- Type: Explainer

Apache Spark’s Pandas UDFs improve Python UDF throughput through Arrow-based serialization and batching, but Pandas/Arrow conversion can add copies, limit zero-copy behavior, and weaken support for complex datatypes. Native Arrow UDFs, introduced in Databricks Runtime 18.0, operate directly on Arrow data without converting inputs to Pandas or NumPy objects, preserving columnar layout and enabling vectorized processing through Arrow’s compute and memory model. The new @arrow\_udf decorator supports scalar, aggregate, and table functions, while type-hinted @udf definitions, mapInArrow, and applyInArrow extend the interface to DataFrame and grouped operations; iterator-based modes can amortize initialization costs. In a comparison, an Arrow UDF ran about 10% faster than a Pandas UDF and used about 40% less memory, with better complex-datatype support.


### [MemEx: A Programmable Scratchpad for LLM Agents](https://yomu.fyi/post/memex-a-programmable-scratchpad-for-llm-agents.md)
- Company: [Databricks](https://yomu.fyi/company/databricks.md)
- Author: The Databricks AI Research Team
- Published: May 19, 2026
- Type: Explainer

MemEx addresses the context-window bottleneck in LLM agents, where large tool outputs persist in the shared prompt even when later steps need only a small portion. It gives the agent a persistent, typed Python kernel: tool results remain as objects in scope, code can filter, summarize, and compose them, and only printed values are materialized as context tokens. MemEx preserves existing Tool Calling schemas while adding typed submit(), persistent state, backend-agnostic execution, and asynchronous spawn\_agent() sub-agents, enabling multi-step workflows and parallel trajectory analysis. Across nine-model evaluations on OfficeQA Pro and Enterprise Structured Retrieval, it was reported as better and cheaper than parallel structured Tool Calling; examples include roughly 10-point OfficeQA gains for some models and Qwen structured-retrieval accuracy rising from 18% to 36% and 20% to 38% at lower token cost.


### [Promptimus: Improving already good LLM prompts with zero manual engineering](https://yomu.fyi/post/promptimus-improving-already-good-llm-prompts-with-zero-manual-enginee.md)
- Company: amazon.science
- Author: Zhengyuan Shen, Yunfei Bai, Sullam Jeoung, Shuai Wang
- Published: May 14, 2026
- Type: Problem & solution

Enterprise applications rely on mature large language model prompts that incorporate intricate business logic and regulatory constraints, making further optimization and cross-model migration challenging. Promptimus automates prompt refinement through a four-step iterative loop that evaluates candidate prompts against decomposed metric checkpoints, diagnoses failure bottlenecks, and generates targeted improvement strategies. The system operates either via full prompt rewrites in standard mode or through surgical, programmatic find-and-replace edits in edit mode to preserve structured taxonomies and schemas. Tested across multimodal classification and code generation tasks, the framework achieves performance gains with small development datasets of 20 to 50 samples. Amazon is making the model-agnostic optimization system available through Amazon Bedrock to support enterprise generative-AI model migration without manual engineering.


### [DeepInfra on Hugging Face Inference Providers 🔥](https://yomu.fyi/post/deepinfra-on-hugging-face-inference-providers.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: Aray Sultanbekova, Shang-Pin, Utemuratov, Yessen K, Oguz Vuruskaner, Célina Hanouti, Simon Brandeis, Lucain Pouget
- Published: Apr 29, 2026
- Type: Announcement

DeepInfra is now a supported Inference Provider on the Hugging Face Hub, adding its serverless inference platform and catalog of more than 100 models to model pages and client integrations. The initial integration supports conversational and text-generation tasks, with access to open-weight LLMs including DeepSeek V4, Kimi-K2.6, and GLM-5.1; support for text-to-image, text-to-video, embeddings, and other tasks will roll out soon. Users can configure provider API keys and preferences in account settings, or authenticate with a Hugging Face token so requests are routed through Hugging Face, including from the Python and JavaScript SDKs and supported agent harnesses. Direct requests are billed by the provider, while routed requests use standard provider API rates without additional markup, and Hugging Face PRO users receive $2 of monthly Inference credits.


### [How to build scalable web apps with OpenAI's Privacy Filter](https://yomu.fyi/post/how-to-build-scalable-web-apps-with-openai-s-privacy-filter.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: yuvraj sharma, Freddy Boulton, Abubakar Abid
- Published: Apr 27, 2026
- Type: Tutorial

The article presents three web applications built around OpenAI’s open-source Privacy Filter, a PII detector that labels eight categories in one forward pass over a 128k-token context. Document Privacy Explorer extracts PDF or DOCX text and returns category-labeled spans, while Image Anonymizer combines Tesseract word boxes with character offsets to produce editable pixel redaction rectangles. SmartRedact Paste replaces detected spans with category placeholders, stores public and token-gated views, and evicts expired pastes in a daemon thread. Across the apps, gradio.Server’s @server.api routes model work through Gradio’s queue and gradio\_client, while plain FastAPI routes serve custom HTML, views, and lightweight lookups. The implementations keep browser-side filtering, canvas edits, and PNG export out of server round-trips, and the paste service is about 200 lines including storage.


### [Flow generation through natural language: An agentic modeling approach](https://yomu.fyi/post/flow-generation-through-natural-language-an-agentic-modeling-approach.md)
- Company: [Shopify](https://yomu.fyi/company/shopify.md)
- Author: 2023-10-18
- Published: Apr 22, 2026
- Type: Explainer

Shopify built a tool-calling agent for Sidekick that converts natural-language requests into Shopify Flow workflows, addressing the cold-start problem by working backward from thousands of anonymized production workflows. The team generated synthetic queries and tool trajectories, fine-tuned Qwen3-32B, and changed Flow’s nested JSON DSL into an equivalent Python representation connected by a round-trip transpiler. Using Python improved syntactic correctness by 22 points and semantic correctness by 13 points on a 300-example benchmark, while matching production tool names, ordering, responses, and prompts proved essential to avoid degradation. Production evaluation exposed a 35% gap masked by benchmark parity, so Shopify built a weekly feedback loop that scores conversations, filters training data, identifies slice gaps, retrains, and deploys. The resulting agent serves most production traffic, runs 2.2 times faster at 68% lower cost, and outperforms closed models.


### [How Yelp Keeps Server-Driven UI Consistent Across Four Platforms](https://yomu.fyi/post/how-yelp-keeps-server-driven-ui-consistent-across-four-platforms.md)
- Company: [Yelp](https://yomu.fyi/company/yelp.md)
- Author: Radu Comaneci, Software Engineer
- Published: Apr 22, 2026
- Type: Problem & solution

Yelp maintains two major applications across Web, iOS, and Android, which previously led to fragmented server-driven UI implementations with mismatched backend component representations. To unify its server-driven UI framework, CHAOS, with its cross-platform design system, Cookbook, Yelp built an automated bridge library called Konbini. Konbini reads centralized JSON interface definitions through Jenkins pipelines to automatically generate synchronized libraries for Python, Kotlin, Swift, and TypeScript. These generated libraries handle component serialization on the backend and deserialization on client platforms. To maintain backward compatibility when component interfaces introduce breaking changes, client requests pass versioned spec identifiers, prompting the backend to execute migration methods that downcast newer component models to older supported versions.


### [Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers](https://yomu.fyi/post/training-and-finetuning-multimodal-embedding-reranker-models-with-sent.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: Tom Aarsen
- Published: Apr 16, 2026
- Type: Tutorial

Sentence Transformers provides a Python library for training and using embedding and reranker models across text, images, audio, and video in retrieval and semantic search applications. The post shows how to finetune multimodal models on task-specific data, using Visual Document Retrieval as the example: matching text queries with document page images while preserving charts, tables, and layout. It describes the SentenceTransformerTrainer pipeline, model and processor configuration, dataset handling, and alternative Router-based encoders, while also covering multimodal reranker training with BinaryCrossEntropyLoss and direction-specific datasets. On its evaluation data, finetuning Qwen/Qwen3-VL-Embedding-2B raised NDCG@10 from 0.888 to 0.947 and outperformed all tested VDR models, including models up to 4x its size.


### [Build Better AI Agents: 5 Developer Tips from the Agent Bake-Off](https://yomu.fyi/post/build-better-ai-agents-5-developer-tips-from-the-agent-bake-off.md)
- Company: [Google](https://yomu.fyi/company/google.md)
- Author: Frank Guan, Abraham Gomez
- Published: Apr 14, 2026
- Type: Tutorial

The Google Cloud AI Agent Bake-Off is presented as a test of building autonomous agents under severe time constraints for e-commerce, banking modernization, and startup go-to-market problems. Its five patterns recommend decomposing monolithic prompts into specialized sub-agents under a supervisor, designing modularly because model capabilities can quickly replace custom harnesses, and treating multimodality as native. It also advocates open protocols—including MCP, A2A, UCP, AP2, A2UI, and AG-UI—for agent and tool connections instead of bespoke wrappers. Finally, it separates probabilistic reasoning from execution: strict JSON schemas such as Pydantic validate LLM outputs before deterministic Python functions or SQL perform calculations and writes. The stated conclusion is that reliable production agents depend on rigorous software architecture rather than elaborate prompts or flashy single-shot demos.


### [Multimodal Embedding & Reranker Models with Sentence Transformers](https://yomu.fyi/post/multimodal-embedding-reranker-models-with-sentence-transformers.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: Tom Aarsen
- Published: Apr 9, 2026
- Type: Tutorial

Sentence Transformers v5.4 adds multimodal embedding and reranking support for text, images, audio, and video through its Python API. Embedding models map modalities into a shared space, while multimodal Cross Encoder rerankers score relevance for mixed-modality pairs, enabling cross-modal similarity, retrieval, and multimodal RAG workflows. The guide shows model loading, URL-based image encoding, encode\_query() and encode\_document() prompt handling, similarity calculation, and ranking, with a Qwen3-VL-Embedding-2B example producing 2,048-dimensional image vectors and matching text queries to images. It notes that cross-modal scores can be lower because of the modality gap, while relative ordering can still support retrieval, and that rerankers generally offer higher quality at the cost of slower per-pair processing; installation extras and GPU memory requirements vary by modality and model.


### [Any Custom Frontend with Gradio's Backend](https://yomu.fyi/post/any-custom-frontend-with-gradio-s-backend.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: yuvraj sharma, Abubakar Abid
- Published: Apr 1, 2026
- Type: Tutorial

gradio.Server enables applications built with React, Svelte, or plain HTML/JavaScript to use Gradio’s backend facilities instead of Gradio components. The post demonstrates this with Text Behind Image, whose browser UI layers a background, styled text, and a transparent foreground produced by BiRefNet, then exports a PNG client-side. A roughly 50-line Python backend extends FastAPI, exposes a standard HTML route, and defines an @app.api("remove\_background") endpoint; @spaces.GPU handles ZeroGPU allocation while Gradio supplies queuing, concurrency control, SSE streaming, and gradio\_client compatibility. The frontend calls the endpoint through the Gradio JavaScript client, so image-processing requests pass through the queue while rendering and compositing remain in the browser. The result is a custom frontend that retains Spaces hosting and Gradio infrastructure.


### [Designing the new async-native ClickHouse Python client](https://yomu.fyi/post/designing-the-new-async-native-clickhouse-python-client.md)
- Company: [Clickhouse](https://yomu.fyi/company/clickhouse.md)
- Author: Joe Spadola
- Published: Mar 16, 2026
- Type: Problem & solution

The official ClickHouse Python client, clickhouse-connect, originally addressed asynchronous execution by wrapping its synchronous HTTP client in a thread pool executor. However, this executor model experienced thread exhaustion, GIL contention, and severe tail latency variance under heavy concurrent workloads. To resolve these scalability bottlenecks, the developers redesigned the client around a half-sync/half-async pattern utilizing aiohttp for async network I/O. A custom bounded queue bridges streaming socket reads on the event loop with synchronous, CPU-intensive binary parsing running inside background threads. Benchmarks demonstrate that this architecture stabilizes tail latencies, delivering an average P95 latency of 556 milliseconds compared to 869 milliseconds for the legacy executor client.


### [Announcing chDB 4: write Pandas, run ClickHouse, now on Hex](https://yomu.fyi/post/announcing-chdb-4-write-pandas-run-clickhouse-now-on-hex.md)
- Company: [Clickhouse](https://yomu.fyi/company/clickhouse.md)
- Author: Ryadh Dahimene, Auxten Wang
- Published: Mar 11, 2026
- Type: Announcement

chDB 4 introduces Data Store, a native component that allows users to write Pandas-like code that executes on the ClickHouse OLAP SQL engine. Standard Pandas workflows suffer from eager execution, excessive memory materialization, and lack of automatic query optimizations. To solve this, Data Store implements a four-layer architecture that lazily records operations as a chain of LazyOp objects and compiles them into optimized ClickHouse SQL plans upon evaluation triggers. When encountering operations unsupported by ClickHouse, the QueryPlanner splits the pipeline into segments, routing tasks between ClickHouse and Pandas while using Python's memoryview to minimize data copying overhead. This release also integrates natively into Hex notebooks.


### [Introducing Storage Buckets on the Hugging Face Hub](https://yomu.fyi/post/introducing-storage-buckets-on-the-hugging-face-hub.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: Lucain Pouget, Eliott Coyac, Adrien Carreira, Victor Mustar, Julien Chaumond, Quentin Lhoest, Pierric Cistac, Sylvestre Bcht, Hugo Larcher, Rajat Arya, Di Xiao, Assaf Vayner
- Published: Mar 10, 2026
- Type: Announcement

Hugging Face introduces Storage Buckets as a mutable, S3-like object storage layer on the Hub for intermediate machine-learning artifacts such as checkpoints, optimizer states, processed shards, logs, and traces. Unlike versioned Models and Datasets repositories, Buckets support frequent writes, overwrites, directory synchronization, and cleanup while retaining standard Hub permissions and public or private visibility. Built on Xet, they chunk and deduplicate content across files, reducing repeated bytes, bandwidth, transfer time, and, for Enterprise customers, billed storage. The CLI and Python APIs support creation, syncing, dry runs, plans, inspection, individual file operations, and programmatic workflows; HfFileSystem and fsspec also allow compatible libraries to read and write through hf:// paths. Pre-warming can place hot data near AWS or GCP compute, while roadmap work aims to connect Buckets directly with versioned repos.


### [Introducing Modular Diffusers - Composable Building Blocks for Diffusion Pipelines](https://yomu.fyi/post/introducing-modular-diffusers-composable-building-blocks-for-diffusion.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: YiYi Xu, Alvaro Somoza, Dhruv Nair, Sayak Paul
- Published: Mar 5, 2026
- Type: Announcement

Modular Diffusers introduces a composable alternative to Diffusers’ existing DiffusionPipeline for building diffusion workflows from reusable blocks. A ModularPipeline can load a workflow definition, load model components separately with settings such as bfloat16, and preserve the familiar inference API, while blocks for text encoding, image encoding, denoising, and decoding can be inspected, run independently, or rearranged. Custom Python blocks declare components, inputs, outputs, and computation logic; the example adds a Depth Anything V2 depth processor to a Qwen Image ControlNet workflow, with data flowing between compatible blocks. Blocks and complete pipelines can be published to the Hub, and Mellon can generate node interfaces from their consistent definitions. The post presents the system as an early, flexible direction and says Mellon is not ready for production use.


### [Train AI models with Unsloth and Hugging Face Jobs for FREE](https://yomu.fyi/post/train-ai-models-with-unsloth-and-hugging-face-jobs-for-free.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: ben burtenshaw, Daniel (Unsloth), Michael Han, Maxime Labonne, Daniel van Strien, shaun smith
- Published: Feb 20, 2026
- Type: Tutorial

The post presents a workflow for fine-tuning the LiquidAI/LFM2.5-1.2B-Instruct small language model with Unsloth on Hugging Face Jobs, including optional use of Claude Code, Codex, or another coding agent. It explains that Unsloth is described as providing about 2x faster training and 60% lower VRAM use than standard methods, while the model runs under 1GB of memory and is optimized for on-device deployment. The tutorial covers claiming free Hugging Face Jobs credits through the Unsloth Jobs Explorers organization, installing the hf CLI or a model-training skill, and submitting a job with a dataset, GPU flavor, timeout, and output repository. An agent can generate a UV training script using 4-bit loading and LoRA, submit the managed cloud-GPU job, report Trackio monitoring details, and push the trained model to the Hugging Face Hub.


### [One-Shot Any Web App with Gradio's gr.HTML](https://yomu.fyi/post/one-shot-any-web-app-with-gradio-s-gr-html.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: yuvraj sharma, hysts, Freddy Boulton
- Published: Feb 18, 2026
- Type: Tutorial

The post presents Gradio 6’s gr.HTML as a way to build interactive web components in a single Python file, combining custom HTML templates, scoped CSS, and JavaScript interactivity without a separate build step. It describes applications including a Pomodoro timer, contribution heatmap, Kanban board, spinning wheel, and machine-learning viewers for detection, 3D camera control, and speech transcription. Within the component API, ${value} injects Python state into the template, props.value updates that state from JavaScript, and trigger('change') synchronizes it back to Python; CSS keyframes and native HTML5 drag events supply richer behavior. For reuse, a gr.HTML subclass packages the templates and script so the result can be used like built-in Gradio components, while reload mode and Spaces deployment support rapid iteration from generated code to a live app.


### [Building a Movie Recommendation Engine with Hugging Face and Voyage AI](https://yomu.fyi/post/building-a-movie-recommendation-engine-with-hugging-face-and-voyage-ai.md)
- Company: [MongoDB](https://yomu.fyi/company/mongodb.md)
- Author: Arek Borucki
- Published: Feb 17, 2026
- Type: Tutorial

Traditional movie search mechanisms depend on coarse filters such as genre, actor, or title, which fail to capture emotional context and narrative nuances. This guide demonstrates building a mood-based semantic recommendation system by combining the voyage-4-nano open-weights embedding model, Hugging Face datasets, and MongoDB Atlas Vector Search. The architecture uses Sentence Transformers to generate embeddings and exposes an endpoint through FastAPI to match user moods against movie plots. Truncating the Matryoshka embeddings from 2048 to 1024 dimensions balances semantic retrieval quality, storage footprint, and query latency. Testing shows that while abstract emotional queries return moderate similarity scores around 0.62 to 0.67, concrete descriptive queries exceed 0.75 without requiring exact keyword matches.


### [Introducing Daggr: Chain apps programmatically, inspect visually](https://yomu.fyi/post/introducing-daggr-chain-apps-programmatically-inspect-visually.md)
- Company: [Hugging Face](https://yomu.fyi/company/hugging-face.md)
- Author: merve, yuvraj sharma, Abubakar Abid, hysts, Pedro Cuenca
- Published: Jan 29, 2026
- Type: Announcement

Building AI applications that connect multiple models and APIs often results in fragile scripts or requires complex production orchestration tools. To address rapid experimentation needs, Daggr introduces an open-source Python library created by the Gradio team for chaining AI workflows programmatically. Developers define workflows in Python code using components like GradioNode, FnNode, and InferenceNode, which automatically generate an interactive visual canvas served on port 7860. The interface allows users to inspect intermediate outputs, modify inputs, rerun individual pipeline steps without complete re-execution, and maintain persistent state across workspaces called sheets. Currently in beta, Daggr supports local execution with automatic fallback to remote APIs and integrates directly with Hugging Face Spaces.


[Newer posts](https://yomu.fyi/topic/python/page/4.md) · [Older posts](https://yomu.fyi/topic/python/page/6.md)
