https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-father-404

05/10/2023, 7:09 PM
Do we think the adhoc_tool improvements could change the equation on whether Pants could become purely Rust because fewer people need to write plugins? I know this is a wildcard idea
b

bitter-ability-32190

05/10/2023, 8:09 PM
(my bad I thought this was private chat. Long day, lol) I think more could get ported for sure, but: • I don't think the adhoc improvements model the world in the same, precise way a plugin would. Consider writing a Fortran backend solely in adhoc • We'd be abandoning one real factor to adoption, which is Python plugins are easier to write and iterate on ◦ And this doesn't account for existing plugins in people's repos
I like the out-of-the-box thinking though
h

hundreds-father-404

05/10/2023, 8:12 PM
An idea I had a year ago is to allow people to write Rust plugins. (Very very hand-wavey) Then we port most of Pants to Rust. But at the end of the day, we'd still need a Python interpreter so I think that has fundamental limits. Compared to pure Rust
b

bitter-ability-32190

05/10/2023, 8:14 PM
People can Write Rust plugins today... in a way. It's just very unfortunate that the boundary between plugins is a Python object, so you'd have Rust <-> Python <-> Rust. But we already do that today with our own code. I think
nogil
is our best bet at making that handshaking not "halting the world" so to speak
a

ancient-vegetable-10556

05/10/2023, 8:32 PM
LATE: Relying entirely on
adhoc_tool
+ macros would be a worse experience than Pants 1 😉
👍 1
You’d still have to manually construct your dependency graph, but you’d also need to write your own rules.
but the hope is still that fewer people need to write plugins. Or at least that people have a starting point they can lean on for a lot of features that currently require plugins
b

broad-processor-92400

05/10/2023, 9:14 PM
I could imagine a world where: • adhoc tool or similar BUILD/macros could be used for (basic) dependency inference too • macros can be distributed in some convenient ways eg as pypi packages or Git repos • iterating on adhoc tool as the stable api boundary for “plugins” is less effort/gives a better result than making pants internals stable • (More powerful adhoc tools + a rust backend gives rust “plugins”: have a tool that runs an in-repo rust binary.) I’m not sure how closely my imaginings match reality. (I think adhoc tool is really impactful: right now, it’ll cut our codegen times by like 10x, and simplify the worst parts of our BUILD files, all without us having to keep up with plug-in changes.)
w

witty-crayon-22786

05/11/2023, 12:27 AM
in my experience, the actual language implementations (“plugins”) rarely show up in profiles: at least 80% of runtime is in core @rule code (
graph.py
, etc) to that end, i’m going to spend a few days trying to port core data structures like `Address`/`Field`/`Target` to Rust, and then see about porting some of
graph.py
to Rust as intrisics. made 600 lines of (…untested =P ) progress today.
🦀 2
b

bitter-ability-32190

05/11/2023, 1:08 AM
I should insert (untested) in more of my messaging.
Yeah it (untested) works!
😂 1
w

witty-crayon-22786

05/12/2023, 5:16 AM
i think (hope?) i chose the hardest one first… so much string/path manipulation!: https://github.com/pantsbuild/pants/pull/18989
❤️ 1