r/Python • • Apr 30 '18

xkcd: Python Environment

Post image
2.4k Upvotes

388 comments sorted by

View all comments

117

u/Tweak_Imp Apr 30 '18

I really dont understand why python and its dependencies can be such a big mess. Why isnt there just one python installer that installs the current version of python, sets every setting you need by himself like the PATH and then has a manager for all packages. Just search and load from the manager and if you dont want a package any more, delete it and remove all dependencies that are not needed by others. Is that really so hard to do?

51

u/ursvp Apr 30 '18 edited Apr 30 '18
  • egg vs wheel

  • universal vs pure wheel

  • setuptools vs distutils

  • install_requires vs requirements.txt

  • data_files vs MANIFEST.in

  • package vs distribution vs binaries

  • pip vs conda

  • install -e vs install

  • install from PyPI vs .git vs .tar.gz

  • build vs environment

  • virtualenv vs venv vs pipenv

  • for each above: python2 vs python3

  • 2to3 vs six

  • absolute vs relative vs circular import

  • oh, pip is incapable of true dependency resolution

  • complexity behind __version__

... in contradiction of Pythonic principle of clarity and simplicity.

17

u/mfitzp mfitzp.com Apr 30 '18

It's because Python developers are forced to write clean code all the time. The filth has to come out somewhere

4

u/Log2 Apr 30 '18

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.

14

u/TheNamelessKing Apr 30 '18

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.

3

u/adambrenecki May 01 '18

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 :(

→ More replies (3)

2

u/Zxian May 01 '18

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

1

u/Log2 May 01 '18

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

2

u/ivosaurus pip'ing it up May 01 '18

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.

1

u/Log2 May 01 '18

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.

1

u/ivosaurus pip'ing it up May 01 '18

pipe/xargs pip freeze to pip download?

1

u/Log2 May 01 '18

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

→ More replies (2)
→ More replies (2)