Configure auto-import to omit src from import statements

未关闭
#753 7 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 7 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
tooling

调研方向

The request is for a rope configuration option that controls whether a src/ source folder appears in generated import paths, so start with how rope resolves module names relative to the project root and to configured source folders. The issue mentions python_files and source_folders as settings the reporter already tried, so read how those are handled. Done means a documented option that makes auto-import produce REPO.x rather than src.REPO.x, with tests covering a src/ layout. The thread has been inactive for about 680 days, so confirm with maintainers that the approach is still wanted.

由索引模型根据 Issue 内容生成。

描述

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.

from src.REPO.x import y

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 the src in the import, and instead just use the repo name.
e.g.

from REPO.x import y

Describe alternatives you've considered
See discussion in pylsp: https://github.com/python-lsp/python-lsp-server/discussions/525

I've experimented with changing the existing config of python_files and source_folders, but this hasn't given much success.

Additional context
I use rope as part of pylsp.

主要语言
Python
星标
2.2k
派生
197
平均合并
2 天 13 小时
30 天内合并 PR
5

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

python-rope/rope 的其他 Issue

查看 python-rope/rope 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。