Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
About Article
Analyze Data
Archive
Best Practices
Better Outputs
Blog
Code Optimization
Code Quality
Command Line
Course
Daily tips
Dashboard
Data Analysis & Manipulation
Data Engineer
Data Visualization
DataFrame
Delta Lake
DevOps
DuckDB
Environment Management
Feature Engineer
Git
Jupyter Notebook
LLM
LLM Tools
Machine Learning
Machine Learning & AI
Machine Learning Tools
Manage Data
MLOps
Natural Language Processing
Newsletter Archive
NumPy
Pandas
Polars
PySpark
Python Helpers
Python Tips
Python Utilities
Scrape Data
SQL
Testing
Time Series
Tools
Visualization
Visualization & Reporting
Workflow & Automation
Workflow Automation

Newsletter #302: Type Check Your Python Codebase 15x Faster with Pyrefly

Newsletter #302: Type Check Your Python Codebase 15x Faster with Pyrefly

Grab your coffee. Here are this week’s highlights.


๐Ÿ“… Today’s Picks

Codon: One Decorator to Turn Python into C Speed

Code example: Codon: One Decorator to Turn Python into C Speed

Problem

Slow Python functions in large codebases are painful to optimize. You might try Numba or Cython, but Numba only works for numerical code with NumPy arrays.

You might try Cython, but it needs .pyx files, variable type annotations, and build setup. That’s hours of refactoring before you see any speedup.

Solution

Codon solves this with a single @codon.jit decorator that compiles your Python to machine code.

Key benefits:

  • Works on any Python code, not just NumPy arrays
  • No type annotations required since types are inferred automatically
  • Compiled functions are cached for instant repeated calls
  • Zero code changes beyond adding the decorator

The example below shows the real performance:

  • Pure Python: 0.240s
  • Codon first call: 0.324s (one-time compilation)
  • Codon cached calls: 0.006s (37x faster)

Datadog: Trace Bad Data from Dashboard to Root Cause in One View (Sponsored)

Code example: Datadog: Trace Bad Data from Dashboard to Root Cause in One View (Sponsored)

Problem

If your pipeline isn’t connected end to end, debugging means jumping between tools and manually tracing the issue. It’s slow and error-prone.

Solution

Instead of jumping between tools, Datadog Data Observability gives you one connected view from ingestion to dashboards.

It does this through:

  • Quality Monitoring: catches anomalies like missing rows or stale data automatically
  • Jobs Monitoring: gives visibility into Spark and Airflow runs, including failures and cost
  • Data and code lineage: traces problems upstream to the source and downstream to every affected dashboard, model, and report

Type Check Your Python Codebase 15x Faster with Pyrefly

Code example: Type Check Your Python Codebase 15x Faster with Pyrefly

Problem

Tools like MyPy and Pyright process files sequentially, so larger codebases lead to longer wait times.

Solution

Pyrefly, Meta’s Rust-based type checker, runs checks in parallel, keeping performance nearly constant as your codebase grows.

Key features:

  • Re-checks only changed modules for faster incremental runs
  • Automatically infers types for variables and return values

On the PyTorch codebase, Pyrefly completes a full check in 2.4 seconds, about 15x faster than Pyright and 20x faster than MyPy.


๐Ÿ“š Latest Deep Dives

browser-use: Turn Plain English Prompts into Working Browser Automation

Traditional tools like Playwright rely on CSS selectors, tightly coupling your scraper to a site’s HTML. When the site changes, everything breaks and needs to be rewritten.

browser-use takes a different approach. You describe the goal in plain English, and an LLM decides what to click, type, and extract.

In this article, I tested browser-use on two real tasks:

  • Finding AI stories on Hacker News and synthesizing themes
  • Scraping Newegg for gaming laptops with specific constraints

I share the actual outputs, cost per run, and an honest breakdown of what worked and what didn’t so you can decide if it fits your use case.

๐Ÿ“– View Full Article


โ˜•๏ธ Weekly Finds

bandit [Code Quality] – A security linter that scans Python code for common vulnerabilities by building and analyzing abstract syntax trees.

scalene [Code Quality] – High-performance CPU, GPU, and memory profiler for Python with AI-powered optimization proposals.

vulture [Code Quality] – Finds unused code in Python programs, including dead functions, classes, variables, and unreachable code blocks.

Looking for a specific tool? Explore 70+ Python tools โ†’

Stay Current with CodeCut

Actionable Python tips, curated for busy data pros. Skim in under 2 minutes, three times a week.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran