Thoughts on `[python].unowned_dependency_behavior`...
# development
b
Thoughts on
[python].unowned_dependency_behavior
and
[python-infer].string_imports
šŸ§µ
I didn't realize this when making the feature originally (it was my first real feature, dont @-me šŸ˜‰ ) but I think we want to omit string imports from the error behavior. Otherwise,
string_imports
would be too noisy, as devs would need to
# pants: ignore
a bunch of lines šŸ¤®
So
unowned_dependency_behavior
would only apply to things we're sure are imports: ā€¢ Import statement ā€¢
__import__
calls with constant string first arg ā€¢ (When support is added)
importlib.import_module
with a constant string arg
So the return of running
import_parser
separates the "confident" from the "maybe"
h
Yeah, I think we do not want to ever be "strict" about string imports, since they have so many "false positives"
So I agree
šŸ™Œ 2
b
Added to my personal backlog šŸ˜‰
Not string-related, but should Pants try and detect
try: import X except ImportError: # do whatever
as a "maybe" import?
I think so (but that could be a follow-up PR to the above)
h
Probably, but agreed that's a good follow up. I think it would make our AST parsing much more complex
b
Maybe... but also, with all I'm adding to it, it's already growing. I like to think it's more "powerful" not "complex" šŸ˜¤