https://pantsbuild.org/ logo
#general
Title
# general
b

bitter-orange-16997

11/02/2022, 1:36 PM
hey folks, anyone had success pre-compiling Python code to .pyc and removing .py on Python targets ?
h

hundreds-father-404

11/02/2022, 1:39 PM
Hello! No, this has not been an area of exploration yet
b

bitter-orange-16997

11/02/2022, 1:42 PM
ok, thanks Eric. we'll figure it out
r

rhythmic-battery-45198

11/02/2022, 1:49 PM
We are indeed doing this when building docker images.
b

bitter-orange-16997

11/02/2022, 1:49 PM
yes exactly, but it's not without its challenges (or rather weirdness) if you map source volumes onto it
this is what we do as well but I was fishing for something not involving Docker
it's fine though 🙂
r

rhythmic-battery-45198

11/02/2022, 1:53 PM
Ah ok !
w

wide-midnight-78598

11/02/2022, 2:08 PM
I don't think I've tried it, but perhaps look into the
pyoxidizer
subsystem? I think it supports some level of bytecode optimization, so maybe that could be helpful? However, I guess that also assumed you want to pyox the whole target, so 🤷 https://github.com/indygreg/PyOxidizer/issues/269
I'd also be surprised if this can't be done via Pex(es) via some awesome mechanism: https://github.com/pantsbuild/pex/issues/1939
3 Views