calm-ambulance-65371
05/05/2022, 3:45 PMpydantic[email]
), which I have in the requirements.txt
, but dep inference doesn't seem smart enough to pull it incalm-ambulance-65371
05/05/2022, 3:46 PM2.2
-> 2.11
upgrade, but it did take a near complete rewrite of all of our BUILD files, as well as completely overhauling how we handle 3rd party dependencies, mostly becuase we were doing it completely wrong from the beginningbitter-ability-32190
05/05/2022, 3:49 PMoverrides
and add the dependencies the extra would'vehundreds-father-404
05/05/2022, 3:50 PMcalm-ambulance-65371
05/05/2022, 3:55 PMhuh, why a rewrite?python_sources target for each file, dep inference turned off, poorly managed 3rd-party deps
calm-ambulance-65371
05/05/2022, 3:55 PMhundreds-father-404
05/05/2022, 3:56 PMoverrides
?calm-ambulance-65371
05/05/2022, 3:56 PMcalm-ambulance-65371
05/05/2022, 4:17 PMemail-validator
dependency to the python_sources
calm-ambulance-65371
05/05/2022, 4:19 PMhundreds-father-404
05/05/2022, 4:19 PMcalm-ambulance-65371
05/05/2022, 4:19 PMpydantic[email]
requirementhundreds-father-404
05/05/2022, 4:20 PMcalm-ambulance-65371
05/05/2022, 4:22 PMpython_tests(
interpreter_constraints=["CPython>=3.8"],
dependencies=[
':test_utils',
'3rd-party/<redacted>:requirements#pydantic',
'3rd-party/<redacted>:requirements#email-validator',
]
)
python_test_utils(
name="test_utils",
dependencies=[
'<redacted>/lib',
'3rd-party/<redacted>:requirements#pydantic',
'3rd-party/<redacted>:requirements#email-validator',
]
)
3rd-party/<resolve>/BUILD
python_requirements(
name='requirements',
module_mapping={
...
},
overrides={
'PyJWT': {'dependencies': [':requirements#cryptography']},
'pydantic': {'dependencies': [':requirements#email-validator']},
},
resolve='<resolve>'
)
calm-ambulance-65371
05/05/2022, 4:23 PM11:19:21.00 [ERROR] Completed: Run Pytest - <module>/tests/test_emailer.py failed (exit code 4).
ImportError while loading conftest '/tmp/process-execution9vX2Qn/<module>/tests/conftest.py'.
<module>/tests/conftest.py:12: in <module>
from <module>.lib.user import User
<module>/lib/user.py:13: in <module>
class User(BaseModel):
pydantic/main.py:204: in pydantic.main.ModelMetaclass.__new__
???
pydantic/fields.py:488: in pydantic.fields.ModelField.infer
???
pydantic/fields.py:419: in pydantic.fields.ModelField.__init__
???
pydantic/fields.py:539: in pydantic.fields.ModelField.prepare
???
pydantic/fields.py:801: in pydantic.fields.ModelField.populate_validators
???
pydantic/networks.py:422: in __get_validators__
???
pydantic/networks.py:411: in pydantic.networks.import_email_validator
???
E ImportError: email-validator is not installed, run `pip install pydantic[email]`
bitter-ability-32190
05/05/2022, 4:26 PMbitter-ability-32190
05/05/2022, 4:26 PM./pants dependencies path/to/conftest.py
?calm-ambulance-65371
05/05/2022, 4:26 PMsetup.py
to get it šcalm-ambulance-65371
05/05/2022, 4:27 PM3rd-party/<resolve>:requirements#email-validator
3rd-party/<resolve>:requirements#pydantic
3rd-party/<resolve>:requirements#requests
<module>/lib/__init__.py
<module>/lib/auth_services/__init__.py
<module>/lib/email/agents/__init__.py
<module>/lib/email/emailers/__init__.py
<module>/lib/email/renderers/__init__.py
<module>/lib/user.py
bitter-ability-32190
05/05/2022, 4:29 PMcalm-ambulance-65371
05/05/2022, 4:29 PMbitter-ability-32190
05/05/2022, 4:29 PMBUILD
. If you're feeling up to it, you can remove them and verify using ./pants dependencies
)calm-ambulance-65371
05/05/2022, 4:29 PMoverride
in python_requirements
wasn't workingcalm-ambulance-65371
05/05/2022, 4:30 PMpython_sources
targets for sanity checkscalm-ambulance-65371
05/05/2022, 4:30 PMcalm-ambulance-65371
05/05/2022, 4:30 PMcalm-ambulance-65371
05/05/2022, 4:36 PMbitter-ability-32190
05/05/2022, 4:41 PM./pants --no-process-cleanup test ...
and poke around the sandbox to ensure the dep is listed in the PEXcalm-ambulance-65371
05/05/2022, 4:44 PM/tmp/process-executionfL1ITo
ā© cat requirements.pex/PEX-INFO | jq
{
"bootstrap_hash": "af29c852ae20e6f7e7a8f830fa9efe17f5ab5503",
"build_properties": {
"pex_version": "2.1.84"
},
"code_hash": "9facd39bdd34791be8291d078a9bb7cc4b790088",
"distributions": {
"Jinja2-3.1.2-py3-none-any.whl": "ee8bc6748d864a510e8298d9de49c5e41b75faed18b5649089a1a09295a6c8ef",
"MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl": "c257f7495d4439d1d890eebd2b82e169a272dd2b67193
9b904d56886417910a5",
"certifi-2021.10.8-py2.py3-none-any.whl": "4c386567b236d2f41f64f294487210a0832da94a5e744aef4af035e84614c2c8",
"charset_normalizer-2.0.12-py3-none-any.whl": "02a5b56ad13945ae0116e3345ce35bc4966356a2f2d0bd99fa89cc227d5ac1e6",
"dnspython-2.2.1-py3-none-any.whl": "33d2bd8600fafd29eb81071ae12f2bea0fd3e9674f26fa3313146a85ce7081d1",
"email_validator-1.2.1-py2.py3-none-any.whl": "33b030891faf46cd3eabd426ac872e96f73a9721764bfbf470f4a607dbf95285",
"idna-3.3-py3-none-any.whl": "f6618af934a714454313a29b891c03fe8cde2be7bf19e20e3abc11d26ce689ac",
"pydantic-1.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl": "426840d1c16f525423dabddb077b10d569a7f367b8e240c
calm-ambulance-65371
05/05/2022, 4:44 PMbitter-ability-32190
05/05/2022, 4:45 PMsys.path
or something else nefarious?!calm-ambulance-65371
05/05/2022, 4:46 PMcalm-ambulance-65371
05/05/2022, 4:46 PMbitter-ability-32190
05/05/2022, 4:47 PMimport email_validator
working in conftest.py
or the test itselfhundreds-father-404
05/05/2022, 4:47 PMPEX_EXTRA_SYS_PATH
== Pex's version of PYTHONPATH
/ sys.path
. You can mess around w/ that in __run.sh
calm-ambulance-65371
05/05/2022, 4:54 PMrm -rf ~/.cache/pants
fixed it.......bitter-ability-32190
05/05/2022, 4:55 PMhundreds-father-404
05/05/2022, 4:55 PMcalm-ambulance-65371
05/05/2022, 4:55 PMhundreds-father-404
05/05/2022, 4:56 PMmv
rather than rm -rf
so that we can inspect. please let us know if you encounter something like this again
glad you're unblocked at least