[FIX] Replace statsmodels.robust.scale.mad with scipy.stats.median_abs_deviation to avoid enabling the GIL - #126
Open
pvlov wants to merge 1 commit into
Open
[FIX] Replace statsmodels.robust.scale.mad with scipy.stats.median_abs_deviation to avoid enabling the GIL#126pvlov wants to merge 1 commit into
pvlov wants to merge 1 commit into
Conversation
…s_deviation to avoid enabling the GIL and remove statsmodels from dependencies
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #126 +/- ##
==========================================
- Coverage 83.29% 83.28% -0.01%
==========================================
Files 25 25
Lines 2861 2860 -1
==========================================
- Hits 2383 2382 -1
Misses 478 478 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Hi! Since this is a small diff and I couldn't find a
CONTRIBUTING.md, I went ahead and opened a PR. I hope you don't mind!I wanted to use
meegkitin a project that uses a free-threaded Python interpreter, but I ran into the following warning:You can replicate this warning (using uv) with this command:
uv run --no-project --python 3.14t --with statsmodels python -c "import statsmodels.robust.scale"I checked where/how
statsmodelsis used and found only one occurrence:statsmodels.robust.scale.mad. This PR replaces it with the equivalentscipy.stats.median_abs_deviation. This makes the package usable in free-threaded contexts while also dropping thestatsmodelsdependency entirely.Additionally, I added a test using the built-in
sys._is_gil_enabledcheck to confirm the GIL stays disabled, and added3.14and3.14tto the CI python matrix. Let me know if you want to keep this or if I should drop this.