I've found documentation and experimented with python-rope to rename a module in Python. However, when it comes to renaming the whole package, there doesn't seem to be documentation available. Do we grab the package's __init__ file as the resource?
I'd like to change the following structure:
some_package
-- __init__.py
-- some_module_a.py
-- some_module_b.py
into:
renamed_package
-- __init__.py
-- some_module_a.py
-- some_module_b.py
There are a lot of references to this package all across my codebase, so some automatic refactoring could be extremely valuable. It's not complex in theory right? So I assume rope can definitely do this?
p.s. I'm using Sublime Text's PyRefactor.
Rope can do this using rename function. Yes, you can select either the package's folder or the
__init__.pyfile as the resource.If you need some example of how this is done, I recommend looking at rope's test suite: