square-psychiatrist-19087
12/12/2023, 12:56 AMsquare-psychiatrist-19087
12/12/2023, 12:58 AMbetter-van-82973
12/12/2023, 12:59 AMsquare-psychiatrist-19087
12/12/2023, 1:02 AMbetter-van-82973
12/12/2023, 1:04 AMsquare-psychiatrist-19087
12/12/2023, 1:08 AMbroad-processor-92400
12/12/2023, 1:18 AMX
but can still interact with the "independent" class `Y`:
class X:
pass
class Y:
pass
# In another file:
import inspect
# from ... import X, but can still access Y
print(inspect.getmodule(X).Y)
curved-television-6568
12/12/2023, 1:29 AMfresh-cat-90827
12/13/2023, 12:28 PM--changed-since
works, but I am skeptical it will be easy/possible. An arguably easier option would be to run a custom goal that would list what files have changed and then feed it further to Pants (or whatever you do with this information).
It's possible that creating custom targets in the BUILD files, one for each class may actually be a better option (potentially easier to reason about), but you will need to extend the tailor goal to populate those custom targets (when running pants tailor ::
, new classes not yet represented as build targets should be created). You can also rely on the fact that you can easily modify the BUILD files target programmatically should you decide to update the dependencies in semi-automated manner (updating dependencies on some targets for each relevant module every time there's a change in the imports of the classes).
You can also only run https://www.pantsbuild.org/docs/reference-python-dump-source-analysis goal to get your imports and tell what modules import classes with Git modified lines - no need to write any plugin or custom targets. So you'd produce a list of changed files using your custom tool (could be a custom goal, but doesn't have to be!) and then you can just merge it with whatever Pants tells you has changed using the standard dependency inference you use in the codebase.fresh-cat-90827
12/13/2023, 12:33 PMsquare-psychiatrist-19087
12/13/2023, 1:18 PM