PythonPro #69: 14 Advanced Python Features, Understanding the CPython Compiler, and Unvibe for LLM Code Quality
Welcome to a brand new issue of PythonPro!
News Highlights: Unvibe, a Python test-runner, uses unit tests and tree search to improve LLM-generated code; Rowboat debuts as an open-source IDE for multi-agent systems with custom LLM support; and pipdeptree 2.26.1 adds improved Python package dependency visualisation.
My top 5 picks from today’s learning resources:
And, in From the Cutting Edge, we introduces gdeltnews, an open-source Python tool that reconstructs full newspaper articles from GDELT’s fragmented n-gram data, enabling researchers to access large-scale, structured news corpora at near-zero cost with high reconstruction accuracy.
Stay awesome!
Divya Anne Selvaraj
Editor-in-Chief
🐍 Python in the Tech 💻 Jungle 🌳
🗞️News
Unvibe: A Python Test-Runner that forces LLMs to generate correct code: The Python library uses unit tests as a reward signal to guide LLMs in generating correct code through a tree search approach, improving code quality in large existing projects without endless prompt tweaking.
Rowboat – Open-source IDE for multi-agent systems: Powered by OpenAI’s Agents SDK, the platform supports custom LLM providers like LiteLLM and OpenRouter, integrates via HTTP API or Python SDK, and includes a UI for managing tools and servers.
pipdeptree 2.26.1 released: This command-line utility for visualising Python package dependencies as a tree, helps detect conflicts, circular dependencies, and outdated packages.
A Python client for the Global CVE Allocation System: The
gcve
project is a newly updated Python client for the Global CVE Allocation System, offering command-line and library support to manage and verify decentralised vulnerability IDs (GNAs) through a flexible, open approach.
💼Case Studies and Experiments🔬
Minimal IRC server from scratch in Python: Recounts building pirc, a minimal, ~350-line Python IRC server prototype, aimed at creating a lightweight chat environment without modern overhead like encryption or account systems, using only Python’s standard library.
From slopes to stats: Building a snowboarding performance dashboard with Python and my own sensor data: Describes how the author combined Python, SAS, and consumer devices to build a personal performance dashboard, collecting and analysing GPS, heart rate, and metadata.
📊Analysis
14 Advanced Python Features: Presents 14 underused yet powerful Python features, including typing overloads, structural pattern matching, generics, protocols, and metaclasses, with code examples and references.
Python is an interpreted language with a compiler: Clarifies that while Python is commonly called an interpreted language, it actually uses a compiler internally to generate bytecode, which is then run by the Python virtual machine.
🎓 Tutorials and Guides 🤓
📖Open Access Book | Mathematical Methods in Data Science (with Python) by Sebastien Roch: A mathematically rigorous textbook introducing data science through multivariable calculus, linear algebra, and probability, with coding examples in Python.
Understanding the CPython Compiler: Demystifies how CPython compiles Python source code into bytecode through four stages: tokenization, AST generation, bytecode compilation, and execution by the Python Virtual Machine.
Powering React with Python (Wasm): Demonstrates how to build a web-based photo editor using Next.js for UI and Python compiled to WebAssembly for performance-heavy image editing tasks.
I Can’t Get No (Boolean) Satisfaction: Explores the significance of Boolean satisfiability (SAT) problems, illustrating their foundational role in computer science and their applicability to various real-world challenges, while providing a technical guide to generating and solving SAT instances using Python.
How I Built a Local MCP Server to Connect Obsidian with AI: Explains how the author built a local MCP server enabling secure, read-only AI access to a personal knowledge base for analysis, content completion, and review question generation.
Named Entity Recognition with Python in George Eliot’s The Mill on the Floss: Uses Python and spaCy to map character frequencies and relationships through co-occurrence analysis, bar plots, and network graphs to support literary interpretation of social and emotional dynamics.
Animated scatter plot with size legend using matplotlib: Explains how to create an animated scatter plot by plotting earthquake data from Nepal’s 2015 earthquake, addressing challenges like dynamic marker sizing and legend scaling.
🔑Best Practices and Advice🔏
Better ways to monitor NNs while training: Offers an in-depth exploration of advanced techniques for monitoring neural network training beyond conventional methods like loss and accuracy metrics.
Blog Modernisation with Claude: A Python Makeover: Describes how the author modernised his 18-year-old Python blog generator using Claude AI, improving it with Poetry, pre-commit hooks, GitHub Actions, and a structured package layout, all while retaining functionality.
Optimizing Causal Decisions with Gurobi Machine Learning: A Step-by-Step Tutorial: Explains how to combine machine learning predictions and mathematical optimization using Gurobi to solve constrained causal decision-making problems.
Experimental Design in the AI Era: Explains how to design efficient, AI-driven experimental frameworks by combining optimal experimental design (OED), Bayesian optimization, and machine learning surrogate models.
Mapping Hollywood: Actor Collaboration Networks with d3Blocks, Streamlit and NetworkX: Describes how to build an interactive Streamlit app that maps Hollywood actor collaborations using TMDB data, visualises the network with d3Blocks, and analyses it with NetworkX metrics like degree centrality and clustering.
🔍From the Cutting Edge: gdeltnews—A Python Tool for Reconstructing Full News Text from GDELT💥
In "A Python Tool for Reconstructing Full News Text from GDELT,"Andrea Fronzetti Colladon and Roberto Vestrelli introduce a Python-based method and tool, gdeltnews, for reconstructing full news articles from GDELT’s Web News NGrams 3.0 dataset. Their work addresses critical challenges around affordable, large-scale access to news text for research purposes.
Context
News datasets are foundational across economics, finance, management, social sciences, and computer science. They help predict stock trends, study political discourse, assess corporate reputations, and train LLMs. However, access to comprehensive, full-text news datasets often requires expensive subscriptions to platforms like Factiva and LexisNexis, while free alternatives tend to lack completeness or transparency. GDELT—the Global Database of Events, Language, and Tone—is a free, open-access platform capturing global news coverage in over 100 languages. Its Web News NGrams 3.0 dataset provides n-grams (single-word units) along with minimal contextual information but does not offer full article texts. Colladon and Vestrelli’s Python tool aims to bridge this gap by reconstructing articles from GDELT’s fragmented data.
Key Features of gdeltnews
Open-source Python package: Implements the reconstruction method using modular, extensible code.
Fragment Assembly Algorithm: Automatically reconstructs articles by joining overlapping text fragments based on word similarity and article position.
Support for Space-Segmented Languages: Initially handles languages like English, French, Spanish; planned future extension to scriptio continua languages like Chinese and Japanese.
Preprocessing for Clean Reconstruction: Detects and corrects known GDELT artefacts, such as misplaced article ends at beginnings.
Validation-backed Reliability: Demonstrated high fidelity (up to 95% similarity) in reconstructing original articles, based on systematic benchmarking against EventRegistry.
Parallel Processing Version: Provides a parallelised option for handling large datasets more efficiently.
URL and Metadata Handling: Allows researchers to filter or organise reconstructed articles by original source URLs and language metadata.
What This Means for You
This tool is particularly relevant for researchers, data scientists, and NLP practitioners who require large-scale news datasets but cannot afford costly proprietary services. gdeltnews empowers studies in economic forecasting, public opinion tracking, fake news detection, and AI training by offering near-complete reconstructed texts at no cost. It enables more flexible, verifiable, and customised analyses that were previously limited by access restrictions.
Examining the Details
The reconstruction method starts by grouping n-gram entries by source URL and combining the "pre", "ngram", and "post" fields into textual fragments. These fragments are then joined by detecting word overlaps and considering positional metadata (article deciles). The method includes logic to correct GDELT-specific artefacts, such as misplaced end-of-article content.
For validation, the authors matched 2,211 articles reconstructed from GDELT data to original full texts obtained from EventRegistry, covering major U.S. news outlets. After cleaning and tokenising both sets, they compared them using Levenshtein Similarity and SequenceMatcher Similarity — both sensitive to word order, which is critical when reconstructing coherent article narratives.
Without filtering, reconstructed articles achieved around 75% similarity to originals; when filtering for articles with at least 80% token overlap, the similarity rose to 95%. These results confirm the method’s strong fidelity even under minor noise or variations.
Limitations include the absence of article titles in GDELT’s dataset and slower single-process performance, although a parallel version of gdeltnews mitigates the latter issue. Future improvements aim to support non-space-separated languages and enhance efficiency.
You can learn more by reading the entire paper or accessing the tool on GitHub.
And that’s a wrap.
We have an entire range of newsletters with focused content for tech pros. Subscribe to the ones you find the most useful here. The complete PythonPro archives can be found here.
If you have any suggestions or feedback, or would like us to find you a Python learning resource on a particular subject, just leave a comment below!