TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Bowler: Safe code refactoring for modern Python

198 pointsby jxubover 6 years ago

10 comments

nuclear_eclipseover 6 years ago
Author here: I created Bowler as a &quot;hackamonth&quot; project when I joined Facebook&#x27;s internal Python Foundation team. We&#x27;ve already used it for a bunch of random codemods that touch a large number of source files throughout our codebase.<p>Happy to answer any questions you might have!
评论 #17983866 未加载
评论 #17985788 未加载
typonover 6 years ago
Could this be used to create a macro system for python?
评论 #17981604 未加载
评论 #17982690 未加载
pypypypypypyover 6 years ago
This was first presented at PyconAU 2018 - <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=9USGh4Uy-xQ" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=9USGh4Uy-xQ</a>
MrSaintsover 6 years ago
This is akin to the other &quot;codemod&quot; facilities Facebook already uses for large-scale refactoring in <i>busy</i> codebases (particularly, their JS codebases), but for Python (<a href="https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;codemod" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;codemod</a>, <a href="https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;jscodeshift" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;jscodeshift</a>).
评论 #17983761 未加载
jsmeatonover 6 years ago
I could imagine a library of transformers being created using this tool.<p>For instance we’ve just enabled the pep3101 Flake8 plugin which enforces newstyle string formatting over % formatting. I’d love to see a transformer that automates that refactoring.
评论 #17989116 未加载
ausjkeover 6 years ago
Is this to help migration from python 2 to python 3, or a tool to make python 3 better? it&#x27;s unclear after I read it except it mentions it&#x27;s based on 2to3.
评论 #17982913 未加载
评论 #17983771 未加载
marmadukeover 6 years ago
How well does this handle dynamic constructs? Eg if I rename a method and elsewhere have<p><pre><code> if hasattr(obj, ‘foo’): </code></pre> does that get caught or not?
评论 #17984922 未加载
Twirrimover 6 years ago
I haven&#x27;t had to use it before, but another tool in that space is &quot;undebt&quot; from Yelp:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Yelp&#x2F;undebt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Yelp&#x2F;undebt</a>
sandGorgonover 6 years ago
Is it possible to use this in vscode ?<p>That would be awesome.
评论 #17989159 未加载
评论 #17985823 未加载
linuxftwover 6 years ago
Seems like more work to me. Simple search and replace is usually sufficient for something like what the intro video shows.
评论 #17982443 未加载
评论 #17983811 未加载
评论 #17982274 未加载