You can now build your own rules into Sourcery!

Are there issues that keep popping up in your projects, nuances around libraries you use, or feedback you want to make sure your whole team gets? Just create a Sourcery rule and we'll automatically find and fix those issues for you.

To get started, we've put together a tutorial for you to create your first rule.

And we've added a section to our docs with more details about what types of rules you can currently create.

Anyone can create up to 3 rules for free - or you can sign up for a Team plan to create unlimited rules.


  • Validate config including rule syntax and show appropriate errors to users
  • Write up to 3 rules with the free plan
  • Added number of occurrences to the description of each improvement that Sourcery recommends
  • Enable recommendations that add imports in PyCharm


  • The metrics hover on functions in the IDE is now defined as a type of Sourcery comment. This means the option to switch it off via IDE configuration has been removed - it can now be switched off if required by skipping the function-quality proposal in the Sourcery configuration file.
  • Update Quality Report comments instead of recreating them in the GitHub bot.


  • avoid-builtin-shadow no longer triggers for class variables
  • Fix hoist-similar-statement-from-if to consider if-statements containing elifs as different from each other (fixes issue #241)
  • Improved stability of VS Code and PyCharm extensions when errors are encountered
  • Retain .sourcery.yaml formatting and comments when updated from IDEs
  • Rules that make no code change will now convert to comments instead of causing a crash.