Replace deprecated distutils usage (removed in Python 3.12)#2550
Merged
k9ert merged 2 commits intocryptoadvance:masterfrom Apr 2, 2026
Merged
Conversation
✅ Deploy Preview for specter-desktop-docs canceled.
|
al-munazzim
approved these changes
Mar 20, 2026
Contributor
al-munazzim
left a comment
There was a problem hiding this comment.
Clean Python 3.12+ compatibility fix. Replaces distutils.strtobool (removed in 3.12) with equivalent inline logic in str2bool(). The accepted values match the original strtobool behavior exactly.
LGTM ✅
85a5b2c to
c3defba
Compare
Contributor
|
@abhishek-8081 Black is failing! Can you run black?! |
- server.py: removed unused 'from distutils.core import setup' import - util/common.py: replaced distutils.util.strtobool with an inline implementation in str2bool() that has the same behavior Fixes cryptoadvance#2549
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5e4f6c6 to
7d5ee98
Compare
al-munazzim
approved these changes
Apr 2, 2026
Contributor
al-munazzim
left a comment
There was a problem hiding this comment.
Clean fix — inlined strtobool logic matches the original distutils.util.strtobool behavior exactly, and the unused server.py import removal is correct. Black and unit tests passing. LGTM. 👍
k9ert
approved these changes
Apr 2, 2026
This was referenced Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2549
distutilswas deprecated in Python 3.10 and fully removed in Python 3.12. This PR removes both usages from the codebase:Changes
server.py: Removedfrom distutils.core import setup— this import was not used anywhere in the file.util/common.py: Replacedfrom distutils.util import strtoboolwith an inline implementation inside the existingstr2bool()function. The behavior is exactly the same — it accepts the same true values (y, yes, t, true, on, 1) and false values (n, no, f, false, off, 0) and raisesValueErrorfor anything else.Without this fix, Specter will crash on startup with
ModuleNotFoundError: No module named 'distutils'if run on Python 3.12+.