r/programming • • Apr 12 '23

Relieving your Python packaging pain

https://bitecode.substack.com/p/relieving-your-python-packaging-pain
3 Upvotes

6 comments sorted by

5

u/[deleted] Apr 12 '23 edited Apr 12 '23

Python packaging isn't particularly difficult once you have a bit of experience with it. But what makes it a bitch, is that the overhead of sorting out the environment never really goes away. If you want to run programs from 5-10 years ago, then you will have to spend some time resolving the environment, and when you do it a lot it starts to get boring. I guess it is because python has changed so much in that time, hopefully it will start to get more stable.

and i'm not really sure what the article has against conda!

2

u/M8Ir88outOf8 Apr 12 '23

I don’t agree with this article. I never had any "packaging pain" with poetry, in fact is super useful to reproduce the exact same environment in production using the lock file, and the cli is also very nice. If I would follow this advice, then packing would actually become a pain.

1

u/Skaarj Apr 12 '23

5. To create a virtual environment, use “venv” and only “venv”

“venv” is a command that comes with most Python installations, and it’s the command you should use to create a new virtual environment.

There are other commands such as “virtualenv” and > “virtualenvwrapper”.1

Don’t use them.

Is this a mixup? I tought virtualenv was the basic command? There is no venv command on my machines at all.

1

u/dolfinuser Apr 16 '23

venv is a built-in module since Python 3

1

u/instanced_banana Apr 14 '23

I'm a bit confused why you should avoid pipenv... I've used it without problems in my own proyects and in production without issues

1

u/rperanen Apr 14 '23

Good article. Rules in this context are not to be taken as absolute truth like physics or math.

That said, keeping dependencies minimum and dependencies even remotely sane means sacrificing some your own time and comfort to usability of your customers. Managing dependencies, deployments etc for any non-trivial number of users will be pain. If you stick to basics then pain may be bit more predictable.

On own projects you can go full panda with trashiness as long as you are only user.