Python Weekly (Issue 735 March 5 2026)

Welcome to issue 735 of Python Weekly. Let's get straight to the links this week.

Learn AI in 5 minutes a day

What’s the secret to staying ahead of the curve in the world of AI? Information. Luckily, you can join 2,000,000+ early adopters reading The Rundown AI — the free newsletter that makes you smarter on AI with just a 5-minute read per day.


Articles, Tutorials and Talks

The post explores how Egglog’s e-graph framework can be extended with custom container data structures to represent algebraic structures (like multisets) more efficiently and reduce expression blow-up during rewriting. It shows that by embedding structural invariants into the data representation and using higher-order functions, you can express powerful rewrite rules without explosive growth in the e-graph size.

Learn how different type checkers handle empty containers in Python, including Pyrefly, Ty, Pyright and Mypy.

Walk through Karpathy's 200-line GPT from scratch. Tokenize names into integers, watch softmax convert scores to probabilities, step through backpropagation on a computation graph, explore attention heatmaps, and see a tiny model learn to generate plausible names.

The post shows how to make complex pytest.mark.parametrize data more readable and maintainable by wrapping each test case in small helper functions instead of raw tuples. It also demonstrates using pytest.param with custom IDs inside those helpers so long, messy parameter values become clear, concise test names that are easier to work with.

The post is a long-form thread introducing a step-by-step “quant desk” style approach to simulating prediction market contracts, starting from a simple biased coin model and building up to Monte Carlo simulations with runnable Python code. It explains how to estimate event probabilities and confidence intervals, then evaluate model quality with metrics like Brier score, while stressing that real prediction markets violate the naive assumptions used in basic asset-price simulations.

When LLM providers ship breaking changes, a poor architecture turns a config tweak into a 400-line PR. This post introduces seam-driven design - five narrow interfaces (provider, prompt, tools, config, observability) each independently swappable - illustrated with a working FastAPI + LangChain reference app, a practical checklist, and two hands-on drills readers can run immediate

The video demonstrates seven powerful, lesser-known techniques using Python dataclasses, including automatic class registration, lightweight validation, cached derived values, and context manager patterns. It also shows practical uses such as CLI generation and explains advanced features like InitVar, highlighting how dataclasses can enable cleaner and more expressive Python designs.

The article argues that confusing APIs like Python’s os.path.commonprefix() should be deprecated because their misleading naming and placement cause developers to misuse them and introduce security vulnerabilities. It shows how decades of confusion around this function led to real path-traversal bugs and concludes that unsafe or misleading APIs should be replaced by clearer alternatives like os.path.commonpath().

The article shows how to securely serve private user files stored in Amazon S3 from a Django app by keeping the bucket private and generating time-limited pre-signed URLs when a user is authorized to access a file. This approach lets S3 handle file delivery directly while Django controls access, avoiding slow proxying through the app server and making the system more scalable.

The article explains how scikit-learn is adopting the Python Array API standard, allowing machine-learning code to run on different array libraries (NumPy, PyTorch, CuPy) without rewriting algorithms. This enables the same scikit-learn models to automatically leverage accelerators like GPUs and improves interoperability across the scientific Python ecosystem.

The article shows how to use tox to test a Django app across multiple Python and Django versions by creating isolated environments that install specific dependency combinations and run the same test suite. By defining a version matrix in tox.ini, developers can automatically verify compatibility across many Django releases and catch packaging or environment issues before users encounter them.

Python doesn't have tuple, frozenset, or Counter comprehensions, but you can invent your own by passing a generator expression to any iterable-accepting callable.

One of the most common tasks of any organization is reviewing data to ensure that it is accurate and does not contain errors. Commonly, this is done by producing graphs or summary information like a median or mean and confirming that it looks reasonable. Pointblank is a newer tool that allows you to really dig into a dataset and task assumptions in a robust and reproducible manner.

Got benchmarks in CI? You can (maybe) use tests to catch performance changes even earlier.

Learn FastAPI error handling with different types, methods, and best practices. Build robust APIs using custom exception handlers and practical examples.


Interesting Projects, Tools, and Libraries

Bash is all you need - A nano Claude Code–like agent, built from 0 to 1.

Timber compiles trained tree-based models (XGBoost, LightGBM, scikit-learn, CatBoost, ONNX) into optimized native C and serves them over a local HTTP API.

A general-purpose sandbox platform for AI applications, offering multi-language SDKs, unified sandbox APIs, and Docker/Kubernetes runtimes for scenarios like Coding Agents, GUI Agents, Agent Evaluation, AI Code Execution, and RL Training.

Python bindings for access to the on-device model at the core of Apple Intelligence through the Foundation Models framework.

Hermes Agent is an open-source autonomous AI agent that you install on your own server or machine, where it lives persistently, learns over time, and builds reusable skills and memory across sessions instead of resetting like typical chatbots.

Transform geospatial relations into graphs for Graph Neural Networks and network analysis.

The Resume Tailor is a small tool used to quickly and automatically tailor your resume to a job description. This allows you to have the best odds of getting your resume into the hands of actual humans.

MedKit is a high-performance, unified SDK that transforms fragmented medical APIs into a single, programmable platform. It provides a clean interface for OpenFDA, PubMed, and ClinicalTrials.gov, augmented with a clinical intelligence layer and relationship mapping.

A specialized Claude Code workspace for creating long-form, SEO-optimized blog content for any business. This system helps you research, write, analyze, and optimize content that ranks well and serves your target audience.

Code-Graph-RAG builds knowledge graphs from multi-language codebases and enables AI-powered querying and editing. It uses Tree-sitter to parse ASTs across 11 languages, stores structural data in Memgraph, and translates natural language questions into Cypher graph queries. Unlike vector-based RAG, it preserves exact code relationships: call chains, inheritance hierarchies, and module dependencies.

sync/async iterable streams for Python.

The spreadsheet engine that actually evaluates formulas. Parse, evaluate, and mutate Excel workbooks from Rust, Python, or the browser.


New Releases

New security releases for 3.10, 3.11 and 3.12 are now available. (As these Python versions are now in security-fix-only mode, these are source-only releases, and there is no pre-set release cadence.)

The Django team issued security updates for versions 6.0.3, 5.2.12, and 4.2.29 to address a moderate-severity Denial-of-Service vulnerability in URLField on Windows and a low-severity race condition affecting file system permissions. Users are strongly encouraged to upgrade immediately to remediate these flaws, specifically CVE-2026-25673 and CVE-2026-25674.


Upcoming Events and Webinars

There will be a talk, Python Debugger.

There will be a talk, Red, Green, Prompt: Redefining the TDD Cycle in the Age of AI.

There will be following talks

  • Why Your Models Fail: Learning from Regime Shifts in Real Data

  • Training Small Language Models with Knowledge Distillation

There will be a talk, AI In the Real World: What Works, What Fails, and What Actually Matters.

There will be following talks

  • RAAD - A timetable optimizer build in Python.

  • The optimisation engine behind tail assignment.


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.