4 ms·
> The thing that kills python for me is that I can’t be 100% sure if what version may exist on a system; pip handles that automatically - you set which version
by TomSwirly 5y ago
> The thing that kills python for me is that I can’t be 100% sure if what version may exist on a system;
pip handles that automatically - you set which version numbers of Python you can handle in your project specification.
> and worse: if I actually use any modules then I have to somehow get them on the system.
pip handles that too!
----
I'm not quite sure what the problems are, but between virtualenv/venv, pip, and modern package managers like poetry, this is really a solved problem - something you spend an hour setting up when you start a project and just never think of again.
I do this so much I have a shell function, `nenv`, which creates a new virtualenv with a specific Python and then loads its dependencies into the virtualenv.
It gives me tremendous freedom. For example, I can heavily instrument other modules' Python code inside the virtualenv (to find their bugs, e.g.) and then throw it all away and recreate it fresh in a few keystrokes.
---
There are OK, well-known solutions to most of the common packaging and distribution problems with Python programs you might have. If you go back to it, you should spend a bit of time with this, it isn't that bad.
(Poetry seems really cool - when I start something new it'll be with that.)
- dijit 5y agoit's weirly naive to assume I don't know about pip as a python user as it's a bit ubiquitous. That said: This is very much a developers take on the packaging situation in python. Running virtualenvs is "fine" until you're not connected to the internet, a less-and-less common scenario thankfully. pip itself (without virtualenvs) will "dirty" the system, or you use the --user flag and make it work only for one user. The situation for systems administrators is to do things that do not mess with the developers, if I install a package, especially with a version lock, and it directly conflicts with a developers (less and less of a problem with containers!) then they're going to be very cross with me.
- keymasta 5y agoThis may be a silly question, but how would you think to install packages if not with pip? I used to see python the same way, and coding on my megalithic single file would always take a couple hours to set up on a fresh computer. Then I discovered requirements.txt, where you simply list each package you need and the version (range) desired and then run: pip install -r requirements.txt this will install everything unless it's fucky like for example, pip install kivy-garden.matplotlib will not work with pip but everything else does.
- Annatar 5y ago"This may be a silly question, but how would you think to install packages if not with pip?" Through the native software management subsystem: RPM, SVR4 packaging, pkgsrc, MSI... always use the native software management subsystem - that is what it is there for, for developers to deliver their software with.
- Annatar 5y ago"Running virtualenvs is "fine" until you're not connected to the internet, a less-and-less common scenario thankfully." Any high security environment (read: the financial industry) will have most of the servers purposely not connected to the InterNet, to prevent people from doing exactly the above and from attackers hacking in. Energy and pharmaceutical industries - same thing. That's the norm, not the exception, so pretty much any industry which is critical for society at large won't allow access to the InterNet.
- Annatar 5y ago"pip handles that too!" One is not supposed to have more than one software management subsystem on a server because it leads to a hodge-podge mess: imagine you have 100'000 servers and it's RPM this, then pip that, then pear other, then npm whatever, then cargo something else... it would become a system administration nightmare in 0.1, and a system engineering nightmare in 0.01 seconds... you have to troubleshoot production, and do, what? Start firing different private packaging format commands in the hopes you find the correct one to find out what's been done to the system, what's available, then pray that particular private packaging system supports some sort of verification feature in order to find out who hacked which file with what tool? And that's okay by you? It certainly isn't okay by me and would have never worked in an environment that large (it doesn't even work in very small environments!) ...One is always supposed to use the native software management system of the operating system: cattle, not pets. And if there isn't a native OS package of the software one needs, or there isn't one of sufficient quality and standards compliance (like LSB FHS), then one makes one's own packages, because that is the high quality, professional way of doing things.
- jen20 4y ago> something you spend an hour setting up when you start a project Most projects suitable for Python should take less than an hour end-to-end, not just for setting up package management.