Slim: Shrink Docker Images by 30x with One Command
Plus run vectorized expressions on Polars lists
Grab your coffee. Here are this week’s highlights.
📅 Today’s Picks
Slim: Shrink Docker Images by 30x with One Command
Problem
Docker images include the entire OS layer. For a simple Python app, this is unnecessary because it never touches the shells, compilers, and system utilities bundled inside.
This inflates images to hundreds of megabytes, wasting storage and adding time to every deploy.
Solution
Slim automatically analyzes your container at runtime to identify which files are actually used, then builds a minimal image with only essential components.
Slim works alongside Docker, not instead of it:
Step 1: Build your image with
docker buildStep 2: Minify with
slim build your-imageStep 3: Push the
.slimimage to your registryYour Dockerfile and workflow stay the same
Polars: Vectorize List Column Transformations with list.eval
Problem
When working with list columns, most people reach for apply with a Python lambda that loops over every list row by row.
That approach breaks vectorization, so performance quickly degrades as the dataset grows.
Solution
Polars solves this with list.eval, which runs a full expression against each list using pl.element() and stays fully vectorized.
Key benefits:
Vectorized per-element transformations without Python loops
Support for a wide range of expressions, including aggregations like
max,mean, andsumComposable with other Polars expressions for clean, readable pipelines
☕️ Weekly Finds
pyupgrade [Code Quality] - A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of Python.
doxx [Python Utils] - Expose the contents of .docx files without leaving your terminal. Fast, safe, and smart, with no Office required.
ingestr [Data Processing] - ingestr is a CLI tool to copy data between any databases with a single command seamlessly.
💬 Rate Your Experience
How would you rate your newsletter experience? Share your feedback →
🔍 Explore More on CodeCut
Tool Selector - Discover 70+ Python tools for AI and data science
Production Ready Data Science - A practical book for taking projects from prototype to production


