square-psychiatrist-19087
09/10/2024, 8:17 PM__dependents_rules__
to forbid importing a deprecated module. Is there a way to add a comment to the rule, so that people can see why exactly the lint fails?broad-processor-92400
09/11/2024, 3:13 AMfresh-cat-90827
09/11/2024, 6:58 AMfresh-cat-90827
09/11/2024, 6:58 AM$ pants dependencies root/sources/project/mod.py
...
11:52:30.23 [ERROR] 1 Exception encountered:
Engine traceback:
in `dependencies` goal
UnownedDependencyError: Pants cannot infer owners for the following imports in the target root/sources/project/mod.py:
* foobar (line: 62)
If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see <https://www.pantsbuild.org/v2.19/docs/troubleshooting#import-errors-and-missing-dependencies> for common problems.
-----------------------------------------------------------------------------
To learn how to fix import ownership rules errors, visit:
<internal wiki address>
-----------------------------------------------------------------------------
fresh-cat-90827
09/11/2024, 6:58 AMfrom internal_plugins.epilogues.messages import construct_epilogue_body, UnownedDependencyErrorEpilogue
from pants.backend.python.dependency_inference import rules as dep_infer_rules
from pants.engine.rules import collect_rules
class UnownedDependencyError(Exception):
def __init__(self, message):
super(UnownedDependencyError, self).__init__(
message + "\n\n" + construct_epilogue_body(UnownedDependencyErrorEpilogue)
)
def rules():
dep_infer_rules.UnownedDependencyError = UnownedDependencyError
return collect_rules()
fresh-cat-90827
09/11/2024, 6:59 AMfresh-cat-90827
09/11/2024, 7:00 AMfrom internal_plugins.epilogues.messages import construct_epilogue_body, DependencyRuleActionDeniedErrorEpilogue
from pants.engine import target
from pants.engine.rules import collect_rules
class DependencyRuleActionDeniedError(Exception):
@classmethod
def create(cls, description_of_origin: str) -> "DependencyRuleActionDeniedError":
return cls(f"Dependency rule violation for {description_of_origin}")
def __init__(self, message):
super(DependencyRuleActionDeniedError, self).__init__(
message + "\n\n" + construct_epilogue_body(DependencyRuleActionDeniedErrorEpilogue)
)
def rules():
target.DependencyRuleActionDeniedError = DependencyRuleActionDeniedError
return collect_rules()
square-psychiatrist-19087
09/11/2024, 8:53 AM