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

crooked-country-1937

01/25/2023, 2:58 AM
anyone here have experience in putting together Pulumi and Pants?
e

enough-analyst-54434

01/25/2023, 3:02 AM
I just searched for pulumi using the slack search interface and got alot of hits. I'm not sure if I can see things you can't. Did you try this?
c

crooked-country-1937

01/25/2023, 3:09 AM
ha - I started searching after posting this 🙂
I am seeing some posts on integrating Pulumi CLI. I wonder whats the experience of folks using the Python API directly? I was thinking of skipping the CLI and using the Python API
e

enough-analyst-54434

01/25/2023, 4:12 AM
You want to have an extremely good reason to use a Python API over a CLI / process. Pants caching is built around processes and tight control of side effects.
It can be the case that an API defeats that.
And in some sense you're getting lucky if not. After all, if the API was jvm, out of luck and you'd be forced to use a process.
c

crooked-country-1937

01/25/2023, 4:41 AM
I am not able to follow. AFAIK, Pulumi CLI is a go binary. For python projects, CLI runs the python code to get the configuration, which is then applied to infra by the go binary. With the Python API, the CLI is still needed. But instead of the execution being controlled by shell, its happens via python. I don’t know how it works exactly, never dived into it deeply. I could be very wrong as well :) Can there be issues if I have a python program execution subprocesses and Pants?
Looking at Pulumi code, eg: https://github.com/pulumi/pulumi/blob/fc27707511f646c111a338e7424c63f61386de53/sdk/python/lib/pulumi/automation/_stack.py#L205 It is spinning up a GRPC server, passing the config as protobuf serialized, and running the command synchronously.