rapid-crayon-8232
04/15/2020, 5:51 PMbinary
goal on multiple files, pants don't automatically ignore other goals, works well with the test goal btw
When you glob over files or targets, Pants knows to ignore ones that aren't relevant to the requested goal.and throws the following error:
ERROR: The `run` and `binary` goals only work with the following target types: ['python_binary']
You used packages-python-pants/helloworld/greet:greet with target type 'python_library'.
hundreds-father-404
04/15/2020, 5:52 PMhundreds-father-404
04/15/2020, 5:57 PMhelloworld/app.py
, but its owning target is a python_library
instead of python_binary
, we could make a change so that we allow Pants to figure out if it can convert that library into a binary by doing things like looking if the source file has a __main__
function.
It’s not yet confirmed we want this. It could be confusing to people and there’s an argument that we want the explicitness of creating a python_binary
target. But it’s now at least possible to dorapid-crayon-8232
04/15/2020, 6:07 PMlibrary
and binary
goalshundreds-father-404
04/15/2020, 6:09 PM./pants binary app.py
without needing to manually set up BUILD filesrapid-crayon-8232
04/15/2020, 6:12 PMpython app.py
will do, if you have dependencies on 3rdparty
, and/or other `python_library`'s you will have to set up a BUILD file anyway, no?hundreds-father-404
04/15/2020, 6:16 PMhundreds-father-404
04/15/2020, 6:25 PMpython_binary
even with buildgen and/or dependency inference.
Constraints are ironically liberating, such as the Paradox of Choice https://en.wikipedia.org/wiki/The_Paradox_of_Choice. It’s less cognitive overhead if you can only run ./pants binary
on binary targets, rather than thinking “wait now I can run this on libraries too?”rapid-crayon-8232
04/15/2020, 6:34 PMhundreds-father-404
04/15/2020, 6:41 PM./pants test
and read BUILD files
(I try to take the perspective of when I first used Pants ~two years ago as a summer intern at Foursquare hehe. Would this make sense to me as an intern who didn’t know what a monorepo was two days ago?)
--
This includes confusing error messages. We’ve been trying to do a better job at not only explaining the what, but also the why and how to fix (where relevant). Still, it’s easy for us to miss somerapid-crayon-8232
04/15/2020, 6:46 PMhundreds-father-404
04/15/2020, 6:46 PMrapid-crayon-8232
04/15/2020, 6:56 PMpants test
in package/data
will run the python_test
target in package/data/BUILD
.hundreds-father-404
04/15/2020, 6:59 PMpants.toml
supporthappy-kitchen-89482
04/15/2020, 7:08 PM./pants
script does is pick the right version of Pants to use.happy-kitchen-89482
04/15/2020, 7:08 PMhappy-kitchen-89482
04/15/2020, 7:08 PMpants
binary on your PATH would still have to do something like thathappy-kitchen-89482
04/15/2020, 7:08 PMpants
that enforces a specific version.happy-kitchen-89482
04/15/2020, 7:09 PMrapid-crayon-8232
04/15/2020, 7:11 PMrapid-crayon-8232
04/15/2020, 7:11 PM