bazel-contrib / bazel-contrib/rules_python

Gazelle target generation (breaking) changed in 1.6.0

未关闭
#3,499 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
gazelle
主要语言
Starlark
星标
688
派生
721
平均合并
15 小时 7 分钟
30 天内合并 PR
76

描述

# 🐞 bug report

### Affected Rule

`py_test`/`py_library` (and Gazelle, not a rule)

### Is this a regression?

I'd argue so 😓. https://github.com/bazel-contrib/rules_python/pull/2998 introduced the new behavior (released in 1.6.0).

(more details in description)

### Description

(Before I begin, please note I _like_ https://github.com/bazel-contrib/rules_python/pull/2998 as a change. I just don't like a seemingly breaking change without any warning or toggles or migration path).

I'm upgrading my work monorepo `rules_python` to the latest, version-by-version. `1.6.0` has apparently become a very hard stop on my journey, due to incompatible gazelle changes. At a high level this is because:

- After upgrade, `gazelle` is happy to add new targets, while leaving the old targets alone
- There's no way to emulate the old behavior. The closest is trying different `# gazelle:python_generation_mode`s to see what gives me a small (enough) diff
- There's no way to incrementally roll this out (e.g. the result is one mega-PR)
- Whereas the old way made it so you could cleverly solve import cycles (across multiple subdirs) the new way makes that challenging
- [conftest inclusion is a bit broken](https://github.com/bazel-contrib/rules_python/issues/3497)

## 🔬 Minimal Reproduction

(I'll try and work on a demo repo showing each of the bullet points above, bear with me)

## 🔥 Exception or Error

(N/A)

## 🌍 Your Environment

(N/A)

贡献指南

打开贡献指南

调研方向

首先查看 PR #2998 和 Gazelle 的 python_generation_mode 行为,比较升级到 1.6.0 前后生成的 targets。然后围绕 py_test 和 py_library 构建承诺的最小复现,并确定哪种迁移路径或有界 fix 可以解决 issue #3497 中提到的增量生成、import cycle 和 conftest 包含问题。

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

评估

技术栈
python
领域
build-system
Issue 类型
缺陷
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

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