bazel-contrib / bazel-contrib/rules_python
[proposal] requires_python attribute
- 主要言語
- Starlark
- スター
- 688
- フォーク
- 721
- 平均マージ
- 15時間 7分
- マージ済み PR(30日)
- 76
説明
While having a global Python interpreter choice works fine for small repositories, in large repositories there are potentially considerable code compatibility concerns across interpreter/virtualenv versions and migrations of language versions require supporting split states where some targets have converted and others may not have converted.
Today it's possible to set up multiple Python toolchains and multiple virtualenvs and use build configuration to choose how a given target or group are built/tested and that works fine.
A problem we've encountered is that users who wish to _drop backwards compatibility_ have a hard time doing so in a sound way. Consider a service which has been able to adopt a new interpreter and would like to adopt new language features such as `:=` or `match`. Code which has adopted a syntax extension feature like this is no longer backwards compatible to earlier interpreters which can cause problems both in linting and if there are targets configured for older interpreters which depend on targets that have adopted these features.
The idea I've been kicking around is to extend `PyInfo` with a `requires_python` attribute expressing the interpreter constraint range same as in `setuptools`. It should also be possible for at a minimum the `py_binary` rule implementation to perform a consistency check over all the `PyInfo.requires_python` values and ensure that the rule as defined contains only compatible sources. It would also be desirable to be able to restrict eg. `rules_lint` behavior so that 3.8 linting would be applied only to 3.8 compatible sources; the alternative being choking on 3.11 features.
Thoughts?
コントリビューションガイド
調査の方向性
Start by reviewing the proposal for a PyInfo.requires_python attribute and how py_binary currently validates its sources. Consider how the constraint range would relate to setuptools and whether rules_lint could limit linting to compatible sources. Done would require an agreed design and clear consistency-check behavior, which the issue does not yet specify.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- build-system
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100