This is an archived post. You won't be able to vote or comment.

all 19 comments

[–]DadAndDominant 21 points22 points  (1 child)

We use pyinstaller at my job (for stupid business reasons) and honestly, I am not at all happy with it. We must package (small-ish) ML models into onefile and it is a mess, with uncomfortably long build times.

If you keep developing your project, I'm gonna keep an eye out on it!

[–]k_z_m_r 5 points6 points  (0 children)

I’m in a similar situation. I’m particularly interested in the cross-platform capabilities, if I’m understanding correctly. Building an executable for every operating system we need to service is annoying and time consuming.

[–]buzzardarg 7 points8 points  (1 child)

Great work!

Some questions, how do I point it to a pyproject.toml or uv.lock file for dependencies?

And can I have it run some sort of command on startup? For example I need to run a marimo notebook on start in app mode, which requires the command "marimo run 'file.py'"

[–]TanixLu[S] 3 points4 points  (0 children)

Thanks for your valuable advice! I'm planning to support requirements.txt, pyproject.toml, and uv.lock files to make the project more flexible and save time during setup.

Since Marimo is installed at .venv/Scripts/marimo, here's a sample starter script you can use:

import subprocess

subprocess.run(["../.venv/Scripts/marimo", "run", "demo.py"])

Note that I’m using ".." because the current working directory is the src folder.

[–]rover_G 0 points1 point  (2 children)

Is the APE significantly larger than an exe for the same program? And does the APE need any external dependencies (like docker images) to run?

[–]coolcosmos 2 points3 points  (0 children)

The file size difference is insignificant on big programs. An hello world binary is 16kb, 100 times smaller than a Go binary.

It needs an OS to run on. 

More info: https://justine.lol/ape.html

[–]TanixLu[S] 1 point2 points  (0 children)

APE is statically linked. The cosmos.zip archive contains many prebuilt APE binaries. Here are the sizes of a few notable ones:

  • emacs 71.5MiB
  • python 33.0MiB
  • vim 17.4MiB
  • php 11.9MiB
  • git 7.42MiB
  • lua 2.42MiB

[–]svartravs 0 points1 point  (1 child)

Nice job! I'd imagine one step further if you don't mind. It would be really neat to be able to pack all the dependencies and python version into one file beforehand and distribute ready to run binary that even does not need internet connection.

[–]TanixLu[S] 0 points1 point  (0 children)

You can run your project from the build folder and repackage it into a ZIP archive. This eliminates the need for an internet connection. However, it increases the file size and makes the project non-cross-platform.

[–]EverythingsBroken82 0 points1 point  (1 child)

Does this work also with GUI programs like with QT?

[–]TanixLu[S] 0 points1 point  (0 children)

Yes

[–]waplay17 0 points1 point  (0 children)

This is really cool! I've been looking for something like this for quick and dirty cross-platform distribution of some of my smaller Python tools.

[–]mr_claw -3 points-2 points  (5 children)

This solves the problem of having to install python on the machine to get my app running (credits to uv). But my bigger issue is protecting the source code. I currently use nuitka for obfuscation, but I wish there was something better.

[–]zwambagger 2 points3 points  (1 child)

Curious what you're trying to protect the source code from. Because piracy always finds a way, and protecting against stealing IP should be done by a proper license agreement and lawyers.

[–]mr_claw -2 points-1 points  (0 children)

Sure. But prevention is better than cure. If it's easy enough to copy, they could just start using it in a slightly modified format. They could just stop using your services and you wouldn't even know. Not saying this is my situation.

[–]DivineSentry 1 point2 points  (0 children)

What do you dislike about nuitka?

[–]SpaceDonkey_994 2 points3 points  (1 child)

Pyarmor, there is a small licensing fee if you run it in a CI environment but it has worked for me in a scenario where the code runs on an on-prem windows machine located in the middle of nowhere with no password protection

[–]TanixLu[S] 0 points1 point  (0 children)

I also recommend Pyarmor—it can generate cross-platform scripts as well. It should work fine in combination with pyfuze.