10 ms·
> I often find non-trivial CLI tools written in Python cumbersome because of the dependency wrangling necessary. I'm thinking of trying out Mojo in large part
by MikeTheGreat 2y ago
> I often find non-trivial CLI tools written in Python cumbersome because of the dependency wrangling necessary.
I'm thinking of trying out Mojo in large part because they say they're aiming for Python compatibility, and they produce single-file executables.
Previous to that I was using PyInstaller but it was always a little fragile (I had to run the build script a couple of times before it would successfully complete).
Currently I'm using pipx and Poetry, which seems pretty good (100% success rate on builds, and when my 5-line build script fails it's because of an actual error on my part).
Which is a round-about way of asking everyone:
Does anyone have any other good way(s) to build single-file executables with Python?
- mmebane 2y agoYou could try Nuitka [1], but I don't have enough experience with it to say if it's any less brittle than PyInstaller. [1]: https://nuitka.net/ https://nuitka.net/
- teleforce 2y agoFun fact, you can use D language as compiled scripting using rdmd with powerful and modern programming features although it has much faster compilation than comparable C++ and Rust [1]. The default GC make it intuitive and Pythonic for quick scripting more than Go. Its recent native support for OS lingua franca C is the icing on the cake [2]. From the website, "D's blazingly fast compilation allows it to be used as a high level, productive scripting language, but with the advantages of static type checking" [3]. [1]Why I use the D programming language for scripting (2021): https://news.ycombinator.com/item?id=36928485 https://news.ycombinator.com/item?id=36928485 [2]Adding ANSI C11 C compiler to D so it can import and compile C files directly: https://news.ycombinator.com/item?id=27102584 https://news.ycombinator.com/item?id=27102584 [3] https://dlang.org/areas-of-d-usage.html#academia https://dlang.org/areas-of-d-usage.html#academia
- qznc 2y agoScriptisto is an underrated tool: https://github.com/igor-petruk/scriptisto https://github.com/igor-petruk/scriptisto It can do the Python venv stuff behind the scenes for you and it just looks like a single Python file.