got a great suggestion from kelsey blair who works...
# general
a
got a great suggestion from kelsey blair who works on python at twitter to: - if a dependency spec in a BUILD file or on the command line matches case-insensitively (and/or by levenshtein/edit distance?), - raise an error that points to the correct file or target spec @hundreds-father-404 and anyone else: do you have thoughts on this proposed feature? we're not planning to try to backport this, it would just be a new pants feature.
h
Generally, though, we’re encouraging people to lean in on dep inference, meaning that it’s rare you will write a
dependencies
field
👍 1
a
hm yes. the extension of this (which would be easier to write) would be some sort of lint to potentially warn on incorrectly capitalized imports in python source files. not sure if mypy does this already
that's probably less of a concern than in general giving a good error message on a missing import when using dep inference
ok, thanks!
dep inference definitely changes a ton which is great
❤️ 1
and it's great that this sort of thing becomes literally just not a problem by simplifying the build to make writing code finally as easy as it should be
❤️ 1
h
that’s probably less of a concern than in general giving a good error message on a missing import when using dep inference
dep inference no-ops when we can’t infer a dep or when there are >1 owner for that import
a
are we planning to modify that behavior later? i would like it to just error out in that case maybe
h
Not planning on it. Part of the thinking is that you will already get an error from
ModuleNotFoundError
and can then add an explicit dep Generally, dep inference is written to be as conservative as possible. We’d rather have false negatives than false positives
That’s a similar philosophy to most inference systems like MyPy. Only infer when it is safe to infer
e
Out of curiosity, is the case-insensitively bit working around APFS defaults of case insensitivity?
👍 2
a
all of that aligns with my goals, except we error at build time instead of maybe erroring at runtime, if the failing module is actually loaded
that was my expectation, but no. the
python_requirements()
macro's relationship to generating targets isn't 100% clear to some people\
i believe the thought process was "why is the target named
PyYAML
when the import is named `pyyaml`"
which was why i thought dep inference would directly solve it
e
Aha. The feature might be good but also that's a Python thing too. You could also edit the requirement.txt to use all lowercase and that would work since these project names are normalized per spec.
👍 1
a
thank you i didn't remember which names came from where
will relay this