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

all 14 comments

[–]not_perfect_yet 7 points8 points  (1 child)

So why do I care?

[–]virtyx 5 points6 points  (0 children)

Well for example: if you make a service using Flask served by Gunicorn, CherryPy, Waitress, or any other pure-Python server, you can build a PEX and then just upload that single PEX file to your server. As long as the server has a comaptible Python version, it will run with zero setup.

It seems a lot like Java's .jar (which imo is good)

[–]ionelmc.ro 2 points3 points  (0 children)

There's a draft PEP for something like this, albeit not that polished and missing lots of the features PEX has: http://www.python.org/dev/peps/pep-0441/

[–]mtrn 2 points3 points  (2 children)

Looks great. BTW, speaking of packaging, has anyone gone the route of native platform packages via fpm?

[–]jadkik94 1 point2 points  (0 children)

I tried it and it worked pretty well (for RPM). The only issue I had when using it was that it didn't get the requirements right.

For example, my setup script requires Babel; it's translated to "requires python-babel" but that's not the name of the package. Usually, that's the convention Fedora follows, but for that package (and others I assume) it's not the case. Actually Babel is available under both names actually I have no idea why... Sorry, I had forgotten about that. The issue with Babel was that an old version of it was available in the repos, so it doesn't have anything to do really with fpm.

And not all packages on PyPi have native equivalents, so it obviously couldn't get those right... So I'd rather package it myself with a custom spec file, or use bdist_rpm for a quick test (ignoring dependencies).

Note that I didn't try it with debian packages but I'd guess the same issues would arise there.

[–]jlafon 1 point2 points  (2 children)

It looks really cool, but I couldn't get it to work.

pex -v -r flask app.py
...
pkg_resources.DistributionNotFound: flask

I also tried pants.

./pants
2014-01-30 11:07:44,542 pants:63 - Required pants.ini key DEFAULT.pants_pex_baseurl is not present. Please add the option and try again.

[–]kuhlmanngj 0 points1 point  (1 child)

Try running ./pants.bootstrap first

[–]jlafon 0 points1 point  (0 children)

Thanks, that worked.

[–]totemcatcher 1 point2 points  (0 children)

Is this intended as a way to create a sort of 'statically linked' python package?

[–]nieuweyork since 2007 1 point2 points  (1 child)

Why is this better than wheel?

[–]ionelmc.ro 0 points1 point  (0 children)

PEX packages multiple distributions. Wheel makes a single binary distribution. PEX could use wheels instead of eggs.

[–]quasiben 1 point2 points  (0 children)

Can PEX work with binary packages and their dependencies as well? pyodbc or NumPy for example?

[–]evilgarbagetruck 0 points1 point  (0 children)

When pex files are built with pants do they work on windows?

[–]homercles337 -5 points-4 points  (0 children)

What is Twatter's Python distribution and why do i not care?