Hello! I’m currently evaluating Pants as a replace...
# welcome
b
Hello! I’m currently evaluating Pants as a replacement to an unholy mess of GNU Make, Python, and shell that makes up our current build system. Adding to the joy is that it’s a build system for OS images and so I’m hip-deep in learning how the Pants plugin system works.
🔥 2
👋 4
👖 1
w
Are you working on embedded linux distros? e.g. debootstrap, yocto, buildroot?
b
Welcome! Glad we can offer you something exciting. Do dig right in, and know we always value feedback, ideas, docs fixes, PRs. etc.
b
No, they’re base images used in a cloud computing environment.
The toolchain involves
rpm-ostree
and some other shenanigans.
w
you have my sympathies
🤣 2
b
At the moment I’m trying to scale the learning curve of how all the Pants bits map together. It’d be nice if there were some more worked examples of how you’d construct the scaffolding of Targets, Fields, Rules, etc around a new tool.
w
This is some side-channel info (self-promo): https://sureshjoshi.com/development/first-pants-plugin
b
That doc is a start, yes, but there’s a lot of detail it misses to a greater or lesser extent.
w
Depending on your application, I'd highly recommend reviewing something close in the codebase, because you'll probably end up with like 75% overlap with another plugin. What are you trying to do? I might be able to point you in a direction
b
I’ve got the codebase checked out and I’m mining that for information, yes.
Well at the moment I’m trying to go from an rpm-ostree Treefile to a lockfile. I know the command that needs to end up being invoked but the niceties of how I go from one or more Targets to the Process that does the work is somewhat non-obvious. I’m getting slowly closer though.
Like I said, the doc does a decent job of introducing you to the blocks that you’ll need but doesn’t show very clearly how those blocks go together to form a ~Lego Death Star~plugin.
w
The learning curve is pretty high the first couple times, but once grokked, plugins are pretty straightforward. Have you had a chance to look at the stock example? https://github.com/pantsbuild/example-plugin/tree/main/pants-plugins
I'm not sure what a great comparable is off the top of my head, but I can link to two I've worked on. One being clang-format, which is relatively simple, and then a somewhat more complex PyOxidizer - but about 80% of the complexity of the plugins are in one function in the
rules.py
. https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/cc/lint/clangformat/rules.py https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/python/packaging/pyoxidizer/rules.py If nothing else, maybe it'll help direct some questions? The Slack community is suuuper helpful
b
This is useful feedback. https://pantsbuild.slack.com/archives/C01SPQQ2WK1/p1661908331933459?thread_ts=1661907975.161489&cid=C01SPQQ2WK1 I suspect @hundreds-father-404 would be grateful for more details as to what questions the docs don't answer sufficiently yet from a newcomer's perspective. Being able to see the docs through Beginners Mind is a challenge we want to meet.
b
b
Thanks!