<#17717 Allow controlling if all files in the same...
# github-notifications
q
#17717 Allow controlling if all files in the same target should depend on each other when dep inference is disabled New issue created by AlexTereshenkov Is your feature request related to a problem? Please describe. With the current implementation, with dependency inference off, there's an implicit assumption that all files in the same target have a dependency on each other. See #12906 to learn more. Using example-python repo.
Copy code
$ cp helloworld/translator/translator_test.py helloworld/translator/translator_another_test.py                    

$ ./pants dependencies helloworld/translator/translator_test.py                                 
//:reqs#pytest
helloworld/translator/translator.py:lib

$ PANTS_PYTHON_INFER_IMPORTS=False ./pants dependencies helloworld/translator/translator_test.py
helloworld/translator/translator_another_test.py:tests
The current behavior reports
translator_another_test.py
to be a dependency of
helloworld/translator/translator_test.py
, but it's clearly not:
Copy code
$ ./pants paths --to=helloworld/translator/translator_test.py --from=helloworld/translator/translator_another_test.py
[]
It may make sense to have this behavior enabled for
python_sources
, but for
python_tests
this may make less sense as the tests are run independent of each other and normally do not import from each other. For instance, listing dependencies when having changes in a particular test module (with dependency inference disabled), shouldn't list all test modules:
Copy code
./pants --changed-since=HEAD --changed-dependees=direct \
    --filter-target-type=python_test list
Describe the solution you'd like Perhaps it would be better to have an option to disable this behavior; this may be useful in case a user has an own dependency inference implementation and they would like to ignore the builtin one. An advanced option in the
python-infer
may be sensible. pantsbuild/pants