Buck: provider()


This is liable to change in the future.

Creates a declared provider 'constructor'. The return value of this function can be used to create "struct-like" values. Example:
data = provider() d = data(x = 2, y = 3) print(d.x + d.y) # prints 5


  • doc (defaults to '') A description of the provider that can be extracted by documentation generating tools.
  • fields (defaults to None) If specified, restricts the set of allowed fields.
    Possible values are:
    • list of fields:
      provider(fields = ['a', 'b'])

    • dictionary field name -> documentation:
      provider( fields = { 'a' : 'Documentation for a', 'b' : 'Documentation for b' })
    All fields are optional.