Hi everyone. I'm evaluating Pants for suitability...
# general
f
Hi everyone. I'm evaluating Pants for suitability for our custom tool chains. Looking at the samples, I don't really see anything that follows the "source -> codegen -> compiler -> artifact" build idiom. Does anyone know of some samples I can look at to get a feel for how to implement our flow?
e
Not sure if this is quite what you are looking for, but you may find this blog post interesting: https://www.pantsbuild.org/blog/2021/10/13/pants-pex-and-docker It doesn't mention a codegen step, but there are codegen tools supported by pants (unfortunately I do not have any experience with them yet, so can't make much comment on them). Assuming python, a pretty standard workflow (there are others, of course, but this is mine at $DAY_JOB) when using pants is: • define a "resolve" (lockfile) containing all 3rd party dependencies used in your application • create your (python) source files • define an "entrypoint/startup file" for each service • build a PEX (Python EXecutable) for each entrypoint ◦ pants will perform dependency inference to ensure these PEX files contain the minimal subset of 3rd party dependencies and source code • build docker images based on the PEX files (just copy the PEX into a base image) • create helm charts that refer to the docker images My release artifacts are docker images and helm charts. Pants can go as far as publishing these to registries (eg. artifactory) for you. There is some deployment support for helm as well, though my use case is to just publish the helm charts and then my environments use ArgoCD to pull from artifactory (ie. I don't use pants for deployment). Treating the PEX files directly as release artifacts is also pretty useful, since they contain everything needed to run except for a python interpreter, so its easy to distribute a single file that will work on any machine with the right version of python. (We use this to release helper tools for devs, QA and services teams). Pants does also support
python_distribution
(eg. for releasing python packages to PyPI), though I don't use this myself, so no comment from me.. Other languages are supported as well. You may want to take a look at https://www.pantsbuild.org/stable/reference/targets (reference page, not a how-to-use doc). It lists all the targets supported by pants, so you can see, for instance, that there is support for go, java, avro, debian packaging, etc.)
Apologies, that's a lot of words... hopefully something there is helpful and can get you pointed in the right direction.
There are also a bunch of "example-*" repos at https://github.com/pantsbuild which you may find helpful, though they are fairly basic