Sourcery Blog

Thoughts, musings, advice, and best practice tutorials on how to program in Python from the Sourcery team

Better LLM Prompting using the Panel-of-Experts

How roleplaying a panel discussion can improve LLM results

Don’t tell me what (not) to do!

On the surprising stubbornness of large language models

Unit Testing Code with a Mind of Its Own

Setting up unit tests when your code isn’t deterministic anymore

Faster Code Reviews = Lower Burnout?

What the Accelerate State of DevOps 2023 report tells us about code reviews, DORA metrics, and performance

Code Review - Ideals vs Reality

What the data tells us about teams’ code review practices in the real world

Default Approve

Building an Approval/Rejection Mechanism to Help Teams Move Fast

Finding the Traps We Set for Ourselves

Stopping complex code from sneaking into a project during code reviews

Code reviews are a tax on productivity

We need to rethink how code reviews work

Improving LLM Responses After the Fact

Trying to make optimize review comments for "Usefulness"

Tackling Complex Tasks with LLMs

How we tackle reviewing PRs for code complexity issues

Why Do We Have Code Reviews Anyway?

What's the point of reviews? And are they actually helpful to the development process?

Sourcery's Pricing Plan Shift

Changes in how you can use Sourcery for different types of projects

The Hidden Benefits of Code Reviews

Code Reviews aren't just about the code

Generating Code without Generating Technical Debt?

Delivering and maintaining AI-generated code.

Comparing to None in Python and Pandas

Truthy and falsy values, None, and comparison in Python and Pandas.

When is inplace in Pandas faster?

And when is the `inplace` argument misleading?

Code Review: What And What Not To Automate?

Embracing tools and improving the feedback.

Avoiding Performance Killers in Loops

If it's expensive, only pay it once.

Why You Need Coding Standards

Codified standards can help your team be more productive

Interest Rates Are Rising - Calculating Tech Debt's Actual Impact

Measuring technical debt's ongoing impact

My 3 Worst Python Function Names

3 unclear function names and how to improve them.

Consistent Naming with Voldemort Rules

How to ensure that some names just don't appear in your codebase?

Law of Demeter, Gateway Pattern, and Package Maturity

Some guidelines for dependency rules that make a system easier to understand and maintain.

Maintain A Clean Architecture With Dependency Rules

Disentangle the dependencies between your packages.

Making Our Tests More Concise with Helpers

Helper functions make your code more expressive and less repetitive. Assuming that you really use them.

Chatting with Will McGugan: From Side Project To Startup

Will's journey with Rich and Textual. Including insights about API design and speeding up Python code.

Zero-cost Exceptions and Error Interfaces

Handling and raising errors in Python plus some novelties introduced in 3.11

Chatting with Sebastian Witowski - Part II: Python Community and Developer Tools

Sebastian's work in the Python community: talks, articles, courses. And a favorite topic: developer tools and productivity.

Making the Sourcery CLI More Robust with Rich

Building blocks of a robust CLI App and how we've implemented them with Rich in the Sourcery CLI.

Chatting with Sebastian Witowski - Part I: Code Standards, Tooling, and Working in Teams

How to think about working in teams, consulting, setting common standards for your code, and finding a balance in the CI.

Review Just Your Changed Code

Review only the code in your current PR with Sourcery and incrementally improve the quality of your codebase.

GPSG in Practice / Part 1: the Sourcery Monorepo

How we've been adjusting the Google Python Style Guide for the Sourcery monorepo.

Dark Corners of Our Code - The Impact of Technical Debt - Part II

What leads to unmanageable pieces of codebases

The Impact of Technical Debt - 2022

How much does technical debt impact teams?

Introducing the Google Python Style Guide in Sourcery

A step by step guide towards implementing the Google Style Guide with Sourcery

Real Python podcast

Measuring Python Code Quality, Simplicity, and Maintainability

Dissecting the Google Style Guide

Breaking down how a code style guide can help speed up engineering teams

Maintainability Index - What is it and where does it fall short?

Calculating the Maintainability Index and looking at how you can use it for your projects.

Python Refactorings - Part 8

Six more examples of ways to refactor your Python code, and why they are improvements

How much information is too much information?

The link between complexity, cognitive overloading, and velocity.

Is your code too complicated?

Measuring complexity of your code with two different metrics - Cyclomatic Complexity & Cognitive Complexity

Stackoverflow podcast

Exploring the magic of instant Python refactoring with Sourcery

What Is Technical Debt (and why a bit of it is a good thing)

Technical debt can slow down your development, but focusing too aggressively on refactoring isn't always the right decision either.

Cloudy with a Chance of Python

Deploying a Python program as a Google Cloud Function

Functional Refactoring talk at PyData Eindhoven

Refactoring noughts and crosses into the functional programming style

Real Python podcast

Getting started with refactoring your python code

Podcast.__init__ interview

Make Your Code More Readable With The Magic Of Refactoring Using Sourcery

Python Refactorings - Part 7

Six more examples of ways to refactor your Python code, and why they are improvements

Making lunch faster with Python concurrency

A lunchtime story to demonstrate threading, asyncio, multiprocessing & cloud functions

Python Refactorings - Part 6

Six more examples of ways to refactor your Python code, and why they are improvements

Python Refactorings - Part 5

Six more examples of ways to refactor your Python code, and why they are improvements

Sourcery now available in Sublime!

Instantly refactor your Python code

Introducing Sourcery Pro!

Don't miss out on these powerful new features - write better code faster today.

Sourcery now available in Vim!

Instantly refactor your Python code

Can you fit all of this code in your head?

Measuring how hard code is to understand with our new working memory metric

Python Refactorings - Part 4

Six more examples of ways to refactor your Python code, and why they are improvements

Python Refactorings - Part 3

Six more examples of ways to refactor your Python code, and why they are improvements

Python Refactorings - Part 2

Six more examples of ways to refactor your Python code, and why they are improvements

Talk Python podcast

Refactoring your code, like magic with Sourcery

Python Refactorings - Part 1

Six examples of ways to refactor your Python code, and why they are improvements

How do you test code written by code?

Ensuring Sourcery improves code without changing its functionality

Sourcery Starbot ⭐ released!

Star our repo to refactor your most popular Python repo

Use Sourcery to review your code on GitHub!

Get an instant quality boost to your open source codebase

Python refactorings now available in VS Code with Sourcery!

Get instant Python refactorings as a VS Code extension

Getting the most out of Python collections

A guide to comprehensions, generators and useful functions and classes

GitHub Actions for perfect Python Continuous Integration

A simple GitHub action for formatting, linting, testing, and building a Python application

A Field Guide to Fixing Bugs

Best practices for tracking down and resolving software issues

A perfect way to Dockerize your Pipenv Python application

A simple Dockerfile for setting up a perfect Python application using Pipenv

Five Python Refactoring Tips to Improve Your Code

Easy ways to improve and simplify your code, with Python examples

Sourcery beta launched!

Sourcery is in beta - try our AI-powered refactoring in Pycharm now!

Sourcery now runs locally - plus beta launch next month!

Sourcery will now run locally on your machine, meaning that no code is sent to the cloud. We are also planning to launch into paid beta in October

How to set up a perfect Python project

Best practices for setting up a project to maintain the highest quality code

Refactoring the Gilded Rose kata

16 steps to transform and simplify the code

Introducing Sourcery

Refactor Python instantly using the power of AI