What is the better way of creating a target from a...
# general
r
What is the better way of creating a target from a python package which has further sub-packages with BUILD files? I have done it with
sources
set to glob pattern like
dir_name/***/**.py
. With the glob pattern the issue is that the sub-modules can be owned by two targets - one at the top level and the other one from the nested sub packages with BUILD files.
h
sources=['**/*.py']
will capture everything in the BUILD file's directory and below it
Oh I see what you're asking
It's up to you: If you want one coarse target that globs over everything in all the subdirs you can do that, and then you should remove the targets in the subdirs, or if you want targets in each dir you can do that (and the default
sources
should work)
I'd recommend the latter, and it's what
./pants tailor
will create by default
Why do you need that glob pattern to begin with?
r
We had this discussion while building a python distribution. One thing I wanted to do was to put all of my
tests
dependencies on the underlying python package, something like what's mentioned in this v1 documentation section
BUILD for Tests
https://v1.pantsbuild.org/python_readme.html