[Python-Dev] PEP 594: Removing dead batteries from the standard library

Petr Viktorin encukou at gmail.com
Tue May 21 10:39:44 EDT 2019


On 5/21/19 12:06 PM, Christian Heimes wrote:
> On 21/05/2019 11.49, Nathaniel Smith wrote:
>> On Tue, May 21, 2019 at 2:40 AM Walter Dörwald <walter at livinglogic.de> wrote:
>>>
>>> On 20 May 2019, at 22:15, Christian Heimes wrote:
>>>
>>>> Hi,
>>>>
>>>> here is the first version of my PEP 594 to deprecate and eventually
>>>> remove modules from the standard library. The PEP started last year
>>>> with talk during the Python Language Summit 2018,
>>>> https://lwn.net/Articles/755229/.
>>>>
>>>> [...]
>>>>
>>>> colorsys
>>>> ~~~~~~~~
>>>>
>>>> The `colorsys <https://docs.python.org/3/library/colorsys.html>`_
>>>> module
>>>> defines color conversion functions between RGB, YIQ, HSL, and HSV
>>>> coordinate
>>>> systems. The Pillow library provides much faster conversation between
>>>> color systems.
>>>>
>>>> Module type
>>>>    pure Python
>>>> Deprecated in
>>>>    3.8
>>>> To be removed in
>>>>    3.10
>>>> Substitute
>>>>    `Pillow <https://pypi.org/project/Pillow/>`_,
>>>>    `colorspacious <https://pypi.org/project/colorspacious/>`_
>>>
>>> I'm using colorsys constantly as the basis for a tool that converts CSS
>>> colors between different coordinate systems. I don't see how that could
>>> be done via Pillow (which AFAICT only converts complete images).
>>> RGB<->HSV<->HLS conversion seems to be not available (or not obvious) in
>>> colorspacious.
>>
>> Correct, colorspacious doesn't support HSV or HLS. I suppose it would
>> be trivial enough to add...
>>
>> The 'colour' package has them (along with everything else you can
>> dream of): https://colour.readthedocs.io/en/latest/colour.models.html
> 
> Nice catch, I just added https://python-colormath.readthedocs.io/en/latest/ to my update PR. I'll add colour to the list, too.
> 
> (It didn't pop up on my radar because I wasn't checking for British spelling)
> 
> Christian


Please, don't remove colorsys. HSL and HSV aren't outdated, and AFAIK, 
the module is not a maintenance burden.

The packages on PyPI offer more advanced models. Perhaps they could be 
linked in the documentation, if we want to endorse them. But just as 
we're not removing `array` in favor of `numpy`, we shouldn't remove 
colorsys either. Colorsys is not dead, it's just small.

I assume one of the reasons colorspacious doesn't support HSV or HLS is 
that HSV/HLS tends to be used for quite different purposes than the more 
fancy color spaces. You'd use HSL/HSV for a simple color picker or a 
saturation shift on a web page, GUI or game (where you don't have 
*exact* colors anyway); things like sRGB or CIELab are for color 
management, photos, printing, etc.



More information about the Python-Dev mailing list