Skip to content

Conversation

neutrinoceros
Copy link
Contributor

fix #83

notes:

  • to maximize compatibility with all known versions of MPL, I'm adding packaging (which is extremely common, well distributed and maintained) as a dependency.
  • ‡I'm also requiring Python 3.8 for importlib.metadata, but I can keep compatibility with older Python 3 version if desired, it's just a marginal ammount of additional work to leverage the backport importlib_metadata.

@neutrinoceros
Copy link
Contributor Author

neutrinoceros commented Jan 11, 2023

reprod:

run pytest -Werror t.py with

# t.py
import cmocean

on the master branch + matplotlib 3.6, it fails with

========================= test session starts =========================
platform darwin -- Python 3.11.1, pytest-7.2.0, pluggy-1.0.0
rootdir: /Users/robcleme/dev/cmocean
collected 0 items / 1 error

=============================== ERRORS ================================
________________________ ERROR collecting t.py ________________________
t.py:1: in <module>
    import cmocean
cmocean/__init__.py:11: in <module>
    from . import cm, tools, data
cmocean/cm.py:43: in <module>
    cm.register_cmap(cmap = reg_map)
../../.pyenv/versions/cmocean-dev/lib/python3.11/site-packages/matplotlib/_api/deprecation.py:199: in wrapper
    emit_warning()
../../.pyenv/versions/cmocean-dev/lib/python3.11/site-packages/matplotlib/_api/deprecation.py:193: in emit_warning
    warn_deprecated(
../../.pyenv/versions/cmocean-dev/lib/python3.11/site-packages/matplotlib/_api/deprecation.py:96: in warn_deprecated
    warn_external(warning, category=MatplotlibDeprecationWarning)
../../.pyenv/versions/cmocean-dev/lib/python3.11/site-packages/matplotlib/_api/__init__.py:363: in warn_external
    warnings.warn(message, category, stacklevel)
E   PendingDeprecationWarning: The register_cmap function will be deprecated in a future version. Use ``matplotlib.colormaps.register(name)`` instead.
======================= short test summary info =======================
ERROR t.py - PendingDeprecationWarning: The register_cmap function will be depr...
!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!
========================== 1 error in 0.25s ===========================

on this branch it runs fine

@kthyng
Copy link
Contributor

kthyng commented Jan 13, 2023

Hi @neutrinoceros and thanks so much for your work on this!

I'm not sure about what Python version we should support. I see this page from matplotlib which shows 3.8 is fine for the recent matplotlib version, but not the last one.

Matplotlib Python NumPy
3.6 3.8 1.19.0
3.5 3.7 1.17.0

I think it is fine to follow matplotlib's lead and for the newest version of cmocean, support Python 3.8 as a minimum version.

@kthyng kthyng merged commit 15afff5 into matplotlib:master Jan 13, 2023
@neutrinoceros neutrinoceros deleted the future_mpl_compat branch January 13, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Future incompatibility with MPL

2 participants