Support moving and renaming a module with a file destination
维护者通常 7 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by reading MoveModule.get_changes() and the existing move and rename refactorings to determine whether composing them already supports this workflow. If extending MoveModule, define destination and collision semantics, then cover normal, from, aliased, relative, and in-module imports with regression tests. Done means renamed file destinations rewrite imports consistently; assess the separate find_relative_module() change with its own reproducer and test.
由索引模型根据 Issue 内容生成。
描述
Proposal
Consider extending MoveModule.get_changes() to accept a destination file, so callers can move and rename a module in one refactoring, for example:
old_package/module.py → new_package/renamed.py
Currently, MoveModule requires a folder destination. Commit https://github.com/python-rope/rope/commit/e7bfd4f5f4cb798f5b96ba7111e07e16254958f7 experiments with accepting file destinations and adjusting import rewriting. The feature idea seems worth considering, but the patch needs further work rather than merging unchanged.
Suggested scope
- Define destination-file semantics, including whether the file must not yet exist, collision handling, and how package moves differ from module moves.
- Update import rewriting consistently for both unchanged and renamed module basenames. The experimental patch's special case for
from old_package import moduleonly handles a destination with the same basename. - Cover normal imports, from-imports, aliases, relative imports, and imports inside the moved module with regression tests.
- Avoid the patch's broad
except Exceptionhandler, which hides the underlying failure.
First assess whether composing the existing move and rename refactorings already provides this behaviour reliably. If so, a convenience API or documentation may be preferable to extending MoveModule.
Separate concern
The same commit changes find_relative_module() to fall back to the project root when folder is false. That change should not be included without a separate reproducer and regression test establishing the intended relative-import behaviour.
This suggestion is based on source review of the commit and the current implementation, not behavioural testing of the patch.
- 主要语言
- Python
- 星标
- 2.2k
- 派生
- 197
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-rope/rope 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 88/100
python-rope/rope#927 ·
维护者通常 7 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
python-rope/rope#926 ·
维护者通常 7 天内回复
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offset可能已有人在做 @sean0407 于 10 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 83/100
python-rope/rope#913 ·
维护者通常 7 天内回复
-
难度 4/5 3-5 天 新手友好度 30/100
python-rope/rope#925 ·
维护者通常 7 天内回复
-
Extract method/variable and introduce parameter don't check whether the new name is already in use未关闭
难度 3/5 1-2 天 新手友好度 62/100
python-rope/rope#924 ·
维护者通常 7 天内回复
相似的 Issue
-
New Internship未关闭new_internship
难度 2/5 1-3 小时 新手友好度 68/100
-
get_graph warns that the oneway column is missing when no way has a oneway tag可能已有人在做 @HTenkanen 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
fix: security 🔐 style: article/section 📝 system: data-mgmt 🗃️ system: security 🔐 system: software 💻
难度 2/5 1-3 小时 新手友好度 65/100
uabrc/uabrc.github.io#1267 ·
-
Bot Type: Bug Type: Documentation
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复