python infer: I have situation (still debugging) ...
# general
f
python infer: I have situation (still debugging) where pyqt5 is used in tests, and there are two PyQT5 libraries (PyQt5 and PyQt5-Qt5) that provide the relevant modules. Leaving Pants to auto-infer
from PyQt5 ...
did not choose the required one,
PyQt5-Qt5
so i added a module Mapping
Copy code
python_requirements(
    module_mapping={
         "PyQt5-Qt5": ["PyQt5"],
    },
but of course, I need the "other"
PyQt5
library also to be included in the test. Any suggestions to how I resolve this .. I am holding off adding static dependencies for each BUILD file, as there aremore than a handful. is there another technique other than statically adding the two (non-inferred) dependencies ?
I was able to resolve this explicit
dependencies
on the python_source using the pyQt5 .. I also shrank the BUILD file count by "depth" includes
***/**.py
etc
c
I’d consider using either the
requirements
field or
dependencies
in
overrides
on the
python_requirements
target so you get the second library when Pants infer a dep on the first library (not sure which is which here as I don’t know them). Example:
Copy code
python_requirements(
  overrides={"PyQt5": {"requirements":["PyQt5", "PyQt5-Qt5"]}},
)
Keeping this information as close to the requirements target as possible as if you add it on the python_sources target, it becomes more difficult to maintain (easy to miss when looking at the requirements, or when adding another python_sources that would need it as well etc)