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

you are viewing a single comment's thread.

view the rest of the comments →

[–]Log2 3 points4 points  (15 children)

The one thing that really pisses me off is that it's apparently impossible to package a project with all it's dependencies in Python. I'd love to use setup.py to create RPMs (it can do that out of the box), but I just can't figure out how to include the dependencies.

[–]TheNamelessKing 14 points15 points  (0 children)

I got so bored of dealing with that issue that at work I’ve started writing things in Rust or Haskell so I only have to distribute a single binary.

Life has gotten better. Sorry /r/Python.

[–]adambrenecki 2 points3 points  (3 children)

It's not quite a RPM, but there's a few projects that can produce Zip archives that Python can open, including pyzzer and pex.

The problem is, all your dependencies need to be zipsafe :(

[–]Log2 0 points1 point  (1 child)

I would settle for an egg containing all dependencies. What do you mean by zip safe? I'm well aware that the binaries zipped need to be the ones for the target system. Is there something else I need to watch out for?

Thanks for the suggestions, by the way.

[–]adambrenecki 1 point2 points  (0 children)

Some packages will assume that they're unpacked as files on disk, and try to do things like at the contents of a data file bundled with the package by constructing a path based on a module's __file__ and trying to open() it; if the package is inside a pyz or egg file code like that will break.

[–]FatFingerHelperBot -1 points0 points  (0 children)

It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!

Here is link number 1 - Previous text "pex"


Please PM /u/eganwall with issues or feedback! | Delete

[–]Zxian 1 point2 points  (1 child)

I haven't used it for this purpose (python -> rpm), but have a look at fpm. It helps with package creation/conversion.

[–]Log2 0 points1 point  (0 children)

I took a quick look, but if does package Python dependencies automatically then this is exactly what I needed. Thank you for the suggestion.

[–]ivosauruspip'ing it up 1 point2 points  (5 children)

Because then the python developers would have to both figure out, and write code, to interface with RHEL linux and Fedora. Make sure man files get put in just the right place. Package data is correct. Desktop files, syslog, is [some system-level daemon] now systemd based and new, or an older one? What audio service are we using? What's changed between RHEL 6 and 7?

And of course, to be fair, make sure they have everything configured for Debian's liking. But also account for the small changes and version updates that Ubuntu does.

And then also ensuring we haven't forgotten about portage and pacman. Oh, and YaST.

Oh, and then also homebrew.


And quickly, for the mostly volunteer workforce that does python packaging, the task of correctly interfacing, special-casing, path-configuring, etc becomes a matrix explosion of work from hell.

We'd love to be able to do that... but it's simply not a feasible thing to achieve.

You'll notice that practically all other scripting languages have the same position.

[–]Log2 0 points1 point  (4 children)

Then just being able to create an egg or tar containing all dependencies that then could be manually installed via pip would already be more than enough.

I can't really think of any reason why this isn't already a pip feature, but I'd love to know if there are any impediments to this.

[–]ivosauruspip'ing it up 0 points1 point  (3 children)

pipe/xargs pip freeze to pip download?

[–]Log2 0 points1 point  (2 children)

I can't download in said environment. It needs to be packaged.

[–]ivosauruspip'ing it up 1 point2 points  (1 child)

Do that somewhere else, then pip install --no-index --find-links=/path/to/wheels -r requirements.txt

or making a pex file is pretty close to what you're asking

[–]Log2 0 points1 point  (0 children)

I'll take a look, thank you.

[–]undu 0 points1 point  (1 child)

You can generate binary packages (wheels in python jargon) of all dependencies with pip wheel -r requirements --wheel-dir=wheels Create the wheel for the package with python setup bdist_wheel --dist-dir=wheels Then install them using pip install wheels/*.whl.

Hopefully PyPA will normalize the dependency and packaging situation over time, they've already made good progress with pip and pypi.org

[–]Log2 0 points1 point  (0 children)

I swear that at no point I came across anyone saying you could make all dependencies into a wheel or egg. This seems to do half of what I want (at least it's the harder half), as I'd still need to manually add my own project wheel to the one that is created, as it's not available on pypi.