https://pantsbuild.org/ logo
#general
Title
# general
d

damp-quill-59187

12/20/2019, 8:33 PM
Quick question, how do I make a function available in a pants BUILD file. I've noticed the warn against direct imports, and I can't seem to find in the documentation how to do it. i.e.
setup_py
is available as a function call, would like to be able to allow my own function calls. I'm familiar with the plugin setup, but can't seem to be able to wire this piece together
a

aloof-angle-91616

12/20/2019, 8:33 PM
this is the
objects
part of BuildFileAliases
d

damp-quill-59187

12/20/2019, 8:37 PM
So something along the lines of register.py
Copy code
def build_file_aliases():
  def my_func():
    pass
  return BuildFileAliases(
    objects={
      'my_func' : my_func
     }
  )
👍 1
a

aloof-angle-91616

12/20/2019, 10:47 PM
yes! sorry, was in a meeting immediately after responding to that lol
you can also import the func from elsewhere
👍 1
3 Views