Hi, is it possible to add a pex_binary as a depend...
# general
l
Hi, is it possible to add a pex_binary as a dependency to a python_source? Currently, the run command does not fail, but the file can not be found during execution.
h
Can you give more details on what you're trying to do? I.e., your target layout and what you're `run`ning? A trivial github repo that demonstrates what you expect to happen vs what actually happens would be the gold standard.
l
@happy-kitchen-89482 I will try to give an explicit example in the following days. In short, I need the generated .pex in my (Python) AWS-CDK Stack. I want it to be treated as a resource basically.
h
To embed it in a docker image, say?
l
No, we create a AWS-Greengrass component. CDK uploads the resource to a s3 bucket. It would be beneficial for us to just upload the .pex instead of the source code, which would also be a solution
Another use case is, we create a open policy agent bundle with a pants plugin (a tar.gz file). This file we want to add to our cdk deployment.
h
Hmm so I'm not seeing why you need the
pex_binary
to be the dep of a
python_source
? What is in that
python_source
?
l
In python source we run our CDK deployment script
Copy code
python_sources(name="lib")

python_source(
    name="app",
    source="app.py",
    dependencies=[":lib"],
    run_goal_use_sandbox=False,
)
CDK requires lambda.zip, .pex, bundle.tar.gz files etc. Currently, we run a bash script to package the required modules and move them to the directories CDK expects them. It would be convenient to use a more pants like approach. I guess the main problem is that CDK is used as a run goal, but it actually should be a publish goal.