Issue #689: Design Patterns, Signals, TorchAudio, and More (July 8, 2025)

#689 – JULY 8, 2025

Design Patterns You Should Unlearn in Python

The Gang of Four design patterns specify object oriented solutions to common issues in code, except Python doesn’t have many of the problems the solutions are aiming to solve. This article talks about some of the common patterns and the easier ways to solve the problems they intend to address in Python. See also Part 2.
RACEYCHAN

Signals: State Management for Python Developers

If you’ve ever debugged why your cache didn’t invalidate or notifications stopped firing after a “simple” state change, this guide is for you. Signals are becoming a JavaScript standard, but Python developers can use the same patterns to eliminate “forgot to update that thing” bugs.
TUAN ANH BUI • Shared by Tuan Anh Bui

Prevent Postgres Slowdowns on Python Apps with this Check List

Avoid performance regressions in your Python app by staying on top of Postgres maintenance. This monthly check list outlines what to monitor, how to catch slow queries early, and ways to ensure indexes, autovacuum, and I/O are performing as expected →
PGANALYZE sponsor

Use TorchAudio to Prepare Audio Data for Deep Learning

Learn to prepare audio data for deep learning in Python using TorchAudio. Explore how to load, process, and convert speech to spectrograms with PyTorch tools.
REAL PYTHON

Quiz: Use TorchAudio to Prepare Audio Data for Deep Learning

REAL PYTHON

PyPy v7.3.20 Release

PYPY.ORG

Django Bugfix Release 5.2.4

DJANGO SOFTWARE FOUNDATION

Articles & Tutorials

Solving Problems and Saving Time in Chemistry With Python

What motivates someone to learn how to code as a scientist? How do you harness the excitement of solving problems quickly and make the connection to the benefits of coding in your scientific work? This week on the show, we speak with Ben Lear and Christopher Johnson about their book “Coding For Chemists.”
REAL PYTHON podcast

Django’s Ecosystem

The Django library’s website has added a new page called “Django’s Ecosystem”. It has two parts: a source of resources for more information and a detailed package listing. The package listing is broken down by type and includes debugging tools, static file management, API development, and much more.
DJANGO SOFTWARE FOUNDATION

Workshop: Unpack OWASP Top 10 LLMs with Snyk

Join Snyk and OWASP Leader Vandana Verma Sehgal on Tuesday, July 15 at 11:00AM ET for a live session covering: ✓ The top LLM vulnerabilities ✓ Proven best practices for securing AI-generated code ✓ Snyk’s AI-powered tools automate and scale secure dev. See live demos plus earn 1 CPE credit! here →
SNYK.IO sponsor

Use Keyword-Only Arguments in Dataclasses

Python dataclasses are a really nice feature for constructing classes that primarily hold or work with data. This post describes a small tip: using the kw_only=True aspect to enforce keyword arguments. See also the associated HN discussion.
CHRISTIAN HAMMOND

Application Logging in Python: Recipes for Observability

The logging module is powerful, but it can be somewhat complex. This tutorial covers structured JSON output, centralizing logging configuration, using contextvars to automatically enrich your logs with request-specific data, and other useful patterns for your observability needs.
AYOOLUWA ISAIAH • Shared by Ayooluwa Isaiah

Escaping Contravariance Hell

Ever used a Python type checker and got a frustrating error message like “This violates the Liskov substitution principle?” This post explains why “contravariance” is the underlying issue and how to deal with it.
QUANSIGHT.ORG • Shared by Marco Gorelli

Python for Nonprofits

This article and code demonstrates how to use Python to retrieve, analyze, visualize, and share nonprofit data. Even if you’re not dealing with nonprofits, the advice is useful to any data project.
GITHUB.COM/KBURCHFIEL

How to Migrate Your Python & Django Projects to uv

This post shows you one way of migrating an existing project to uv, including how to update your pyproject.toml file and what changes you might need to make if you use Docker.
TOBIAS MCNULTY

Dashboards With FastAPI, MongoDB, and WebSockets

This tutorial looks at how to develop a real-time order dashboard with FastAPI, MongoDB, and WebSockets to stream live data updates from the backend to the frontend.
ABDULAZEEZ ABDULAZEEZ ADESHINA • Shared by Mike Herman

Django Annual Impact Report

Every year the Django Software Foundation releases a report on its activities, including key milestones, community narratives, and what is coming in the future.
DJANGO SOFTWARE FOUNDATION

Python 3.14 Preview: Template Strings (T-Strings)

Python 3.14 introduces t-strings: a safer, more flexible alternative to f-strings. Learn how to process templates securely and customize string workflows.
REAL PYTHON

Quiz: Python 3.14 Preview: Template Strings (T-Strings)

REAL PYTHON

Implementing the Factory Method Pattern in Python

Learn how to use the Factory Method pattern in Python, when to apply it, how to refactor your code for it, and explore a reusable implementation.
REAL PYTHON course

Projects & Code

copier: Library and CLI for Rendering Project Templates

GITHUB.COM/COPIER-ORG

dataclasses-json: Serialize Data Classes to and From JSON

GITHUB.COM/LIDATONG

deltacycle: Discrete Event Simulation

GITHUB.COM/CJDRAKE

pyleak: Detect Leaked Asyncio Tasks, Threads, and More

GITHUB.COM/DEEPANKARM

ovld: Advanced Multiple Dispatch for Python Functions

GITHUB.COM/BREULEUX

Events

Weekly Real Python Office Hours Q&A (Virtual)

July 9, 2025
REALPYTHON.COM

Python Leiden User Group

July 10, 2025
PYTHONLEIDEN.NL

Python Atlanta

July 10 to July 11, 2025
MEETUP.COM

PyDelhi User Group Meetup

July 12, 2025
MEETUP.COM

DFW Pythoneers 2nd Saturday Teaching Meeting

July 12, 2025
MEETUP.COM

EuroPython 2025

July 14 to July 21, 2025
EUROPYTHON.EU

PyHEP.dev 2025

July 14 to July 18, 2025
CERN.CH

PyLadies Amsterdam: AI in Action: From ML Models to Games

July 15, 2025
MEETUP.COM

Happy Pythoning!
This was PyCoder’s Weekly Issue #689.
View in Browser »

[ Subscribe to 🐍 PyCoder’s Weekly 💌 – Get the best Python news, articles, and tutorials delivered to your inbox once a week >> Click here to learn more ]

Source:: PyCoder’s