Replies: 3 comments 3 replies
-
Except it's not. edit: I feel like I should also mention the very first thing in PEP 8 after the introduction: https://peps.python.org/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds |
Beta Was this translation helpful? Give feedback.
-
This is ultimately the project maintainers decision whether to standardize on PEP 8 or not for the existing codebase. I do understand that it would take some time to refactor the style and provide backward compatibility. I just wanted to share that the naming convention is unusual compared to the vast majority of python projects and that linting tools such as pylint, ruff, pep8 will need to be tuned accordingly for folks that would contribute. An other example in def isImageType(t: Any) -> TypeGuard[Image]: Which under PEP 8 guidance would probably be written as: def _is_image_type(obj: Any) -> TypeGuard[Image]: This way linters would warn external callers that they are not supposed to use it. Again, just a suggestion to help make PIL/pillow more accessible to new users. Maybe I should have opened this under Discussions. |
Beta Was this translation helpful? Give feedback.
-
@sodul Thank you, converted to discussion! It's interesting to discuss but probably not actionable for the core team at the moment. Also, this is at least two separate tasks: lower casing Image module and renaming PIL package to pillow … neither of which we've ever seriously considered. |
Beta Was this translation helpful? Give feedback.
-
The pillow package is a fork of PIL from 2010. While PIL did not follow the pep-8 naming conventions I feel that with the improved linting tools in the python ecosystem it might be time for pillow to mature from its original roots and start adopting pep-8.
I think this could be done in a 100% backward compatible manner and just publish pillow so that both
from PIL import Image
(confusing) andfrom pillow import image
(pep-8 compliant) will work. A new pillow release could add the new compliant names and over a few releases mark the old names as deprecated, and a few years later completely remove support of the old, non compliant names.I know this suggestion might be controversial, but folks that do not know that
PIL
is reallypillow
do get confused. If you are not previously familiar with PIL and look for aPIL
library on pypi.org, there are dozens of matches and it is not very clear that you wantpillow
. Indirectly this is a security concern as it facilitates a supply chain attack when someone would want to addPIL
to their project and innocently install a compromised version of PIL that would look like a better match thanpillow
.https://pypi.org/search/?q=pil ... pillow is not even on the first 10 pages.
Beta Was this translation helpful? Give feedback.
All reactions