modern-wolf-36228
09/07/2021, 1:58 PMa.pex
and the other is b.pex
. Those don't have any related project dependency between themselves (to be sure I've extracted and checked the files inside both of them).
The thing is that Pydantic checks if you have the same validation functions being used, to force you to not duplicate code. So I have this error:
pydantic.errors.ConfigError: duplicate validator function "a.config.Settings.mongo_connection"; if this is intended, set `allow_reuse=True`
I have a mongo_connection
validator on both a.pex
and b.pex
. Which I agree is duplicated, and I should add as a dependency for both of them, but I'm migrating from a polyrepo setup, so I'll probably have many of those.
Anyway, my question is: how a.pex
is able to see b
?hundreds-father-404
09/07/2021, 2:02 PMmodern-wolf-36228
09/07/2021, 2:19 PMpex
to verify I'm in a pex environment?
Similar to this for ipython?enough-analyst-54434
09/07/2021, 2:21 PMPEX_PATH=b.pex
exported as an environment variable or you built a.pex with --pex-path=b.pex
.enough-analyst-54434
09/07/2021, 2:21 PMmodern-wolf-36228
09/07/2021, 2:28 PMa.pex
and b.pex
for the sake of simplicity on my side.
In the image below:
⢠a = text_extraction
⢠b = classify
I'm running ./pants package ::
and the BUILD files of src/python/text_extraction
and src/python/classify
are respectively:
python_library(dependencies=["./tasks", "./utils"])
python_distribution(
name="wheel",
dependencies=[":text_extraction"],
provides=setup_py(
name="text_extraction",
version="0.0.0",
),
setup_py_commands=["bdist_wheel"]
)
pex_binary(
name="binary",
dependencies=[":text_extraction"],
entry_point="<none>",
)
and:
python_library()
python_distribution(
name="wheel",
dependencies=[":classify"],
provides=setup_py(
name="classify",
version="0.0.0",
),
setup_py_commands=["bdist_wheel"]
)
pex_binary(
name="binary",
entry_point="__main__.py",
)
I didn't remove the python_distribution()
, but I guess they are not important for this case.
Finally, I'm running text_extraction
with:
PEX_SCRIPT=celery ./dist/src.python.text_extraction/binary.pex -A <http://text_extraction.worker.app|text_extraction.worker.app> worker -l info -Q text_extraction
modern-wolf-36228
09/07/2021, 2:29 PMenough-analyst-54434
09/07/2021, 2:33 PMzipinfo a.pex
reveals no duplicate `a/config`paths / files / objects? I'm not sure if it's sensitive material, but can you provide the output of zipinfo a.pex
?modern-wolf-36228
09/07/2021, 2:37 PMmodern-wolf-36228
09/07/2021, 2:38 PMenough-analyst-54434
09/07/2021, 2:39 PMmodern-wolf-36228
09/07/2021, 2:39 PMpydantic.errors.ConfigError: duplicate validator function "text_extraction.config.Settings.mongo_connection"; if this is intended, set `allow_reuse=True`
modern-wolf-36228
09/07/2021, 2:40 PMmongo_connection
definition on classify.config.Settings
).enough-analyst-54434
09/07/2021, 2:42 PMmodern-wolf-36228
09/07/2021, 2:43 PMPEX_SCRIPT=celery ./dist/src.python.text_extraction/binary.pex -A <http://text_extraction.worker.app|text_extraction.worker.app> worker -l info -Q text_extraction
enough-analyst-54434
09/07/2021, 2:45 PMexecution_mode="venv"
to the relevant pex_binary
target and then re-running that command line?: https://www.pantsbuild.org/docs/reference-pex_binary#codeexecution_modecodemodern-wolf-36228
09/07/2021, 2:45 PMmodern-wolf-36228
09/07/2021, 2:50 PMmodern-wolf-36228
09/07/2021, 2:50 PMenough-analyst-54434
09/07/2021, 3:18 PMPEX_TOOLS=1 ./dist/src.python.text_extraction/binary.pex venv create/the/venv/right/here
You can then interact with that venv like any other.modern-wolf-36228
09/07/2021, 3:50 PM__IPYTHON__
question from above)modern-wolf-36228
09/07/2021, 3:51 PMenough-analyst-54434
09/07/2021, 4:44 PM