https://pantsbuild.org/ logo
#development
Title
# development
b

bitter-ability-32190

01/14/2022, 2:45 PM
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

happy-kitchen-89482

01/14/2022, 3:27 PM
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

bitter-ability-32190

01/14/2022, 3:28 PM
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

hundreds-father-404

01/14/2022, 5:03 PM
Probably, but agreed that's a good follow up. I think it would make our AST parsing much more complex
b

bitter-ability-32190

01/14/2022, 5:05 PM
Maybe... but also, with all I'm adding to it, it's already growing. I like to think it's more "powerful" not "complex" šŸ˜¤