I got it all working! Thanks a ton for the help <@...
# plugins
c
I got it all working! Thanks a ton for the help @hundreds-father-404
👏 2
👍 1
h
Awesome to hear! I’m glad it’s working. You might need to make some small tweaks when you upgrade to new Pants versions, as the Rules API isn’t completely stable yet. But we try to minimize the changes, and will post in this channel / elsewhere a guide on how to upgrade
Oh also one enhancement idea I had for your plugin: it assumes that
setup.py
is in the same directory as where you declare your
cython_library
. You can make this assumption explicit by implementing the method
validate_resolved_files()
on `CythonSources`:
Copy code
def validate_resolved_files(self, files: Sequence[str]) -> None:
   super().validate_resolved_files(files)
   if os.path.join(self.address.spec_path, "setup.py") not in files:
    raise InvalidFieldException(...)
👍 1
Btw, let us know if you’re interested in writing automated tests for your plugin. We’d be happy to help. We wrote ~reference style docs for it, but haven’t started yet with guided examples. https://www.pantsbuild.org/docs/rules-api-testing
w
if you’re interested in upstreaming the plugin to the Pants repo, we’d also be happy to help with that, as it will mean you don’t have to deal with changes before the plugin API stabilizes.