Trusted by THOUSANDS OF engineers
AND WE’RE IMPROVING THE WORLD’S CODE EVERY DAY
1,000,000+
Lines of code removed
80,000+
Installs
100k+
Monthly Improvements
from quality import clean_code
Ensure clean code all the time
Teams with high quality code are 50+% more efficient than teams working with low quality code.
Get instant suggestions on how to improve your code and make it follow best practices.
while is_Learning: knowledge.append(information)
Fix issues everywhere in one command
Fix every instance of an issue across your codebase with a single command. Just define a rule, run it in the CLI, and it`s fixed.
Whether it`s a standard best practice or refactoring you want to make in 100s of places, we`ve got you covered.
%timeit code.review()
Catch quality issues before code review
Catch issues before code reviews by building your rules, standards, and best practices into code.
Get feedback and fixes on any code not following those standards in real time while you work.
rules:
- id: filter-lambda-to-list-comprehension
pattern: |
list(filter(lambda ${arg}: ${expr}, ${items}))
replacement: |
[${arg} for ${arg} in ${items} if ${expr}]
description: |
Use list comprehensions instead of filter and lambda
Code never leaves your device
cat examples.py
Real time recommendations
Explore some examples that show how Sourcery can dramatically improve the code you create, whether you develop for fun or professionally.
Write Pythonic code
From list comprehensions to cutting down on nested conditionals, Sourcery ensures your code follows Python best practices.
def sourcery(spellbook):
result = []
for spell in spellbook:
if spell.is_awesome:
result.append(spell)
return result
Removes duplicate code
Sourcery automatically finds, and removes duplicate code. It can even extract duplicate code into their own methods to keep your code clean and simple.
Write your best practices as code
Quickly create rules to flag and replace outdated functionality across your projects.
def sourcery(spellbook):
result = []
for spell in spellbook:
if spell.is_awesome:
result.append(spell)
return result
global availability
Works across your full development lifecycle
“I just found out thanks to @SourceryAI that function cells, can be rewritten to:
def cells(board):
""" Iterate over the cells in a 2D list """
for row in board:
yield from row
learn something every day”
Bart Dorlandt
“@SourceryAI is great! I never knew that #Python pathlib`s Path already includes a .read_text() method which has context manager.
read_text() source code:
click here”
Alwin Wang
“I refactored and cleaned up all of the Python Bytes code. It’s really nice now”
Michael Kennedy
Host of Python Bytes & Talk Python to Me
git commit -m “love”
Loved by developers
“Woah. @SourceryAI’s new contextlib example is the first refactoring I haven’t ever seen before in the wild. That’s awesome. Keep up the great work, this is extremely exciting and will help me recommend it to senior devs not just more junior team members”
Kevin Kirsche
“Shout out to @SourceryAI. Installed your extension and refactored my codes with a lot of your suggestions and I am not looking back. Amazing product 👍👍. Shared some feedback too. Really helpful product you have.”
Sentinel🧬
“Python Anti-Pattern: Default Mutable Arguments
@SourceryAI found a bad habit I didn’t know I had:
def f(names: list=[]):.
This would be nearly impossible to debug.”
Charles Twardy