Hello! Does anyone have any examples of combining ...
# general
g
Hello! Does anyone have any examples of combining Poetry + PyOxidizer + Docker ?
b
Hey @wide-midnight-78598 have you seen any?
w
To what end? @gorgeous-eve-12553 What's the goal re: Poetry + Pyox, and then re: PyOx + Docker?
g
I guess it really makes sense to break it up that way. My dev team prefers poetry as the optimal way to manage dependencies, but that really has nothing to do with my end goal. The end goal here is I want to build docker images that are significantly less than the 300MB+ images I normally run into when you factor in the python runtime, standard library, all the extra add-ons and compile time parts. I found that with nuitka I could compile my webapp into a statically linked binary (MUSL) and drop that into a extremely lightweight image and get closer to around 50MB in total. I’m hoping to have something similar if PyOx can get that small. And if it can, hopefully pants can help make that pipeline cleaner and easier to use.
w
I don't think PyOx is the right approach in this case if I understand what's happening - because PyOx bundles Python, so you're immediately taking a hit there, like 50MB probably (smaller than the 300MB from Docker, which seems abnormally high actually - I thought Python on slim-bullseye was only like 50MB?). If the goal is to REPLACE Docker, then yeah, definitely pyox that. But if you'll still have Docker in the mix, then a slim Python image + pex feels natural, and it's already Pantsable
I want to love nuitka so much, but every single time I try to use it for even trivial stuff, I get bogged down in configuration. I'm working on a nuitka pants plugin as well, but like, even the single-file hello world is more work than either cython or pyox
h
Yeah, either way you get a python interpreter, either embedded in your binary or in your docker image, no way around that
g
I have literally never configured nuitka. It is always create a virtual environment where nuitka is a development dependency, create my project like normal, then run nuitka against the entrypoint of my application. The most I do is specify a few command line parameters to do the standalone build and such.
And yes, the 300MB is absurdly large, a MVP web app with DB support is usually closer to 150MB at max with python:3-slim . But this app in question uses FFI to several other programming languages including java! So now I need a full JVM…
w
Ah, okay, I don't think PyOx will help that much - and brings in its own risks and complications. The python interpreter burden will be placed somewhere regardless 🤷‍♂️