firefly-cpp / sport-activities-features

A minimalistic toolbox for extracting features from sports activity files written in Python
MIT License
17 stars 11 forks source link

seaborn-* styles are deprecated #152

Closed QuLogic closed 9 months ago

QuLogic commented 11 months ago

The seaborn-whitegrid style used in this package was renamed and deprecated in Matplotlib 3.6 The upcoming Matplotlib 3.8 release has removed the deprecated names and will cause this package to fail to import, e.g.,

______________ ERROR collecting tests/test_area_identification.py ______________
/usr/lib64/python3.12/site-packages/matplotlib/style/core.py:137: in use
    style = _rc_params_in_file(style)
/usr/lib64/python3.12/site-packages/matplotlib/__init__.py:869: in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
/usr/lib64/python3.12/contextlib.py:137: in __enter__
    return next(self.gen)
/usr/lib64/python3.12/site-packages/matplotlib/__init__.py:846: in _open_file_or_url
    with open(fname, encoding='utf-8') as f:
E   FileNotFoundError: [Errno 2] No such file or directory: 'seaborn-whitegrid'

The above exception was the direct cause of the following exception:
tests/test_area_identification.py:6: in <module>
    from sport_activities_features.area_identification import AreaIdentification
sport_activities_features/__init__.py:18: in <module>
    from sport_activities_features.plot_data import PlotData
sport_activities_features/plot_data.py:3: in <module>
    plt.style.use('seaborn-whitegrid')
/usr/lib64/python3.12/site-packages/matplotlib/style/core.py:139: in use
    raise OSError(
E   OSError: 'seaborn-whitegrid' is not a valid package style, path of style file, URL of style file, or library style name (library styles are listed in `style.available`)
firefly-cpp commented 11 months ago

Thanks @QuLogic. What do you think is the best replacement?

QuLogic commented 11 months ago

That depends on which versions you want to support. For Matplotlib 3.6 and above, use the styles with the seaborn-v0_8 prefix. Otherwise, you'll have to do a version check.