//python/extensions:config.bzl
Extension for configuring global settings of rules_python.
- module ext config
Global settings for rules_python.
Added in version 1.7.0.
- config.add_transition_setting(setting=None)
Specify a build setting that terminal rules transition on by default.
Terminal rules are rules such as py_binary, py_test, py_wheel, or similar rules that represent some deployable unit. Settings added here can then be used a keys with the
config_settingsattribute.Note
This adds the label as a dependency of the Python rules. Take care to not refer to repositories that are expensive to create or invalidate frequently.
- config.explicit_init_py(default)
Require explicit
__init__.pyfiles in this module.Disables the legacy
__init__.pygeneration for allpy_*targets in this module, requiring all Python targets to explicitly provide__init__.pyfiles when they’re needed.To override this at a per-target level, set
legacy_create_initon applicablepy_binaryorpy_testtargets:py_binary( name = "hello_python", # ... # This Binary still relies on legacy behavior, so # enable the legacy behavior as an exceptional case. legacy_create_init = 1, )
Note
In the future, this will be enabled by default.
Added in version 2.3.0.