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

victorious-potato-60449

02/08/2017, 12:01 PM
Hey everyone, I'm currently trying to figure out how to add a custom pants goal (sorry not super familiar with the terms yet) using a custom plugin. I have been trying to follow this: http://www.pantsbuild.org/howto_plugin.html but have hit a wall. Basically I have a simple python function I want to be able to invoke using
pants setup
. My directory structure looks like this:
Copy code
build-support
    plugins
        testplugin
            __init__.py
           register.py
           targets
               __init__.py
               setup_k8s.py    
pants.ini
In my
register.py
I have this
Copy code
from pants.build_graph.build_file_aliases import BuildFileAliases
from testplugin.targets.setup_k8s import setup_k8s

def build_file_aliases():
    return BuildFileAliases(
        objects={
            'setup': setup_k8s
        }
    )
in
setup_k8s
I have this:
Copy code
def setup_k8s():
    print('it worked!')
and in
pants.ini
I have this:
Copy code
[DEFAULT]
pants_version: 1.1.0

pythonpath: [
    '%(buildroot)s/build-support/plugins',
  ]
backend_packages: [
    'testplugin',
  ]
However when I do
./pants setup
I get
Copy code
Unknown goals: setup
Use `pants goals` to list goals.
Use `pants help` to get help.
If anyone can give me any insight into what I'm doing wrong that would be awesome 🙂