Mapping module imports in Python for easy refactoring

前端 未结 4 462
逝去的感伤
逝去的感伤 2021-02-07 10:40

I have a bunch of Python modules I want to clean up, reorganize and refactor (there\'s some duplicate code, some unused code ...), and I\'m wondering if there\'s a tool to make

4条回答
  •  无人及你
    2021-02-07 11:37

    Python's modulefinder does this. It is quite easy to write a script that will turn this information into an import graph (which you can render with e.g. graphviz): here's a clear explanation. There's also snakefood which does all the work for you (and using ASTs, too!)

    You might want to look into pylint or pychecker for more general maintenance tasks.

提交回复
热议问题