full-oyster-41619
08/31/2020, 11:22 AMfrom 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-89482
08/31/2020, 3:52 PMhundreds-father-404
08/31/2020, 5:03 PMDependencies
of a target like this: https://www.pantsbuild.org/v2.0/docs/rules-api-and-target-apiContextAwareObjectFactory
for scm_setup_py
? If so, that unfortunately won’t work. Object
and ContextAwareObjectFactory
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-41619
08/31/2020, 5:39 PMhappy-kitchen-89482
08/31/2020, 6:54 PMfull-oyster-41619
08/31/2020, 8:04 PMhundreds-father-404
08/31/2020, 8:12 PMSo 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
./pants --changed-since=HEAD list
. From there, you can filter out any irrelevant dependees that don’t have a setup_py
.full-oyster-41619
08/31/2020, 8:17 PMhundreds-father-404
08/31/2020, 8:19 PMgit subtree
, 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-41619
08/31/2020, 8:20 PMGLOBAL]
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.
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?"hundreds-father-404
08/31/2020, 8:31 PMHow 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
setup_py
object is parsed, with access to the Rules API. I’m looking into adding that entry point for youfull-oyster-41619
08/31/2020, 8:34 PMhundreds-father-404
08/31/2020, 8:35 PMfull-oyster-41619
08/31/2020, 8:52 PMhundreds-father-404
08/31/2020, 8:56 PMmaster
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 Create binaries
guide, step #1 of creating a binary target type is a good one here. You’ll want to create a new pyinstaller_binary
target type.full-oyster-41619
08/31/2020, 9:10 PM