proud-dentist-22844
05/13/2021, 8:13 AMpkg_resources
which is in setuptools
a dep, flex
does not declare a dep on setuptools
(they think its std lib): https://github.com/pipermerriam/flex/blob/master/flex/__init__.py#L6
What are my options for getting pants to include setuptools in this case?✘ ~/p/st2sandbox/st2.git pants ● ./pants test st2common/tests/unit/test_logging_middleware.py 1
03:18:02.08 [WARN] Completed: test - st2common/tests/unit/test_logging_middleware.py:tests failed (exit code 2).
============================= test session starts ==============================
platform linux -- Python 3.6.13, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /tmp/process-execution6KNsrk
plugins: cov-2.11.1, icdiff-0.5, benchmark-3.4.1
collected 0 items / 1 error
==================================== ERRORS ====================================
_______ ERROR collecting st2common/tests/unit/test_logging_middleware.py _______
ImportError while importing test module '/tmp/process-execution6KNsrk/st2common/tests/unit/test_logging_middleware.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.6/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
st2common/tests/unit/test_logging_middleware.py:21: in <module>
from st2common.middleware.logging import LoggingMiddleware
st2common/st2common/middleware/logging.py:30: in <module>
from st2common.router import Request, NotFoundException
st2common/st2common/router.py:25: in <module>
from flex.core import validate
/home/cognifloyd/.cache/pants/named_caches/pex_root/venvs/short/b40361f1/lib64/python3.6/site-packages/flex/__init__.py:6: in <module>
import pkg_resources
E ModuleNotFoundError: No module named 'pkg_resources'
=========================== short test summary info ============================
ERROR st2common/tests/unit/test_logging_middleware.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.32s ===============================
𐄂 st2common/tests/unit/test_logging_middleware.py:tests failed.
python_library(dependencies = ...)
even though it is a transitive dep?hundreds-father-404
05/13/2021, 12:49 PMrather than putting it in requirements.txtIt's necessary to remove from requirements.txt so that you don't have two targets referring to the same requirement, which would disable dependency inference for flex because it would be ambiguous which you want to use The generate_constraints.sh script will still do the right thing
proud-dentist-22844
05/13/2021, 2:14 PMhundreds-father-404
05/13/2021, 2:21 PM