Skip to content

Replace removed distutils with shutil.which - #215

Merged
vuillaut merged 1 commit into
masterfrom
fix-distutils-py312
Aug 7, 2026
Merged

Replace removed distutils with shutil.which#215
vuillaut merged 1 commit into
masterfrom
fix-distutils-py312

Conversation

@vuillaut

@vuillaut vuillaut commented Aug 7, 2026

Copy link
Copy Markdown
Member

Problem

CI fails on Python 3.12/3.13 with 6 collection errors, all from the same root cause:

ctaplot/plots/style.py:2: in <module>
    from distutils.spawn import find_executable
E   ModuleNotFoundError: No module named 'distutils'

distutils was removed from the standard library in Python 3.12 (PEP 632).

Fix

shutil.which is the stdlib replacement for distutils.spawn.find_executable — same call signature, same None-if-not-found semantics — so it's a direct swap in check_latex().

Verified import ctaplot succeeds and check_latex() still detects a LaTeX install locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KyTy3FkRXDmP3UTLAnCtht

distutils was removed from the stdlib in Python 3.12, breaking all
imports of ctaplot on 3.12+. shutil.which is the drop-in replacement
for distutils.spawn.find_executable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KyTy3FkRXDmP3UTLAnCtht
@vuillaut
vuillaut merged commit 609269e into master Aug 7, 2026
5 checks passed
@vuillaut
vuillaut deleted the fix-distutils-py312 branch August 7, 2026 16:23
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.

1 participant