bazel-contrib / bazel-contrib/rules_python
`runfiles` module name conflicts with PyCharm
- 主要言語
- Starlark
- スター
- 688
- フォーク
- 721
- 平均マージ
- 15時間 7分
- マージ済み PR(30日)
- 76
説明
# 🐞 bug report
### Affected Rule
`runfiles`
### Is this a regression?
No
### Description
PyCharm's Python console adds some stuff to the import path including a `runfiles` module. So when users open a project that supports both Bazel and virtual environments using this console, they run into errors like
```
>>> import mytest
Traceback (most recent call last):
File "", line 1, in
File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/tmp/PythonProject/mytest/__init__.py", line 1, in
from runfiles import Runfiles
ImportError: cannot import name 'Runfiles' from 'runfiles' (/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/runfiles.py)
```
There doesn't seem to be any way around this other than wrapping `from runfiles import Runfiles` in some `try/except` or similar, which is unfortunate.
What if we had the `bazel-runfiles` package ship its implementation in a `bazel_runfiles` module instead, with `runfiles` remaining and serving as a simple proxy? This would allow affected environments to use
```
from bazel_runfiles import Runfiles
```
which should avoid any naming conflicts.
コントリビューションガイド
調査の方向性
まず、Python パッケージ bazel-runfiles とそのパッケージングのエントリポイントを特定します。runfiles をプロキシとして維持しながら、bazel_runfiles を通じて実装を公開する方法を確認し、その後、提案された import によって既存のユーザーを壊すことなく PyCharm との競合を回避できることを検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100