News for hackers. Stuff that matters.
Re:Guido van Rossum joins Microsoft by vlovich123 on Thursday November 12, 2020 @12:39PM (#25072314)
It's a package manager in the vein of "old-school" package managers that came from Linux distros and whatnot. It maintains a global dependency chain across your entire machine. This can be good for security fixes in that you only have 1 copy of a package & everyone references it. This is not good for development because it doesn't provide a sandbox'ed environment for you to do development in (ala cargo as others have mentioned). It also causes issue if you try to install 2 packages but they rely on incompatible versions of a popular package meaning you have to choose which package you want installed.

Some of this has been mitigated with virtualenv but having a project express it's packages & have that automatically reflected in the environment.

Finally, Cargo to my knowledge actually lets multiple dependencies exist (even within the same project!!!) so that you can have a dependency like:

                        dep1 -- dep3 <= v1.6
                      /     
< my awesome project> -------- dep3 >= 3.0 \ dep2 -- dep3 >= 2.0

That's not possible if you don't have the right language hooks because module resolution needs to be aware of the version of the library (i.e. when you go `import numpy`, it actually needs to be aware of the package it's being imported from to resolve that correctly).

Now whether or not it's a good idea to support this kind of dependency stuff can be controversial. In practice though clearly it does cause problems the larger your codebase gets as you're more likely to have some nested dependency chain that's time-consuming to upgrade so you'd rather move faster than make sure you're only running 1 version of the dependency.

Re:Guido van Rossum joins Microsoft by cactus2093 on Thursday November 12, 2020 @01:15PM (#25072814)
For some reason I've run into this type of dependency chain issue many times in JS, but have never run into it in Python despite using both languages pretty heavily. Maybe because the JS ethos is to change things so quickly, if you're not making a major breaking change to your package's API every year or two then you're getting left behind (only kind of joking). Also probably because the standard library is so small in JS (or at least it used to be, and may projects want to be compatible with at least some older browsers) so the average number of dependencies that a typical library has is probably much higher than in Python.

I really don't get the fuss about the global dependency management though, maybe I would change my mind if Python shipedp a great implementation of it. But I feel like the problem is already solvable in multiple ways with containers, VMs, or virtualenvs and I don't think yet another abstraction to separate environments would add much value to my day to day workflow building python apps.

Re:Guido van Rossum joins Microsoft by divbzero on Thursday November 12, 2020 @01:47PM (#25073277)
This is my experience too. I’ve never actually encountered a global dependency conflict with Python pip though in theory it’s possible. But I have encountered the same version conflict problem in dependency chains that exists with Node npm.

And yet, I hear so many more complaints about Python pip and I really don’t understand the disconnect. Perhaps dislike of pip is actually triggered by usability issues? And then people look for other reasons to explain their dislike?

Re:Guido van Rossum joins Microsoft by disgruntledphd2 on Thursday November 12, 2020 @02:46PM (#25074023)
It happens with the data science/scientific programming stack a lot, at least twice in the last month I've pulled in a small dependency that changed my numpy version which broke everything.
Re:Guido van Rossum joins Microsoft by divbzero on Thursday November 12, 2020 @03:15PM (#25074332)
Thanks. I suppose it could be related to the rate of change in the ecosystem. Python’s data science / scientific programming stack definitely changes faster than Python’s web stack which is currently my primary use case.

As mentioned elsewhere in this thread, resolving this dependency issue would require a change in the Python language itself.

Re:Guido van Rossum joins Microsoft by JAlexoid on Friday November 13, 2020 @02:03AM (#25079768)
Maybe you just don't rely on packages that have different update cycles.

If you're only working with the standard library, boto3, twisted and redis - you're unlikely to have issues. You get into big issues, when you get to more obscure libraries... or libraries that are C bindings.

Re:Guido van Rossum joins Microsoft by d0mine on Thursday November 12, 2020 @02:34PM (#25073893)
> It maintains a global dependency chain across your entire machine.

There are per python binary, per user, per virtualenv installation (per project or per whatever you like) that make the conflict less likely.

Sometime packages "vendor" their dependencies e.g., there is `pip._vendor.requests` (thus you may have different `requests` versions in the same environment).

There were setuptools' multi-version installs https://packaging.python.org/guides/multi-version-installs/ (I don't remember using it explicitly ever -- no need)

Re:Guido van Rossum joins Microsoft by dralley on Sunday November 15, 2020 @11:33PM (#25108045)
> Finally, Cargo to my knowledge actually lets multiple dependencies exist (even within the same project!!!)

That's not pip's fault, that's Python's fault. Python's module system has no concept of versioning, so there can only ever be one copy of a module that has a given name.

And this is an interpreter detail that is exposed through the language itself, so it can't be fixed without causing severe pain.

Re:Guido van Rossum joins Microsoft by eeZah7Ux on Thursday November 12, 2020 @05:10PM (#25075823)
> Finally, Cargo to my knowledge actually lets multiple dependencies exist

That's a bug, not a feature. It enables sloppy development and the disasters like on NPM

Re:Guido van Rossum joins Microsoft by vlovich123 on Thursday November 12, 2020 @07:22PM (#25077201)
As I said above:

> Now whether or not it's a good idea to support this kind of dependency stuff can be controversial. In practice though clearly it does cause problems the larger your codebase gets as you're more likely to have some nested dependency chain that's time-consuming to upgrade so you'd rather move faster than make sure you're only running 1 version of the dependency.

Consider the view that some times it can be sloppy & other times it's not & it's impossible to distinguish between the two in an automated fashion.

Re:Guido van Rossum joins Microsoft by wtetzner on Thursday November 12, 2020 @07:00PM (#25077029)
How so? The version ends up being part of the type, so a type from two different versions of a given package are not compatible, which solves most if not all of the issues.

If a package is just using a particular library internally, I don’t see why the package manager should prevent using it with another library that depends on a different version.

Re:Guido van Rossum joins Microsoft by throwaway129013 on Friday November 13, 2020 @10:47AM (#25083440)
> I don’t see why the package manager should prevent using it with another library that depends on a different version.

I do. The main reason for Linux distributions to exists is to provide a development and running environment where:

- API/ABIs do not change for the whole lifetime of the distribution. No new features, no new bugs, no new vulnerabilities, so that your production code can run reliably for 5+ years.

- Vulnerabilities are fixed with minimally invasive patches.

- Vulnerabilities are fixed in reasonable times even if the upstream development stopped. Patches are well tested against the set of packages in the distribution.

You simply cannot have these 3 features together if a distribution ships 10 different version of each library.

It's already a ton of work to maintain packages in stable distributions.

Re:Guido van Rossum joins Microsoft by wtetzner on Friday November 13, 2020 @08:48PM (#25089605)
I’m confused by your comment. This is about a programming language package manager, not an OS package manager. Or was that just an example?