full-oyster-4161908/31/2020, 11:22 AM
from pants.backend.python.targets.python_target import PythonTarget from pants.build_graph.build_graph import BuildGraph from pants.build_graph.address import Address, # How to get dependencies? address = Address(lib_path, lib_name) # target = graph??.get_target(address) # target = PythonTarget(name=name, address=address, build_graph=build_graph???) dependencies = target.dependencies()
happy-kitchen-8948208/31/2020, 3:52 PM
hundreds-father-40408/31/2020, 5:03 PM
of a target like this: https://www.pantsbuild.org/v2.0/docs/rules-api-and-target-api
? If so, that unfortunately won’t work.
are both legacy APIs which don’t have access to the Rules API. This speaks to what I think Benjy realized with you last week - we’ll need the Rules API for the power that you’re looking for. My main priority today is helping to land that.
full-oyster-4161908/31/2020, 5:39 PM
happy-kitchen-8948208/31/2020, 6:54 PM
full-oyster-4161908/31/2020, 8:04 PM
hundreds-father-40408/31/2020, 8:12 PM
So I may trying to add a logic of dependencies inside the versioning functionCool. The Rules API has a prebuilt utility to do this, find the “dependees” of any file. For example, run
. From there, you can filter out any irrelevant dependees that don’t have a
./pants --changed-since=HEAD list
full-oyster-4161908/31/2020, 8:17 PM
hundreds-father-40408/31/2020, 8:19 PM
, or that was more in response to what I had said, and you’d be fine using VERSION files that get checked in and are automatically managed?
full-oyster-4161908/31/2020, 8:20 PM
On one hand it says I use the latest stable version 1.30, but I also use pants engine v2. Can you shed some light on my confusion to your initial question: "what pants version are you using?"
GLOBAL] pants_version = "1.30.0" v1 = false # Turn off the v1 execution engine. v2 = true # Enable the v2 execution engine. pantsd = true # Enable the Pants daemon for better performance.
hundreds-father-40408/31/2020, 8:31 PM
How can I setup the rules API inside of my scm function?This is what I’m trying to figure out today. Benjy’s idea from last week was to add an entry point where plugin authors can customize how the
object is parsed, with access to the Rules API. I’m looking into adding that entry point for you
full-oyster-4161908/31/2020, 8:34 PM
hundreds-father-40408/31/2020, 8:35 PM
full-oyster-4161908/31/2020, 8:52 PM
hundreds-father-40408/31/2020, 8:56 PM
branch. We made lots of changes to the Rules API between 1.30 and 2.0 for it to be more stable 2 and 3. Yep 🙂 See https://www.pantsbuild.org/v2.0/docs/plugins-overview, and in particular https://www.pantsbuild.org/v2.0/docs/plugins-binary-goal, which includes a link to an example repo Generally, reading those docs will likely go further than looking at the source code without guidance. On the
guide, step #1 of creating a binary target type is a good one here. You’ll want to create a new
full-oyster-4161908/31/2020, 9:10 PM