I am back again trying to write a plugin that woul...
# plugins
f
I am back again trying to write a plugin that would extend the dependencies which Pants infers to include files that do not exist on disk 🧵
I have a rule that gets executed, this is the PR, this is where the inference happens in the Pants codebase.
Copy code
@rule
async def infer_special_dependencies(request: InferSpecialDependenciesRequest) -> InferredDependencies:
    logger.warning(request)
    owners = await Get(Owners, OwnersRequest(("helloworld/translator/foobar.py",)))
    logger.warning(owners)
    return InferredDependencies(include=owners)
I have a POC working in Pants when I extend the
python-infer
subsystem adding a new option
"ignored_paths"
to not raise issues for those modules, but was wondering if it could be achieved with a plugin code instead. I have also found quite a few other ways to address this problem (letting Pants inferring a dependency with the help of another target), but again it would be neat to be able to hook into the inference process. Has anyone done anything vaguely similar?