icy-hair-3058605/11/2022, 8:10 AM
curved-television-656805/11/2022, 8:15 AM
, or installing your
in the container as a venv, and then build and install pyodbc into that, may work..
icy-hair-3058605/11/2022, 8:18 AM
curved-television-656805/11/2022, 8:20 AM
enough-analyst-5443405/11/2022, 2:18 PM
as part of its quest to provide isolated environments though; so you must either set
in your environment to tell your PEX it is OK to let the
leak in (See: https://pex.readthedocs.io/en/v2.1.85/api/vars.html#PEX_INHERIT_PATH) or else you can set
with the path element to add in directly (See: https://pex.readthedocs.io/en/v2.1.85/api/vars.html#PEX_EXTRA_SYS_PATH).
technique ot the installing the PEX in a container approach should work without modifying platform strings. Do not though that in the PEX in a container approach you need to change the 1st example
RUN PEX_TOOLS=1 /usr/local/bin/python3.10 /my-app.pex venv --scope=deps --compile /my-app
. Without adding that
RUN PEX_TOOLS=1 /usr/local/bin/python3.10 /my-app.pex venv --pip --scope=deps --compile /my-app
then created venv will not include
to use to install more dependencies with.
Is there a way to ignore the platform string only on the pyodbc dependency?No. A PEX is a fully enclosed environment so Pex demands it is able to include all dependencies requested. As such, you can't say, "except for FastAPI". Instead you must take the work you did to build FastAPI from source in the container and save the resulting Linux platform specific FastAPI wheel outside the container. You then make that wheel availale to your build using
https://www.pantsbuild.org/docs/reference-python-repos (whichever is easier for you to host internally, for most this is a
which can be a simple directory with wheels in it that is shared over NFS or sshfs or some other network filesystem or else a simple webserver with index.html generation enabled for the directory with wheels in it). Finally, your
PEXes will now be buildable via Pants and the will include FastAPI since you pre-built the Linux wheel and made it available outside of PyPI.
Its a bit of work to be sure, but does that make sense @icy-hair-30586?
icy-hair-3058605/11/2022, 3:23 PM