Python Trending Weekly
ISSUE 123

You Probably Don't Need the Singleton Pattern

2025-10-18 Season 5

TL;DR

A hands-on guide to Python 3.14's free-threading shows how to kill the GIL in practice, while the singleton pattern gets a well-earned takedown; Tencent's Hunyuan3D and the AP2 agent payments protocol lead the AI pack.

Articles 12 Projects 12 Media 3
🦄

Articles & Tutorials

× 12
01 Creating a Singleton Class in Python And Why You (Probably) Don't Need It thepythoncodingstack.com

Using a game leaderboard as an example, this article dives deep into the singleton pattern concept and implementation, with a focus on the clever technique of using the __new__() method for object creation. While the singleton pattern is commonly used in other languages, Python offers more elegant alternatives—since modules themselves are natural singletons, using global variables and functions is often more graceful.

02 Understanding Weak References in Python blog.codingconfessions.com

A comprehensive exploration of Python's weak reference mechanism in memory management, starting from the fundamentals of reference counting and analyzing how circular references lead to memory leaks. Through linked list node examples, it demonstrates the difference between strong and weak references, explaining how weak references can reference objects without preventing garbage collection—particularly useful for caching and subscriber list scenarios.

03 Lazy imports using wrapt grahamdumpleton.me

This article introduces how to leverage wrapt 2.0.0's new LazyObjectProxy feature for lazy module imports, implementing the PEP-810 proposal shared in a previous issue. Unlike traditional approaches, it doesn't modify the global sys.modules, only affecting the scope where lazy imports are used, avoiding global side effects.

04 Using Async Functions in Celery with Django Connection Pooling mrdonbrown.blogspot.com

An in-depth analysis of compatibility issues between Django 5.1 connection pooling and Celery async tasks, providing detailed explanations of Django ORM async call mechanisms. It reveals how sync_to_async uses global thread executors leading to connection leaks, and offers a complete solution based on ThreadSensitiveContext, including custom @async_task decorators and prefork mode handling strategies.

05 Killing the GIL: How To Use Python 3.14's Free-Threading Upgrade neelsomaniblog.com

Python 3.14 removes the GIL to achieve true multithreaded parallelism. This article analyzes the historical reasons for the GIL, limitations of traditional concurrency models, and provides detailed compilation guides and performance testing. Through N-Queens benchmarks, it demonstrates an 8x performance boost on M1 Pro, while explaining considerations for C extension recompilation and thread safety.

06 Handy Python REPL Modifications treyhunner.com

Customize your Python 3.13+ REPL experience through PYTHONSTARTUP files and the pyrepl-hacks library. The article shows how to add custom keyboard shortcuts, syntax highlighting themes, and convenient code editing features, making the REPL feel more like a modern editor.

07 Let's Talk About UUID Security in Python cnblogs.com

A deep dive into security vulnerabilities and attack methods across different Python UUID versions, detailing the generation logic of UUIDv1-v8, revealing security differences between PRNG and CSPRNG, introducing practical attack techniques like Sandwich Attack, and providing comprehensive attack workflows and protection recommendations.

08 Free-threaded Python on GitHub Actions hugovk.dev

GitHub Actions now supports experimental free-threaded CPython testing. The article covers three configuration methods: using the 't' suffix, setup-uv, and freethreaded variables, providing complete CI configuration examples and environment variable setup.

09 Why, in 2025, do we still need a 3rd party app to write a REST API with Django? emma.has-a.blog

Challenging conventional wisdom, this article demonstrates how to build a complete REST API using only Django's built-in features. The author cleverly implements serialization through JsonViewMixin and ModelForm, combined with generic class views for CRUD operations, proving that DRF isn't always necessary for elegant API functionality in simple scenarios.

10 Bring Python ASGI to Your Node.js Applications blog.platformatic.dev

Introducing an innovative technical solution that allows Python ASGI applications to run directly within Node.js processes. Through a Rust-built bridge layer, it achieves zero network overhead in-process communication without needing separate Python processes or network connections. This architecture is particularly suited for low-latency AI/ML application scenarios while supporting mainstream Python frameworks like FastAPI and Django.

11 Power-up API Testing with EchoAPI's AI geekpython.in

