Python equivalent of uber-jar
Asked Answered
L

1

12

I'm looking for the equivalent of an uber-jar in the python world.

  • I need to distribute a python package to all three major platforms (Windows, Mac, Linux).
  • It must be bundled with all its dependencies, as the target platform may lack internet.
  • It must be a cross-platform distribution, so I don't have to build for multiple targets. That is, I should be able to run it on all platforms like this:

    python package.ext

You can assume that the package is pure python (no native code). Is there anything that satisfies these requirements?

I know of the following options, each with deficiencies:

Likely answered 22/6, 2016 at 20:6 Comment(2)
I think the short answer is "no". The slightly longer non-answer is "finding this for you is off-topic for SO".Rhodium
pex clearly does not support windows, and nothing seems to have happened on that front since 2016. github.com/pantsbuild/pex/issues/230Incestuous
A
3

One Python alternative to Java's "uber-jar" (made with, say, shade plugin) could be to simply make a tarball of the whole virtual environment, and use it to in your deployment process.

Problem with this approach (as with JAR as well!) is when one of the packages need native libraries. But that is a different story I would say...

Another (modern) alternative is to simply create a Docker image.

Andresandresen answered 21/10, 2016 at 12:39 Comment(2)
pypi.org/project/pyzzer can be used for this. Not as neat as pex, which pulls in dependencies, adds its own prelude which can unzip to a temp directory, etc. But it's a start, and unlike pex, pyzzer does support Windows.Incestuous
pyzzer has it's last release in 2013 - just FYIEarhart

© 2022 - 2024 — McMap. All rights reserved.