-
Notifications
You must be signed in to change notification settings - Fork 175
Description
Describe the bug
There seems to be a difference in the resolution of the module name in autoimport.sqlite and in autoimport.pickle. I don't know if this different logic was intentional when the new implementation was written.
autoimport.sqlite.import_assist returns [('MonitoringDocument', 'shared.src.shared.documents')]
autoimport.pickle.import_assist returns [('MonitoringDocument', 'shared.documents')]
The first one is just the relative path and the second one is the right module path.
In the pickle implementation, the function starts in the file's folder and then goes up until it finds a folder that does not contain a init.py file -> https://github.com/python-rope/rope/blob/master/rope/base/libutils.py#L106
In the sqlite implementation, the function starts at the root level of the project and goes down to the file. Along the way, all folder names are added to the modname.
To Reproduce
- Clone https://github.com/SimonMonecke/rope-module-name-resolution
- Run
uv sync - Run
uv run python main.py
Editor information (please complete the following information):
- Project Python version: 3.13.7
- Rope Python version: You can use rope as a lib to reproduce the behavior
- Rope version: 1.14.0
- Text editor/IDE and version: You can use rope as a lib to reproduce the behavior
Additional context
I know that the project structure is a little unusual. Perhaps the solution is that I need to change it and that the sqlite implementation is doing everything right.
Our project is an AWS Lambda function, and another folder contains a project with the code for an ECS task. Both should have access to the code in the shared folder, which is why the shared folder is included as an editable dependency.