Skip to content

Commit b9eb38a

Browse files
authored
Improve clarify of early binding functions documentation (#1677)
Improve clarify of early binding functions documentation by documenting what is accessible within an early function. Signed-off-by: Bryce Gattis <[email protected]>
1 parent 1624f4f commit b9eb38a

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

docs/source/building_packages.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ package with two python-based variants might look like this:
2323
2424
The current working directory is set to the *build path* during a build.
2525

26+
.. _the-build-environment:
27+
2628
The Build Environment
2729
=====================
2830

docs/source/environment.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ removed**:
121121
Build Environment Variables
122122
===========================
123123

124-
These are variables that rez generates within a build environment, in addition
125-
to those listed :ref:`here <context-environment-variables>`.
124+
These are variables that rez generates within a :ref:`build environment <the-build-environment>`, in addition
125+
to context environment variables listed :ref:`here <context-environment-variables>`.
126126

127127
.. glossary::
128128

docs/source/package_definition.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,19 @@ and *late binding* functions - and these are decorated using ``@early`` and ``@l
7979
Early Binding Functions
8080
+++++++++++++++++++++++
8181

82-
Early binding functions use the ``@early`` decorator. They are evaluated at *build time*, hence the
83-
'early' in 'early binding'. Any package attribute can be implemented as an early binding function.
84-
85-
Here is an example of an :attr:`authors` attribute that is automatically set to the contributors of the
86-
package's git project:
82+
Early binding functions use the ``@early`` decorator. They are evaluated at
83+
*build time*, hence the 'early' in 'early binding' and their definition persists
84+
in the installed ``package.py``. By 'build time', it is meant that they are
85+
evaluated before the resolve has occurred, and as such, before the
86+
:ref:`build environment <the-build-environment>` has been constructed. Therefore
87+
there are some important distinctions that set early-bound functions apart from
88+
other function attributes:
89+
90+
- The :attr:`this` object only exposes package attributes. Nothing else is accessible when inside an early-bound function.
91+
- No rez-set :doc:`environment variables <environment>` can be accessed inside an early bound function.
92+
93+
Any package attribute can be implemented as an early binding function. Here is an example of an :attr:`authors`
94+
attribute that is automatically set to the contributors of the package's git project:
8795

8896
.. code-block:: python
8997

0 commit comments

Comments
 (0)