https://pantsbuild.org/ logo
b

breezy-apple-27122

03/15/2023, 8:41 AM
maybe someone asked this already, but let me try: how can python_sources() be recursive instead of adding one BUILD file in each subfolder?
βœ… 1
r

refined-addition-53644

03/15/2023, 8:44 AM
Copy code
python_sources(sources=["**/*.py"])
If you would like to ignore some other
.py
files then
Copy code
python_sources(sources=["**/*.py", "!ignore.py"])
πŸ™Œ 1
magic 1
πŸ‘ 1
w

wide-midnight-78598

03/15/2023, 12:23 PM
If you're interested in some other answers about this subject. Search slack for "111"
b

breezy-apple-27122

03/15/2023, 12:25 PM
Thanks! @average-father-89924 maybe this can help you
πŸ‘€ 1
c

curved-television-6568

03/15/2023, 1:18 PM
notably, for this case, this would be more robust:
Copy code
python_sources(
    sources = [
        "**/" + default for default in
        python_sources.sources.default   
    ]
)
πŸ‘ 1
(if you’re able to use a recent enough version of pants..)