-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure auto-import to omit src from import statements #753
Comments
I've created a repo to show an example of what currently happens when using rope in pylsp for importing a function: |
It'd be better to have it automatically use another venv path. You can probably do this in pylsp by editing the rope config. |
Maybe rope could read poetry's section in pyproject.toml to find the real application's root? The |
I am a bit skeptical about this idea as Poetry's I think a better solution would be to introduce a new config in @lieryan please let me know what you think, I'm happy to take a first stab if you like any of my ideas. |
I think, best possible solution is to require 0 setup effort from the user.
Sure, it's adding few extra lines of code, but it just works for thousands of users. |
Hi thanks everyone for the interest in this idea. I think it makes sense to read PEP621 metadata to get the project root structure. Reading Poetry metadata can be implemented as well as a fallback source of configuration, if there's anyone interested in it, but I agree that if we implement both, PEP621 should take higher precedence. @fast-90 feel free to pick up PEP621 project root support, with or without Poetry, if you want to take a stab at implementing this. I'm not a big fan of having a default list of directories like |
I think |
Is your feature request related to a problem? Please describe.
I work in python projects that use poetry for dependency management, and use a
src/
folder for the repository. When importing an anything from within the repo, rope defaults to importing relative to the root directory, instead of from the package source.e.g.
Describe the solution you'd like
I'd like to be able to set a configuration for rope (eg in
pytool.toml
) to tell Rope to not reference thesrc
in the import, and instead just use the repo name.e.g.
Describe alternatives you've considered
See discussion in pylsp: python-lsp/python-lsp-server#525
I've experimented with changing the existing config of
python_files
andsource_folders
, but this hasn't given much success.Additional context
I use rope as part of pylsp.
The text was updated successfully, but these errors were encountered: