curved-television-6568
10/07/2022, 6:59 PM$ ./pants my-feat --help
Usage: python -m my-feat [OPTIONS]
Options:
--feat-1
--another
--help
...
This is possible by using [cli.alias]
in pants.toml
and a pex_binary
target some where in your first party code base (could be a utility tree living outside your regular application code, it just needs to be in a source root).
[cli.alias]
my-feat = "run src/utils/my_feat.py --"
Then in src/utils/BUILD
pex_binary(.., entry_point="my_feat.py")
Then implement my_feat.py
as any regular cli tool, using click
or what makes most sense to you.high-yak-85899
10/07/2022, 7:15 PMbitter-ability-32190
10/07/2022, 7:31 PMhappy-kitchen-89482
10/07/2022, 8:46 PMbitter-ability-32190
10/07/2022, 8:47 PMbusy-vase-39202
10/07/2022, 9:50 PMbitter-ability-32190
10/10/2022, 3:20 PMpipx
which is used for sandboxing CLI tools. Pants' approach is spiritually equivalent, but can be shared across machines in the monorepo.
We do this for things like awscli
busy-vase-39202
10/10/2022, 4:22 PM#pantsbuildhints
? #pantsbuildtip
looks wonky to me for some reason. Anything without "build", e.g. #pantstips
risks being interpreted by twitter as a fashion topic, unfortunately.bitter-ability-32190
10/11/2022, 2:59 PMbusy-vase-39202
10/11/2022, 3:06 PM@pantsbuild
account anywhere within the tweet I'll get notified automatically. One less step for y'all to do, plus readers can jump right to additional pants content.bitter-ability-32190
10/11/2022, 3:26 PMbusy-vase-39202
10/11/2022, 3:58 PMcurved-television-6568
10/11/2022, 4:02 PMbusy-vase-39202
10/11/2022, 4:10 PMcurved-television-6568
10/11/2022, 4:14 PMbitter-ability-32190
10/11/2022, 4:14 PM