Hello I have a question about pants check logic. ...
# general
f
Hello I have a question about pants check logic. I ran a check command (for mypy especially) as:
pants --changed-since=HEAD check
And it seems like pants check not only files that I changed, but also those files dependencies. Is this an expected behavior? Or I'm misunderstanding something
Copy code
11:02:01.62 [32m[DEBUG][0m Executing: /usr/bin/git --git-dir=<my_repo>/.git --work-tree=<my_repo> diff --name-only HEAD -- <my_repo>
11:02:01.67 [32m[DEBUG][0m Executing: /usr/bin/git --git-dir=<my_repo>/.git --work-tree=<my_repo> diff --name-only HEAD...HEAD -- <my_repo>
11:02:01.69 [32m[DEBUG][0m Executing: /usr/bin/git --git-dir=<my_repo>/.git --work-tree=<my_repo> ls-files --other --exclude-standard --full-name -- <my_repo>
11:02:01.76 [32m[DEBUG][0m Launching 1 roots (poll=false).
11:02:01.77 [32m[DEBUG][0m computed 1 nodes in 0.006004 seconds. there are 8561 total nodes.
11:02:01.77 [32m[DEBUG][0m changed addresses: ChangedAddresses([Address(<file_that_i_modified>.py), Address(<modified_file_directory>:bin), Address(<modified_file_directory>:docker-pex-deps), Address(<file_that_i_not_modified>.py), ...])
I ran w/ debug options and saw these lines. Git commands actually files that I changed, but at
changed addresses
stage, not modified files appear
Copy code
--changed-dependents=none
is also set
c
if you have any BUILD file changes, all addresses declared in that BUILD file will be picked up as changed. Could that be the case here?
f
Definitely that's the case!!! Thank you very much
👍 1
So in which case the files are picked up as changed? 1. If the files are related to the change I made to BUILD 2. If the files are related to the BUILD file I made change What I mean is, if I modifiy some logically unrelated python_source, will other python files be picked up as changed?
c
yea, Pants doesn't track which lines in the BUILD file that the target was declared at currently, so any change in a BUILD file invalidates all targets from that BUILD file, to err on the side of doing too much.
👀 1
Same goes for when you change anything in a
requirements.txt
file for instance, all targets that depend on requirements from that file will be invalidated, even if it doesn't depend on the package that was actually changed, as pants doesn't track that.