Sourcery Blog
sourcery.ai · Company blog · on HN since 2019
The company blog for Sourcery, a Python refactoring tool, covering code quality, project setup, code review, and LLM code generation.
What HN saysCommenters mention the Sourcery tool as one a team adopted by word of mouth and liked, and link its follow-up post on dependency architecture.
17HN people shared it
7linked it in comments
52stories submitted
312story points
1 year agolast shared
2019people per year2026
Most-shared posts
- 1Show HN: Sourcery – It's not magic, just powerful instant refactoring for Python5 people · 22 points · first shared 2019 · 2 comments on HN
- 2How to set up a perfect Python project3 people · 76 points · first shared 2019 · 48 comments on HN
- 3Code Review: What and What Not to Automate?3 people · 5 points · first shared 2023 · discussion on HN
- 4Generating Code Without Generating Technical Debt?3 people · 3 points · first shared 2023 · discussion on HN
- 5Is your code too complicated?2 people · 15 points · first shared 2022 · 1 comments on HN
- 6Working memory: metric for state a programmer needs to keep in their head2 people · 4 points · first shared 2023 · discussion on HN
- 7Trying out the panel-of-experts prompting strategy for LLMs1 people · 46 points · first shared 2024 · 10 comments on HN
- 8Chatting with Sebastian Witowski: Code Standards, Tooling, and Working in Teams1 people · 37 points · first shared 2022 · discussion on HN
- 9Zero-Cost Exceptions and Error Interfaces1 people · 36 points · first shared 2022 · 42 comments on HN
- 10Chatting with Sebastian Witowski – Part II: Python Community and Developer Tools1 people · 5 points · first shared 2022 · discussion on HN
- 115 Refactoring tips to improve your code – with tea-based Python examples1 people · 5 points · first shared 2020 · discussion on HN
- 12Chatting with Will McGugan: From Side Project to Startup1 people · 4 points · first shared 2022 · discussion on HN
- 13A code quality battle between 6 AI agents1 people · 3 points · first shared 2025 · 1 comments on HN
- 14Six more ways to improve your Python1 people · 3 points · first shared 2020 · discussion on HN
- 15A perfect way to Dockerize your Python application1 people · 3 points · first shared 2020 · 4 comments on HN
What HN people wrote when they linked it
stuartjohnson12 · 2023-03-31
In my experience, the developer tools that really catch on do so via word of mouth. For example, our whole team recently adopted https://sourcery.ai/ (not an ad) because one developer tried it and hyped it up to everyone else who also liked it. Developers are the best kind of customers if you have PMF - they evangelise and actively enjoy debating toolchains.
The hard part is usually building the actually valuable tool.
usrme · 2023-02-11
To those that wish to automate a subset of these conventions, there is a tool called Sourcery[1] that I, personally, am a huge fan of! Not only does it have a large set of default rules[2], but it can also allow you to write your own rules that may be specific to your team or organization, and as mentioned it can enable you to follow Google's Python style guide as well[3].
There are some refactorings that Sourcery suggest that I don't agree with myself, namely the usage of 'contextlib.suppress'[4] as I don't like to introduce an additional 'import' statement just to do something so trivial. I wish Sourcery would add the relevance of having possibly too many 'import' statements as a heuristic.
---
[1]: https://sourcery.ai/
[2]: https://docs.sourcery.ai/Reference/Default-Rules/ (expand the sub-pages)
[3]: https://docs.sourcery.ai/Reference/Optional-Rules/gpsg/
[4]: https://docs.sourcery.ai/Reference/Default-Rules/refactorings/use-cont…
rekahrv · 2022-12-22
A follow-up post:
https://sourcery.ai/blog/dependency-architecture/
hbrn · 2022-12-15
This (plus Law of Demeter) is the right way to handle medium-big size projects, though I'm not completely sold on the tooling. I mostly do it manually (yes, it is still doable with dozens of modules since dependency hierarchy doesn't change often).
One recommendation I have is to present the hierarchy as DAG. Existing image (https://sourcery.ai/static/05300f06cb847360719e2aa31dc5a31b/8c857/depe… doesn't make it very obvious that api is a highest-level module, even though it is clearly stated in the rules.
claytonjy · 2021-12-21
> So now I have two different black calls: in the pre-commit hook and in the CI/CD. And they must be of the same version.
> Can the framework run off the venv dir?
It can, but it means not using the hooks from the tool's repo and writing your own. This blog post [0] shows the pipenv version of some common hooks; mine look the same but s/pipenv/poetry.
If there's a way to use the upstream hooks with your local venv, so I can trust the tool maintainers for proper configuration, I'd love to know about it.
[0] https://sourcery.ai/blog/python-best-practices/
buschkowitz · 2019-12-08
I find myself coming back to this guide whenever I set up a new project: https://sourcery.ai/blog/python-best-practices/
brendanator · 2025-06-11
Totally agree - we’re working on this at https://sourcery.ai