3 ms·
APE is cool, but other than it being a bar trick I fail to see much usage out of it. Especially in case of an interpreter - like, just have the native version i
by kaba0 4y ago
APE is cool, but other than it being a bar trick I fail to see much usage out of it. Especially in case of an interpreter - like, just have the native version installed on the target OS.
- baq 4y ago> just have the native version installed on the target OS this is literally the problem
- wokwokwok 4y agoHow is it the solution? End user applications, sure… but the raw python interpreter? If you want it, you have to install it. If you want to install it, you go to python.org and install it. This solves… a headache for the maintainers, having to build multiple packages? Not having it installed is definitely not solved by this. Bundling python packages into a single binary is definitely not solved by this.
- baq 4y agoit isn't the solution, but it is a solution. it might be the solution for a particular subset of tools, which is still great, because it usually was a PITA even for those constrained use cases.
- ElectricalUnion 4y ago> End user applications, sure… but the raw python interpreter? If you want it, you have to install it. If you want to install it, you go to python.org and install it. If you want just the raw python interpreter, you're not the end user? > Not having it installed is definitely not solved by this. But not having to install it is the point? > Bundling python packages into a single binary is definitely not solved by this. It is? There's even a working example in the article? mkdir -p Lib/site-packages # specify python version to pip if necessary /usr/bin/python2 -m pip download flask -t . # start "build" cp ./python.com ./my-release.com printf '%s\n' '-m' >./.args printf '%s\n' 'my_module_name' >>./.args # wheels are just ZIPs, use unzip if pip complains ./python.com -m pip install flask*.whl -t ./Lib/site-packages ./zip.com -qr ./my-release.com ./Lib/site-packages/ ./zip.com ./my-release.com ./.args # optional cleanup rm -rf ./*.whl ./Lib/site-packages/ ./my-release.com
- wokwokwok 4y agoYou don't understand how the packaging of python applications works if you think the efforts of PyInstaller, py2exe, Nuitka, etc. can be this trivially overcome. This makes what is already a pain in the ass (packing a python app into a single native distribution) harder to do, for the 'cute' ability to have a single cross platform binary. ...and it is cute. Sure, I get it. ...but yeah, you just zip up all the python dependencies and it's fine? So good. Compile all the native parts or whatever, I'm sure it's easy. Look, I tell you what, you go and prove that all the smart people who've been trying to solve this for the last 10 years that there's a new good way of doing it, and they (and I) will all be very happy. Until then, this is a proof of concept for a trivial use case that makes packaging a trivial pure python application somewhat harder to do than it was already. > It is? It is not. Bundling python applications into a native binary is already a badly-solved problem with a bunch of irritating problems and caveats; this doesn't add anything meaningful to those existing efforts or fix any of the issues they have. Seriously; go and look at the efforts those projects go to, to make what they do, work.
- hunterb123 4y agoWhy is it just a bar trick in your mind? Do you not consider the end-user not having to install anything useful? The entire point of APE is the portability, hence the name.
- kaba0 4y agoThe OS-specific interpreter can be bundled with the application itself, and then no need to install anything (though ideally a package manager would do its job and resolve dependencies beforehand, making it moot. This windows-style random exe hunting and downloading should just die already. And it doesn’t have to be “installed”, nix solves this problem by nix-shell -p package “installing” the package temporarily, making it available in the shell only.)
- hunterb123 4y agoThen you either need a package manager (Windows users without Scoop or Chocolately are out, destroying portability) or you need to provide multiple binaries that the user chooses for different platforms with the interpreter bundled as you said. But the availability of other options with tradeoffs doesn't answer my question as to why this method is just a bar trick. A Go binary or similar is an option, but it doesn't make other options mute.
- ElectricalUnion 4y ago> The OS-specific interpreter can be bundled with the application itself Why does the interpreter need to be OS-specific at runtime? If you're "bundled with the application itself", and your application is OS-specific anyways, then you should of course bundle a optimized OS-specific interpreter. But, for an actually portable application, that runs on several OSes, you probably want an actually portable interpreter? > And it doesn’t have to be “installed”, nix solves this problem by nix-shell -p package “installing” the package temporarily, making it available in the shell only.) `nix-shell -p package` is a very bad example of your point. * It represents a "not bundled"/"not embedded" use case; * You "just" need to install Nix, then; * You "just" need to invoke Nix using the correct derivation, then; * Nix "just" need to temporary install the native interpreter and all other dependencies specified in the derivation, then; * Nix "just" need to temporary install your packages and all other dependencies specified in the derivation in a temporary location. all in order to not need to have it to not be installed. Even as someone that likes Nix, this doesn't make a lot of sense for the sake of argument.
- ActorNightly 4y agoThere are definitely real uses for this is this got traction and wide adoption and developed into a robust product - for example, games would just work on Linux or windows without the need for specialized drivers for either, since Nvidia would just write the drivers and compile them with this which would make them effectively multi OS, followed by all game engines targeting these drivers, and so on. However to wish for that to happen on the same level as wishing that Linux was the dominant OS for personal computers, which would render APE mostly moot except for a few specialized cases.
- flohofwoe 4y agoAFAIK the idea behind 'actually portable executables' only works for POSIX-style command line programs. As soon as system-level DLLs (like OpenGL/X11/XGL or D3D11/DXGI) need to be accessed the problem becomes a lot more complicated (solving this problem would be massive though).
- kaba0 4y agoHow do you imagine the drivers would just run on any OS, talking to the kernel in a very very kernel-specific way? This is just a hack in the respective executable file format headers (a genius hack nonetheless from Justine), but it only works for very very basic things. Anything higher level is highly OS-specific.
- hunterb123 4y agoYou can do quite a lot with redbean, I wouldn't call it very very basic. But agreed graphical use cases are limited.
- ActorNightly 4y ago>This is just a hack in the respective executable file format headers (a genius hack nonetheless from Justine) Its a lot more then that. Look at the code. https://github.com/jart/cosmopolitan https://github.com/jart/cosmopolitan You compile an executable with flags --nostdlib and --nostdinc because it includes cross platform standard libraries mapped to the OS specific magic numbers for system calls. Think about a desktop computer with a graphics card. You can install either windows or linux on it. In both cases stuff gets rendered to the screen using the graphics cards. That is done through the driver, which maps higher level commands in libraries to instructions that graphics cards understands. While library format, is OS specific, the driver is essentially doing either ioctls or memory mapped io, both of which are the same x64 instructions. So compiling everything with APE, means that library entry points are platform agnostic, and everything up the chain all the way to the game engine. And, yes cosmopolitan only works on very basic things, as would be expected by the small number of people developing it, thats why I said IF it was adopted widely and developed further it would be possible.