How is AI technology revolutionizing API testing workflows? This article introduces EchoAPI, which supports natural language descriptions of testing requirements to automatically generate executable scripts and assertions, intelligently analyzes API response structures, automatically creates test cases covering edge cases, and generates dynamic variables and mock data.

Power-up API Testing with EchoAPI's AI
12 Time deltas are not intuitive mostlypython.com

While developing a time tracking application, the author discovered a common pitfall with timedelta objects: using only the seconds attribute when calculating durations across days yields incorrect results. The article explains in detail how Python normalizes time differences into three attributes—days, seconds, and microseconds—revealing why you need to use the total_seconds() method or manually calculate (days * 24) + (seconds / 3600) to get accurate hour counts.

🐿️

Projects & Resources

× 12
01 Helium: Private, fast, and honest web browser github.com

A privacy-focused browser built on Chromium with Google components removed, featuring optimal privacy settings and ad blocking by default. Supports split-screen browsing and tab group management, compatible with macOS, Linux, and Windows. (5K stars)

02 Cronboard: A terminal-based dashboard for managing cron jobs github.com

A terminal-based cron job management tool built with Textual, supporting both local and remote servers. Provides task creation, editing, deletion, and pause functionality with SSH connection support and server bookmarks.

03 Paper2Video: Automatic Video Generation from Scientific Papers github.com

Developed by the National University of Singapore, this tool converts LaTeX papers into complete presentation videos. Integrates slide creation, speech synthesis, and virtual presenter features, supporting GPT-4 and Gemini. (1K stars)

04 boilerplates: This is my personal template collection. Here you'll find templates, and configurations for various tools, and technologies. github.com

A production-ready template collection featuring best practice templates for Docker, Terraform, Ansible, Kubernetes, and more. Includes CLI tools for rapid project structure generation. (6.8K stars)

05 ChatGPT-API-Scanner: Scan GitHub for available OpenAI API Keys github.com

A security research tool for scanning OpenAI API keys on GitHub, using Selenium and regex for deep searching with results stored in SQLite database. Intended for security research purposes only.

06 ChatGPT-Micro-Cap-Experiment: This repo powers my blog experiment where ChatGPT manages a real-money micro-cap stock portfolio github.com

A 6-month real trading experiment where ChatGPT manages a micro-cap stock portfolio. Features trading engine, portfolio management, automated stop-loss, and provides transparent performance tracking with visualization analytics. (6.5K stars)

07 cs249r_book: Introduction to Machine Learning Systems github.com

Harvard University's open-source machine learning systems textbook covering the complete tech stack from edge devices to cloud deployment. Offers online reading, PDF format, and TinyTorch educational framework. (3.4K stars)

08 MineContext: MineContext is your proactive context-aware AI partner github.com

ByteDance's Volcano Engine context-aware AI agent that understands users' digital world through screenshots. Features local-first privacy protection and compatibility with Doubao, OpenAI, and other model services. (1.8K stars)

MineContext: MineContext is your proactive context-aware AI partner
09 TradingAgents-CN: Multi-Agent Financial Trading Framework github.com

A Chinese financial trading framework based on multi-agent large language models, supporting A-share, Hong Kong, and US stock analysis. Integrates multiple LLMs and provides intelligent news analysis with Docker deployment. (10.8K stars)

10 AP2: Agent Payments Protocol github.com

Google's AI agent payment protocol featuring dual verification mechanisms to ensure secure agent purchases on behalf of users. Supports both traditional payments and cryptocurrency transactions. (2.3K stars)

11 Hunyuan3D-2.1: From Images to High-Fidelity 3D Assets with Production-Ready PBR Material github.com

Tencent's first production-grade 3D asset generation model that creates high-fidelity 3D models from images using PBR material synthesis technology. Fully open-sourced model weights and training code. (2.3K stars)

12 PRPs-agentic-eng: Prompts, workflows and more for agentic engineering github.com

An AI engineering resource library optimized for Claude Code, providing Product Requirements Prompts (PRP) methodology with 12 pre-configured commands and complete template systems for production-ready code generation by AI agents. (1.7K stars)

🐢

Podcasts & Videos

× 3
ESC
↑↓ select · ↵ open175 issues