microscopic-knife-5995
02/03/2025, 8:06 PMrequirements.txt per Pants target. Hello team, I am seeking advice. I would like to generate a requirements.txt for a Pants target so that in the actual remote execution environment (Docker) I can do pip -r requirements.txt . What is the best way to achieve this?
Couple of approaches I can think of:
1. Use shell_command and invoke pants dependencies. I am not sure whether I can invoke a Pants command within a Pants command.
2. Write a plugin that somehow hook into Pants dependency results? I think I know how to write such plugin for Bazel / Blaze, but not sure how to approach this in Pants.
Could you give me some advice on what is best practice? I did search on Slack but it seems no one has done this before?
PS. Before you think I am doing this all wrong, I did do a multi-platform PEX previously, but the size of the PEX is enormous as it requires all the ML stack. Another reality is that ML researchers are not used to PEX, and it seems they are would prefer the traditional venv / Docker debug path...broad-processor-92400
02/03/2025, 11:55 PMlayout="packed" and separating third-party and first-party code into separate pexes. The second link there goes into more detail.)
Re the approaches:
1. recursive pants invocations can work, although will be a bit fiddly and slow, so generally not recommended
2. yeah, a plugin might work: https://www.pantsbuild.org/stable/docs/writing-plugins/overview has the docs about these, although might be an uphill battlemicroscopic-knife-5995
02/03/2025, 11:57 PM