Billingegroup / bg-mpl-stylesheets

Matplotlib style sheets
Other
5 stars 28 forks source link

Urgent- remove usage of `distutils` library for Python 3.13 due to PEP 632 – Deprecate distutils module #75

Open bobleesj opened 3 hours ago

bobleesj commented 3 hours ago

Problem

Our installation instruction

conda create -n bg-mpl-stylesheets_env bg-mpl-stylesheets

automatically installs Python 3.13.

And the a simple example tutorial from Getting Started fails with No module named 'distutils' since we use from distutils.spawn import find_executable in styles.py.

Here is the full output:

  File "/Users/imac/Downloads/dev/bg/bg-mpl-stylesheets/example/plot.py", line 4, in <module>
    from bg_mpl_stylesheets.styles import all_styles
  File "/Users/imac/miniconda3/envs/bg-mpl-stylesheets_env/lib/python3.13/site-packages/bg_mpl_stylesheets/styles.py", line 1, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'

imac@imacs-iMac bg-mpl-stylesheets % python --version
Python 3.13.0

Proposed solution

As suggested by PEP 632:

Screenshot 2024-10-24 at 7 41 37 AM

Ref: https://peps.python.org/pep-0632/

bobleesj commented 3 hours ago

@sbillinge For now, could we use the previous installation instructions to create an conda env using Python=3.12 for now and address this while we prepare for 3.13?

sbillinge commented 2 hours ago

I suggest that we don't change anything in the distributions, but get the 3.13 fixes pushed out as quickly as possible. When our group maintainers are doing the final test of installing and running the 3.12 version they are working on now, just let them know about this issue so they test in 3.12. But we just make more work for ourselves if we change every package for this issue, and then have to change it back when we do the 3.13 release.

It does mean that the 3.13 release updates become rather urgent so we may not want to do too many bug/feature figures as part of that workflow.