Skip to content

Commit

Permalink
Address notes
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce Gattis <[email protected]>
  • Loading branch information
BryceGattis committed Mar 8, 2024
1 parent 8c2a6a7 commit 114b9e5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions docs/source/package_definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,15 @@ Early Binding Functions
+++++++++++++++++++++++

Early binding functions use the ``@early`` decorator. They are evaluated at *build time*, hence the
'early' in 'early binding'. Any package attribute can be implemented as an early binding function.
'early' in 'early binding'. By build time, we mean that they are evaluated before the resolve has happened and before
the :ref:`build environment <the-build-environment>` is constructed. Therefore it's important to note a few important
behaviors of early bound functions:

Here is an example of an :attr:`authors` attribute that is automatically set to the contributors of the
package's git project:
- The :attr:`this` object only exposes package attributes and nothing else when used inside an early bound function.
- No Rez-set :ref:`environment variables <environment-variables>` can be accessed inside an early bound function.

Any package attribute can be implemented as an early binding function. Here is an example of an :attr:`authors`
attribute that is automatically set to the contributors of the package's git project:

.. code-block:: python
Expand Down Expand Up @@ -113,12 +118,6 @@ implicit :attr:`this` object:
Do not reference other early bound or late bound attributes in
your early bound function. An error will be raised if you do.

.. warning::
Certain package attributes cannot be accessed inside of an early bound function such as :attr:`this.root`.

Additionally, :ref:`build environment variables <build-environment-variables>` cannot be accessed inside
of early bound functions.

Early binding functions are a convenience. You can always use an arbitrary function instead, like so:

.. code-block:: python
Expand Down

0 comments on commit 114b9e5

Please sign in to comment.