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

curved-television-6568

07/09/2021, 11:28 AM
Howdie, I find the rule graph thingy extraordinary useful and powerful. Would love to be able to use it in other projects. How generic is it? Thinking, would it be feasible to extract it as a separate library package for generic use.. ?
w

witty-crayon-22786

07/09/2021, 3:52 PM
glad to hear it, although there are definitely some polish issues we’d like to resolve (…as you mention in your other thread!)
😂 1
👍 1
the rule graph does exist as a separate library, but it is a rust library, and we haven’t published it anywhere: https://github.com/pantsbuild/pants/tree/main/src/rust/engine/rule_graph
i am currently about 40% of the way through a pretty fundamental change in there that is likely to affect semantics: https://github.com/pantsbuild/pants/issues/11269
… so it’s not really the best time to make it more public (although if you want to take a git-level dep with rust/cargo, by all means!)
1
h

happy-kitchen-89482

07/09/2021, 5:13 PM
What are examples of how you could use it outside of Pants? Could you simply use Pants in those cases?
💯 1
c

curved-television-6568

07/09/2021, 8:17 PM
I haven’t worked out a concrete use case as example, just my head seeing possibilities. As I tend to write quite a bit of “data driven pipelines”.. that is, generic pieces that does stuff depending on input data. As a “delivery engineer” working on our in-house tooling for CI/CD and more (for traceability etc) So from that perspective, hmm.. yeah, perhaps I could leverage pants directly to do completely other stuff, using plugins etc to drive the logic and feed it generated “BUILD” files (as they wouldn’t be for building stuff..) That would most likely be easier and more reliable than attempting to rip the rule engine out of its current context into something else.. thanks for that nudge 😉
w

witty-crayon-22786

07/09/2021, 8:26 PM
Mm, yea. There should be a fair amount that is possible to do directly in Pants. If you’re able to divide the “referentially transparent”/idempotent stuff into
@rules
and the side effecting stuff into
@goal_rules
at the top of the graph, lots of CI/CD stuff should be possible
👍 1
it’s also the case that the rules engine is independent from some of the builtin rules provided by Pants’ “engine”
and that is much, much harder to extract.
2 Views