Support moving and renaming a module with a file destination
Maintainer antworten meist innerhalb von 7 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 38/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 2.2k
- Forks
- 197
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 5
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus python-rope/rope
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
python-rope/rope#927 ·
Maintainer antworten meist innerhalb von 7 Tagen
-
Extract raises IndexError or ModuleSyntaxError instead of RefactoringError for an empty or whitespace-only regionEvtl. vergeben @aliassar hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
python-rope/rope#926 ·
Maintainer antworten meist innerhalb von 7 Tagen
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offsetEvtl. vergeben @sean0407 hat das vor 10 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
python-rope/rope#913 ·
Maintainer antworten meist innerhalb von 7 Tagen
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
python-rope/rope#925 ·
Maintainer antworten meist innerhalb von 7 Tagen
-
Extract method/variable and introduce parameter don't check whether the new name is already in useOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 62/100
python-rope/rope#924 ·
Maintainer antworten meist innerhalb von 7 Tagen
Alle Issues in python-rope/rope
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
unionai-oss/pandera#2640 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
JdeRobot/RoboticsInfrastructure#843 ·
Maintainer antworten meist innerhalb von 1 Tag
-
automated endpoint-dead needs-curation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
almanac-data/climate-almanac#122 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:harness enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
evarness-ai/iris-harness#420 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
suitenumerique/find#206 ·
Maintainer antworten meist innerhalb von 2 Tagen