0

The Python docs say

Python and PyPI support multiple distributions providing different implementations of the same package. For instance the unmaintained-but-seminal PIL distribution provides the PIL package, and so does Pillow, an actively-maintained fork of PIL!

What is this paragraph talking about exactly? How can I check whether some Python package (Pillow in this example) provides a different package (PIL in this example)?

Kerrick Staley
  • 1,583
  • 2
  • 20
  • 28
  • I think it depends on how (or if) the list of *Python* packages provided by the *distribution* package is specified in the distribution package metadata. For example, in Pillow's `setup.cfg` file, the `options` section has a `packages = PIL` entry. – chepner May 22 '23 at 15:24
  • Pillow doesn't provide PIL. It has the same interface as PIL, and can substitute it (and since it's more up-to-date, it's likely to be better than PIL itself). – 9769953 May 22 '23 at 16:30
  • As to the titulair question: that depends on what you mean by "provide". Could you clarify that? – 9769953 May 22 '23 at 16:31
  • The Pillow-PIL example quoted in the documentation is a bad example, in my opinion: they are two *different* packages, which happen to have the same external interface, but are otherwise created and maintained by different people. – 9769953 May 22 '23 at 16:36
  • I guess what is meant by the quote, is that some package can exist, and multiple people/groups can implement it, in their own way, with even the same package name (at least for the `import ` part); this is the case for Pillow-PIL. Perhaps it's similar to something like MPI, the message passing interface, which is a *protocol* that different groups have implemented (there is OpenMPI and MPICH). Equally, one could implement their own NumPy, call it differently, but otherwise provide the exact same interface (and functionality) as NumPy; just different under the hood. – 9769953 May 22 '23 at 16:38
  • https://stackoverflow.com/search?q=%5Bpypi%5D+name+provides – phd May 22 '23 at 17:13
  • In Linux package management systems (e.g. Arch Linux's pacman), there is a concept of package A providing package B, meaning that if package C requires package B and you have package A installed, it will say that A satisifies the requirement and not try to install B. The comment from the Python docs made me think pip had the same mechanism, but it looks like it doesn't actually. – Kerrick Staley May 22 '23 at 20:06

0 Answers0