I am trying to figure out what's a good way to (1...
# general
r
I am trying to figure out what's a good way to (1) dynamically generate config files based on inputs to a target. (2) package a subset of my py codebase from target and its deps (3) outputs from step 1 are part step 2. (4) generate a
requirements.txt
that cover my codebase subset from step 2. I found that I could use
pex_binary
for step 2. It's suboptimal because I only care about the python files, and generated proto code but I can live with that. I don't know how to do (1), (3), and (4).
To be more concrete, I want to have a rule:
Copy code
my_config_rule(name=str, configs=dict[str, str])
The output of
my_config_rule
should be a json file:
Copy code
{
  # Other omitted key values
  # The other values come from a fixed template.
  "configs": <configs from rule>
}
e
This sounds a little bit like an XY problem. You've got a bunch of particular steps in mind, but I think we might be able to help you better if we can understand your end goal
r
I want to deploy my langgraph app, which needs to following this file structure: https://langchain-ai.github.io/langgraph/concepts/application_structure/#key-concepts
I am sure I can do it but I am unable to piece the tools together.
c
I think you might need a plugin for this. I know we have plugins for some other hosted-compute formats (AWS Lambda and Google Cloud Functions). With a plugin, you could get all the sources with
Get(SourceFiles, ...)
. There's already machinery to get a list of Python requirements (I'd have to look up the specifics). And you can just make files whenever you want with
CreateDigest
. Without a plugin, I could imagine trying to use a script that chains
pants dependencies --transitive
and
pants peek
. But it would honestly be much easier with a plugin.
you could open an enhancement request issue on GitHub. I'm not sure how familiar folks on the Pants team are with langchain-ai's format. It would be good if the issue outlined the expected workflow, what sorts of options are important to provide, and the other sorts of guidance that someone experienced could provide.
r
Thanks @careful-address-89803. I was able to find an intermediate solution using several pants commands but it's not very satisfactory. I am interested in a plugin solution. I do as you suggested, and try to even get a stub at it with the advise of others.
f
@rough-engineer-58925, I’m looking at integrating a LangGraph app in our pants-managed monorepo. Do you mind sharing your solution?