Benjamin Müller’s Post

When someone new joins a Python codebase, their first PR tells you everything: single-letter variables, inconsistent imports, functions that return str | None | dict depending on the mood of the day. We have onboarding docs for this, but tooling is what actually enforces it. My default move is three things: Ruff, Pyright, and pre-commit. Ruff with format + lint, fix-on-save, and import sorting. They hit save and the file snaps into shape, which alone kills most style discussions before they ever reach a PR. Then Pyright via Pylance in standard mode. Not strict, because strict in Python is counterproductive unless the whole codebase is designed for it. Standard catches wrong argument types, None-access, and missing returns, the stuff that otherwise shows up as runtime bugs or reviewer nitpicks. Once people see type issues flagged while they're still typing, something clicks and they stop shipping avoidable bugs. That peace of mind is something I never want to go back from. Pre-commit makes all of it non-optional. The same checks run for everyone, every time, before the code even gets pushed. It turns "we should all follow the coding guides" into "you literally can't commit without following them." That's the difference between a convention and a guarantee. With this, reviews actually focus on correctness, design, and edge cases instead of formatting and obvious type errors. You're moving the stuff humans shouldn't be wasting time on to machines that do it better and faster, and you're doing it at the cheapest possible point, before it ever hits a PR. I remember when I first set this up for myself and it felt like someone turned the lights on. I want that for everyone joining the team. What's the first thing you set up when onboarding someone new? #Python #SoftwareEngineering #CodeQuality #DeveloperExperience #DevTools

Yeah I agree with that 💯 Ruff + type checking + pre-commit moves a lot of cognitive load from humans to tooling. Once formatting, imports, and obvious issues are automated, PR reviews become about architecture, correctness, and edge cases instead of style debates 🙃 I’ve seen the same effect when teams enforce these checks in CI — the codebase quality improves almost immediately, and engineers start discussing logic, edge cases, and architecture rather than arguing about code style 😅

Just switched to #prek instead of pre-commit. Same thing, but much faster (Rust based). https://github.com/j178/prek

See more comments

To view or add a comment, sign in

Explore content categories