xref: /aosp_15_r20/external/bazelbuild-rules_python/docs/glossary.md (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1*60517a1eSAndroid Build Coastguard Worker# Glossary
2*60517a1eSAndroid Build Coastguard Worker
3*60517a1eSAndroid Build Coastguard Worker{.glossary}
4*60517a1eSAndroid Build Coastguard Worker
5*60517a1eSAndroid Build Coastguard Workercommon attributes
6*60517a1eSAndroid Build Coastguard Worker: Every rule has a set of common attributes. See Bazel's
7*60517a1eSAndroid Build Coastguard Worker  [Common attributes](https://bazel.build/reference/be/common-definitions#common-attributes)
8*60517a1eSAndroid Build Coastguard Worker  for a complete listing
9*60517a1eSAndroid Build Coastguard Worker
10*60517a1eSAndroid Build Coastguard Workerin-build runtime
11*60517a1eSAndroid Build Coastguard Worker: An in-build runtime is one where the Python runtime, and all its files, are
12*60517a1eSAndroid Build Coastguard Workerknown to the build system and a Python binary includes all the necessary parts
13*60517a1eSAndroid Build Coastguard Workerof the runtime in its runfiles. Such runtimes may be remotely downloaded, part
14*60517a1eSAndroid Build Coastguard Workerof your source control, or mapped in from local files by repositories.
15*60517a1eSAndroid Build Coastguard Worker
16*60517a1eSAndroid Build Coastguard WorkerThe main advantage of in-build runtimes is they ensure you know what Python
17*60517a1eSAndroid Build Coastguard Workerruntime will be used, since it's part of the build itself and included in
18*60517a1eSAndroid Build Coastguard Workerthe resulting binary. The main disadvantage is the additional work it adds to
19*60517a1eSAndroid Build Coastguard Workerbuilding. The whole Python runtime is included in a Python binary's runfiles,
20*60517a1eSAndroid Build Coastguard Workerwhich can be a significant number of files.
21*60517a1eSAndroid Build Coastguard Worker
22*60517a1eSAndroid Build Coastguard Workerplatform runtime
23*60517a1eSAndroid Build Coastguard Worker: A platform runtime is a Python runtime that is assumed to be installed on the
24*60517a1eSAndroid Build Coastguard Workersystem where a Python binary runs, whereever that may be. For example, using `/usr/bin/python3`
25*60517a1eSAndroid Build Coastguard Workeras the interpreter is a platform runtime -- it assumes that, wherever the binary
26*60517a1eSAndroid Build Coastguard Workerruns (your local machine, a remote worker, within a container, etc), that path
27*60517a1eSAndroid Build Coastguard Workeris available. Such runtimes are _not_ part of a binary's runfiles.
28*60517a1eSAndroid Build Coastguard Worker
29*60517a1eSAndroid Build Coastguard WorkerThe main advantage of platform runtimes is they are lightweight insofar as
30*60517a1eSAndroid Build Coastguard Workerbuilding the binary is concerned. All Bazel has to do is pass along a string
31*60517a1eSAndroid Build Coastguard Workerpath to the interpreter. The disadvantage is, if you don't control the systems
32*60517a1eSAndroid Build Coastguard Workerbeing run on, you may get different Python installations than expected.
33*60517a1eSAndroid Build Coastguard Worker
34*60517a1eSAndroid Build Coastguard Workerrule callable
35*60517a1eSAndroid Build Coastguard Worker: A function that behaves like a rule. This includes, but is not is not
36*60517a1eSAndroid Build Coastguard Worker  limited to:
37*60517a1eSAndroid Build Coastguard Worker  * Accepts a `name` arg and other {term}`common attributes`.
38*60517a1eSAndroid Build Coastguard Worker  * Has no return value (i.e. returns `None`).
39*60517a1eSAndroid Build Coastguard Worker  * Creates at least a target named `name`
40*60517a1eSAndroid Build Coastguard Worker
41*60517a1eSAndroid Build Coastguard Worker  There is usually an implicit interface about what attributes and values are
42*60517a1eSAndroid Build Coastguard Worker  accepted; refer to the respective API accepting this type.
43*60517a1eSAndroid Build Coastguard Worker
44*60517a1eSAndroid Build Coastguard Workersimple label
45*60517a1eSAndroid Build Coastguard Worker: A `str` or `Label` object but not a _direct_ `select` object. These usually
46*60517a1eSAndroid Build Coastguard Worker  mean a string manipulation is occuring, which can't be done on `select`
47*60517a1eSAndroid Build Coastguard Worker  objects. Such attributes are usually still configurable if an alias is used,
48*60517a1eSAndroid Build Coastguard Worker  and a reference to the alias is passed instead.
49*60517a1eSAndroid Build Coastguard Worker
50*60517a1eSAndroid Build Coastguard Workernonconfigurable
51*60517a1eSAndroid Build Coastguard Worker: A nonconfigurable value cannot use `select`. See Bazel's
52*60517a1eSAndroid Build Coastguard Worker  [configurable attributes](https://bazel.build/reference/be/common-definitions#configurable-attributes) documentation.
53*60517a1eSAndroid Build Coastguard Worker
54