Support moving and renaming a module with a file destination
Les mainteneurs répondent en général sous 2 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 38/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 2.2k
- Forks
- 197
- Merge moyen
- 1 j 20 h
- PR mergées (30 j)
- 7
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python-rope/rope
-
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
python-rope/rope#927 ·
Les mainteneurs répondent en général sous 2 jours
-
Extract raises IndexError or ModuleSyntaxError instead of RefactoringError for an empty or whitespace-only regionPeut-être pris @aliassar l’a pris il y a 3 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
python-rope/rope#926 ·
Les mainteneurs répondent en général sous 2 jours
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offsetPeut-être pris @sean0407 l’a pris il y a 13 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
python-rope/rope#913 ·
Les mainteneurs répondent en général sous 2 jours
-
Implement nonlocal variables scoping rule for rename refactorPeut-être pris @ryanchou1994 l’a pris aujourd’hui. Ouvertebug
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
python-rope/rope#935 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 4/5 3-5 jours Accessibilité débutants 30/100
python-rope/rope#925 ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de python-rope/rope
Issues similaires
-
docs size:S
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
strawberry-graphql/strawberry#4794 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
dataforgoodfr/cetolog#21 ·
-
security_citations_test fails against ecc 2026.11.6: SECURITY.md quotes ecc v2026.11.2's linesOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
btclib-org/btclib#2932 ·
Les mainteneurs répondent en général sous 1 jour