-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
🧱 Simplify Usage of score_python_basics
🎯 Goal
Reduce the boilerplate needed to use score_python_basics
by providing a single-line setup for consumers.
✅ Current Situation
- Setting up Python with
score_python_basics
currently requires ~20 lines of boilerplate. - Users must manually configure
rules_python
, define toolchains, and parserequirements.txt
. - This complexity creates friction, leads to inconsistencies, and clutters
MODULE.bazel
files.
Example of current usage:
# -- Python boilerplate --
PYTHON_VERSION = "3.12"
bazel_dep(name = "rules_python", version = "1.0.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(is_default = True, python_version = PYTHON_VERSION)
use_repo(python)
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = PYTHON_VERSION,
requirements_lock = "//tools:requirements.txt",
)
use_repo(pip, "pip")
# -- End of Python boilerplate --
bazel_dep(name = "score_python_basics", version = "0.3.0")
🚀 Solution
Make score_python_basics
self-contained and declarative. It should:
- Automatically bring in
rules_python
with default configuration. - Provide a default
pip.parse()
setup. - Require minimal or no user-provided boilerplate.
Target usage: one bazel_dep
and a single use_extension()
call.
🛠️ Concrete Tasks
- Provide a setup extension in
score_python_basics
(e.g.setup.bzl
) that wrapsrules_python
andpip
. - Add default toolchain registration and
pip.parse()
under the hood. - Document the new one-liner setup.
- Migrate a few central repos (score, process_description, bazel_registry etc)
🔄 Considered Alternatives
Alternative: Keep the current boilerplate and document it more clearly.
Pros:
- No implementation effort.
- Explicit control remains with the user.
Cons:
- Still tedious and error-prone.
- Discourages adoption.
- Leads to inconsistent setup across teams.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Ready-for-implementation