cool-easter-32542
09/06/2023, 8:13 AMpex_binary) the script will always execute the __init__.py file in the same directory and all parent init files.
Setting the `init_files` option has no effect which is expected given the documentation:
Even if this is set to never or content_only, Pants will still always include any ancestor __init__.py files in the sandbox. Only, they will not be "proper" dependencies, e.g. they will not show up in pants dependencies and their own dependencies will not be used.
Coming from other build tooling such as Bazel this behavior is confusing because one expects to have fine-grained control over dependencies. Source files in parent directories should by default not be considered dependencies.
Here is a file structure to illustrate the problem:
.
└── apps/
├── BUILD
├── __init__.py # outer init
└── scripts/
├── BUILD
├── __init__.py # inner init
└── script.py
Pants version
2.16.0
OS
MacOS
Additional info
I reproduced the behavior in this repository: https://github.com/chrismatix/pants-pex-repro
pantsbuild/pants