News for hackers. Stuff that matters.
Re:Show HN: Python Source Code Refactoring Toolkit via AST by milkbikis on Sunday August 01, 2021 @02:53PM (#28028838)
Nice, I've always thought Python could do better by adopting source transformation tools like babel. I implemented something similar using lib2to3, which preserves whitespace and comments more accurately (than the ast module): https://github.com/banga/prefactor
Re:Show HN: Python Source Code Refactoring Toolkit via AST by treesciencebot on Sunday August 01, 2021 @03:59PM (#28029350)
Yes! I love to do transformations with lib2to3, but unfortunately it is now deprecated. As I've stated in the README, for complex refactorings I also would personally prefer working with CST (probably through parso instead of regular lib2to3), but for refactoring small fragments I wasn't able to observe major differences in formatting in big codebases. Thanks for sharing this btw!
Re:Show HN: Python Source Code Refactoring Toolkit via AST by milkbikis on Sunday August 01, 2021 @04:43PM (#28029762)
Ah I didn’t know it was deprecated, but good to see new work happening in this area!