I'm trying to align `tailor` to the new, consisten...
# development
h
I'm trying to align
tailor
to the new, consistent CLI args semantics. Most cases are obvious: •
tailor ::
-> everything •
tailor dir::
-> everything in
dir
and below •
tailor dir
-> everything in
dir
The super tricky thing is how to handle a single file,
./pants tailor src/py/tests.py
. Do we think it's important that only adds a
python_tests
target and not
python_sources
if the dir was missing it? Or is it fine if it gets expanded to the whole directory?
1
The super tricky thing is how to handle a single file, ./pants tailor src/py/tests.py. Do we think it's important that only adds a python_tests target and not python_sources if the dir was missing it?
This is challenging to pull off! For example, what if you say to only run on
foo_test.py
and it turns out
bar_test.py
is also missing a
python_tests
target. Do we set
sources=["foo_test.py"]
rather than using the default sources? I think I could probably figure it out...but it is hard and will will likely require rewriting
tailor
implementations
f
Maybe just tell the user that it is ambiguous what to do in that instance?
h
Thank you for the idea. I was about to say "awesome, perfect!" Until I realized that means
./pants --changed-since=HEAD tailor
will error, as it uses
FileLiteralSpec
to work
./pants --changed-since=HEAD tailor
Using this as a case study... • You create a new directory, for now w/ just one test file • I think most users would rather have
python_tests()
than
python_tests(sources=["my_test.py"])
. It's more future-proof Which suggests to me, we should replace a file literal w/ its directory
h
should
tailor
work with single files at all? if
BUILD
files exist at the directory level, I don’t think it makes sense to run
tailor
against files, only directories
h
The only reason I say yes to single files is that
./pants --changed-since=HEAD tailor
should work -- and that requires individual files to work But I ended up implementing this as a single file -> run against that file's whole directory. I'm pretty sure it's what makes sense, and 100x easier to implement
💯 1
h
yeah, that makes sense, and it’s most likely what a user would mean if they asked to run tailor “on a file”
❤️ 1