Python Weekly (Issue 704 June 19 2025)

In partnership with

Turn AI Hype Into Business Impact

AI is more than just using ChatGPT.

It’s about understanding how the technology works—and applying it in practical ways to solve real business problems.

The AI for Business & Finance Certificate Program from Wall Street Prep + Columbia Business School Exec Ed helps you move beyond the hype.

You’ll demystify today’s most important tools and learn just enough Python to streamline workflows, automate tasks, and make smarter decisions.

No coding experience needed—you’ll get step-by-step guidance from world-class faculty.

👉 Save $300 with code SAVE300.


Articles, Tutorials and Talks

The video explains how to use the Model Context Protocol (MCP) to connect your APIs and external tools with AI language models like ChatGPT or Claude, enabling them to interact with real-world data and services. It covers two main architectural patterns for MCP integration, provides practical Python code examples, and offers tips for building scalable, maintainable MCP servers for AI applications.

The author explores 11 different methods for detecting vowels in a string using Python, benchmarking their performance and analyzing their underlying implementation, including Python bytecode and regex internals. The results show that for short strings, a simple loop is fastest, but for longer strings, regex-based approaches outperform others due to their optimized C-level implementation, with further optimizations possible by reordering loops or using Python’s built-in find method.

A benchmark on RPython's garbage collector shows it can allocate objects at speeds up to 34.3 GB/s for uninitialized and 29.7 GB/s for initialized allocations on modern hardware, thanks to a simple bump-pointer fast path. In comparison, the Boehm GC achieves only about 1.5 GB/s, highlighting the efficiency of RPython's allocation strategy.

The article explains how "signals" enable reactive state management in Python by automatically tracking dependencies and updating derived values, reducing manual coordination and bugs in complex systems. It highlights when signals are beneficial—such as in applications with cascading state changes—and provides practical patterns, mental model shifts, and optimizations for integrating signals into Python projects.

The article explains how KV (Key-Value) caching in large language models (LLMs) speeds up text generation by storing and reusing intermediate computations, significantly improving inference efficiency. It provides a step-by-step, from-scratch code implementation of a KV cache, highlighting both its computational benefits and increased memory requirements during production use.

The article demonstrates how to use Alpine.js and AJAX with Django to create interactive, client-side web applications that efficiently handle dynamic data updates without full page reloads. It provides practical examples and code snippets for integrating Alpine.js with Django views, serializers, and templates to enhance user experience through seamless frontend-backend communication.

This article discusses how failing inserts in PostgreSQL, particularly due to unique constraint violations in a Django application, can cause significant performance issues and database overhead. It recommends using ON CONFLICT DO NOTHING in PostgreSQL or Django's bulk_create with ignore_conflicts=True to prevent these problems.

The video is a comprehensive tutorial on building and deploying an AI agent using Python and Docker containers, covering everything from Docker fundamentals to integrating FastAPI, Postgres, LangChain, and LangGraph for multi-agent systems. It walks viewers through local development, containerization, and deployment to platforms like Railway and DigitalOcean, enabling scalable, production-ready AI agent applications.

The post explores how Python can now call Mojo code, offering a promising way to speed up Python functions with a simple compiled language. While still early and showing some rough edges like overflow issues, Mojo demonstrates significant performance gains in examples like prime counting, making it an exciting tool for Python developers seeking faster execution.

The article argues that the rise of LLMs is making it less appealing to design new domain-specific languages (DSLs), since LLMs excel at generating code in popular languages like Python but struggle with niche DSLs. It explores how language designers might adapt by teaching LLMs about DSLs, integrating informal and formal workflows, and focusing on verified specification languages, but warns that without innovation, language design could stagnate as developers default to mainstream languages.

Python dictionaries preserve insertion order starting from version 3.6 (as an implementation detail) and this became a guaranteed language feature in Python 3.7 and later, meaning items will appear in the order they were added. However, while dictionaries now maintain insertion order, order is not considered a defining characteristic—dictionaries with the same key-value pairs but different insertion orders are still considered equal, unlike sequences where order is fundamental.

The article provides a hands-on coding guide to the Dual EC DRBG cryptographic backdoor, showing how the NSA-designed algorithm allowed attackers with secret knowledge to predict random outputs and decrypt secure communications. It explains the math behind the backdoor, demonstrates its practical exploitation in Python, and highlights the real-world risks of insecure random number generators in cryptography.

The author experiments with storing images in DNS TXT records by converting image data to hex, splitting it into 2048-character chunks, and creating a protocol-like method for retrieval and reconstruction. The process demonstrates both the feasibility and practical limitations of this approach, including DNS record size constraints and the need for custom scripts to upload, fetch, and reassemble the image from DNS.

Global variables in Python bytecode are resolved dynamically at runtime using a global store, unlike local variables which are accessed by index for speed—this allows for Python’s flexible and dynamic behavior. The VM uses the LOAD_GLOBAL instruction to look up global variable names in the global store, enabling features like monkey patching and runtime modification, but introducing an extra level of indirection compared to locals.


Interesting Projects, Tools, and Libraries

A lightweight, powerful framework for multi-agent workflows.

A Flexible, Lightweight API-Gateway written in python that can be used as an ASGI middleware, app, or decorators.

Give your local LLM a real memory with a lightweight, fully local memory system — just like a human recalling past discussions. 100% offline. 100% under your control.

AI Data infrastructure providing a declarative, incremental approach for multimodal workloads.

Sourcerer is a CLI-based cloud storage explorer that provides a unified interface for developers and DevOps engineers to view and manage files across multiple cloud providers like GCP Storage, Azure Storage, AWS S3, and S3-compatible services.

The power of Claude Code + [Gemini Pro / Flash / O3 / Grok / OpenRouter / Ollama / Custom Model / All Of The Above] working as one.

A reimplementation of Stable Diffusion 3.5 in pure PyTorch.

The world's first open-weight, large-scale hybrid-attention reasoning model.


New Releases

This release includes the following announcements:

  • Python chat tools

  • Language Server based terminal suggest in the Python REPL

  • Create Project from a template in the Python Environments extension

  • PyEnv and Poetry support in the Python Environments extension

  • Controlled rollout of the Python Environments extension


Upcoming Events and Webinars

There will be following talks

  • Using data to drive positive change in local communities

  • Scaling for Insight: Lessons from 17 Billion Rows in Convenience Retail

During this workshop, you will learn how to leverage the ScaleDown Python package to optimize AI prompts, reduce token usage, and minimize your AI applications' carbon footprint.

OpenAI’s new API-addressable image generation capabilities and retrieval augmented image generation.

There will be a talk, Only You Can Prevent Data Fires - Getting Proactive About Data Quality.

There will be a talk, Marimo: Next Generation Notebooks.


Our Other Newsletters

Programmer Weekly - A free weekly newsletter for programmers.

Founder Weekly - A free weekly newsletter for entrepreneurs featuring best curated content, must read articles, how to guides, tips and tricks, resources, events and more.