> As in, `import pillow as PIL`?
As in, not changing your imports at all, and just changing your dependency from PIL to pillow. This has two substantial advantages:
1. You only have to change one line (the dependency), not an indefinite number of source files. This is less of an issue now that the Python community has high-quality refactoring tools, but it's still the past of least resistance.
2. More importantly: `import pillow as PIL` is not referentially transparent: the `PIL` binding that it introduces is a `module` object, but that object can't be used in subsequent imports. In other words, blindly performing an `import X as Y` refactor would break code like this:
import PIL
from PIL import whatever
You can observe this for yourself locally:
>>> import ssl as lol
>>> from lol import CERT_NONE
ModuleNotFoundError: No module named 'lol'
>>> from ssl import CERT_NONE
This is arguably a defect in Python's import and module machinery, but that's how it currently is. Renaming the dependency and keeping the module name is
far less fraught.