-
Notifications
You must be signed in to change notification settings - Fork 5
Better error rendering on unsupported systems #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #392 +/- ##
==========================================
- Coverage 91.81% 91.68% -0.14%
==========================================
Files 15 15
Lines 1112 1118 +6
Branches 138 139 +1
==========================================
+ Hits 1021 1025 +4
- Misses 69 70 +1
- Partials 22 23 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves error handling for unsupported operating systems by raising a clear, user-friendly NotImplementedError at module import time instead of allowing the application to fail later with a cryptic error. This addresses issue #356, which requested better error messages when the library is imported on unsupported systems like Windows.
Changes:
- Added early validation check at import time in
_sampling.pyto detect unsupported operating systems - Implemented a user-friendly error message with guidance to request support via GitHub issues
- Suppressed traceback for cleaner error presentation using
sys.tracebacklimit = 0
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| SYSTEM = platform.system() | ||
|
|
||
| _SUPPORTED_SYSTEMS = {"Linux", "Darwin"} | ||
| if SYSTEM not in _SUPPORTED_SYSTEMS: |
Copilot
AI
Jan 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting sys.tracebacklimit = 0 modifies global state that affects all future tracebacks in the Python process. While this is acceptable for this use case (since the program will terminate after raising the error), consider documenting this side effect with a comment. If someone were to catch this exception and continue execution, all subsequent tracebacks would be suppressed.
| if SYSTEM not in _SUPPORTED_SYSTEMS: | |
| if SYSTEM not in _SUPPORTED_SYSTEMS: | |
| # NOTE: This modifies global interpreter state and will suppress all subsequent | |
| # tracebacks in the current Python process. This is intentional here to avoid | |
| # noisy stack traces on unsupported platforms; if this exception is caught and | |
| # execution continues, traceback output will remain suppressed. |
fix #356
This looks better now