-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependees (dependents) should return dependent files for removed modules #17512
Comments
To be sure I understand this example: When you removed |
This is just removing the Take a CI run for example. A PR pushes code which removes An option I can think of is having some process outside of Pants (lint tool / typechecking) that can protect against these types of changes. |
Ah, I see, so this would be for, e.g., detecting that bad import in the first place. |
So one immediate option, for now, is to run dep inference on the entire repo (which should be cheap with caching) and look for WARNings about imports that couldn't be resolved. |
But also, this could be made to work as you expect by adding module mappings for deleted files. Might require synthesizing targets for them (so @kaos's new synthetic targets feature might come in handy!) |
Very sorry for the trouble. This is a dupe of #14975. Our conclusion on that issue was that https://www.pantsbuild.org/v2.14/docs/reference-python-infer#section-unowned-dependency-behavior is critical, which is why it became a warning in the While we probably can't set the default to |
@stuhood thank you for the response, definitely is related! I changed The error is better than potentially missing a test in CI but I'm curious if there's a seamless way to have Pants handle these cases out of the box. |
@njgrisafi do you have such warnings in your codebase that you're currently suppressing? |
I'd like to tease out the practical distinction, from a user perspective, of erroring during dep resolution vs during a test run, since in both cases the failure is due to the same cause - an import that has no matching provider. |
Is your feature request related to a problem? Please describe.
Related to this bug report I opened but changed it into a feature request.
When removing a whole Python module
dependees
(nowdependents
) does not return dependent files. On the latest version 2.14 and it seems to be a warning:On earlier versions it returns no output.
Describe the solution you'd like
When removing modules and then running
./pants dependees --changed-since
(ordependents
), dependent targets of the removed modules will be returned in the output.For example, given this module:
When removing
app/module_2/
, add changes in git and then running./pants dependees --changed-since=HEAD
it should returnapp/module_1/example.py
in the results.Describe alternatives you've considered
An additional layer of tooling over pants to detect these issues. Custom logic to account for this. Open to more ideas.
Additional info
Please see example repo with predefined version branches:
Checkout one of the follow version branches above and perform the following test:
rm -rf app/module_2/
git add --all
./pants dependees --changed-since=HEAD
The text was updated successfully, but these errors were encountered: