https://pantsbuild.org/ logo
#general
Title
# general
a

aloof-angle-91616

07/24/2020, 9:20 PM
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

hundreds-father-404

07/24/2020, 9:23 PM
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

aloof-angle-91616

07/24/2020, 9:25 PM
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

hundreds-father-404

07/24/2020, 9:27 PM
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

aloof-angle-91616

07/24/2020, 9:27 PM
are we planning to modify that behavior later? i would like it to just error out in that case maybe
h

hundreds-father-404

07/24/2020, 9:29 PM
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

enough-analyst-54434

07/24/2020, 10:00 PM
Out of curiosity, is the case-insensitively bit working around APFS defaults of case insensitivity?
👍 2
a

aloof-angle-91616

07/24/2020, 10:01 PM
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

enough-analyst-54434

07/24/2020, 10:06 PM
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

aloof-angle-91616

07/24/2020, 10:06 PM
thank you i didn't remember which names came from where
will relay this
4 Views