albertosottile / darkdetect

Detect OS Dark Mode from Python
Other
171 stars 18 forks source link

distutils.version LooseVersion is deprecated #18

Closed Carreau closed 1 year ago

Carreau commented 2 years ago

Since setuptools https://setuptools.pypa.io/en/latest/history.html#v59-6-0 it emits a deprecation warning.

https://github.com/albertosottile/darkdetect/blob/6556925d9f7f53cc41b71718080500aeca95aa17/darkdetect/__init__.py#L13-L14

This means that dependees that turn warnings into error will fail (for example in CI).

    if V(platform.mac_ver()[0]) < V("10.14"):
../../miniconda3-intel/envs/napari/lib/python3.9/site-packages/setuptools/_distutils/version.py:53: in __init__
    warnings.warn(
E   DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

This can be worked around with a warning filter , for example:

[tool.pytest.ini_options]
filterwarnings = [
  "ignore:.*distutils Version classes are deprecated::darkdetect",  
]

It looks like you may not want dependencies, so I'm not if and how you wish to fix it.

albertosottile commented 2 years ago

Thanks for reporting this. I guess the suggested alternative would be to depend on packaging... I will think about what to do, I might recode some small logic here instead of adding a non-standard-library dependency.

albertosottile commented 1 year ago

Fixed in 0.7.0.