python-rope / rope

a python refactoring library
GNU Lesser General Public License v3.0
1.96k stars 164 forks source link

Package to Module Conversion #791

Open JustKiddingCode opened 5 months ago

JustKiddingCode commented 5 months ago

I have multiple packages with containing very small modules (e.g. 10 lines of code). I would like to turn a package into a module:

foo/
  __init__.py
 bar.py
 barbar.py

becomes: foo.py containing all code of foo/{__init__.py,bar.py, barbar.py} without relatives import. All other imports of a project needs to be rewritten, from foo.bar import X becomes from foo import X.

I see there is a topackage, so it would be kind of the inverse, I guess?