Il mar 12 ago 2025, 07:47 Michael Tokarev <m...@tls.msk.ru> ha scritto:
> > We're bending over backwards just because the Python developers on one > > hand keep shipping pip while saying that "no, pip is absolutely not > > special"; and on the other hand keep *not* shipping packaging and > > distlib while complaining that people don't use them. > > This is a bit backwards, it looks like, and a bit too gross. > > First, pip vendors a few crate^Wlibs for internal use, but these libs > had never been public, - that's why distlib is imported from > pip._vendor. We used this hack in qemu to simplify bootstrap, but > it was never the intended usage in pip, and hence there's no backwards > compatibility break here from the pip side. > Yes, absolutely. We were doing something gross as a convenience, but never documented that it's just that, a convenience. Second, which is a continuation of the first, strictly speaking it > is our fault that we use distlib without depending on it. > Agreed, hence my suggestion to just require distlib. And 3rd, it seems like Current Way (tm) is to use "packaging" library > instead of distlib. And packaging library is shipped within pip for > a decade or so already - the same way as distlib. This is why I > wrote "backwards" above - by requiring distlib, we seems to work > backwards, because current python way - which's been this way for > years - is to use packaging, not distlib. They are different libraries and both have their role. pip used distlib.scripts but not distlib.version, and therefore decided to stop shipping what it doesn't use https://github.com/pypa/pip/pull/13337 https://github.com/pypa/pip/pull/13342 Using distlib is not going backwards, especially considering that we have no other use for "packaging" in QEMU. There's no replacement for distlib.scripts in the "packaging" library, and no official deprecation of distlib.version. All that we would get from doing version matching with "packaging" is requiring two dependencies instead of one (which is why John kept the possibility to use an installed distlib). Paolo