suserror 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
suserror-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ketan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: suserror
3
+ Version: 0.2.0
4
+ Summary: A lightweight developer utility that plays professional/chaotic sound effects on Python exceptions.
5
+ Author-email: Ketan <dev@example.com>
6
+ Project-URL: Homepage, https://github.com/Ketan6969/suserror
7
+ Project-URL: Bug Tracker, https://github.com/Ketan6969/suserror/issues
8
+ Keywords: error,sound,utility,debugging,fun,exception
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Software Development :: Debuggers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.8
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: pygame>=2.0.0
19
+ Dynamic: license-file
20
+
21
+ # 🚨 suserror
22
+
23
+ [![PyPI version](https://img.shields.io/pypi/v/suserror.svg)](https://pypi.org/project/suserror/)
24
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
25
+ [![Python Versions](https://img.shields.io/pypi/pyversions/suserror.svg)](https://pypi.org/project/suserror/)
26
+
27
+ **suserror** is a lightweight, fun developer utility that turns your Python exceptions into an auditory experience. Whether you want a subtle alert or total chaos, `suserror` ensures you *hear* your mistakes.
28
+
29
+ ---
30
+
31
+ ## ✨ Features
32
+
33
+ - 🎧 **Instant Feedback**: Plays a random sound whenever an exception goes uncaught.
34
+ - ⚡ **Non-blocking**: Sound playback happens in a daemon thread; your program won't freeze.
35
+ - 🎭 **Sound Modes**: Choose between `subtle` for a quick heads-up or `chaotic` for maximum impact.
36
+ - đŸ› ī¸ **Customizable**: Drop your own `.mp3` files into the `sounds/` folder to personalize your errors.
37
+ - 🐍 **Universal**: Works seamlessly with any Python 3.8+ project.
38
+
39
+ ---
40
+
41
+ ## 🚀 Installation
42
+
43
+ For the best experience, install `suserror` in a virtual environment:
44
+
45
+ ```bash
46
+ # Create a virtual environment
47
+ python3 -m venv venv
48
+ source venv/bin/activate
49
+
50
+ # Install suserror
51
+ pip install .
52
+ ```
53
+
54
+ *Note: Depends on `pygame` for high-quality audio handling.*
55
+
56
+ ---
57
+
58
+ ## 📖 Usage
59
+
60
+ ### đŸ§™â€â™‚ī¸ Automatic Mode (The "Set and Forget")
61
+ Just one line at the top of your script, and you're good to go. All uncaught exceptions will trigger a random sound.
62
+
63
+ ```python
64
+ import suserror
65
+
66
+ # Start the auto-hook (default mode is 'all')
67
+ suserror.auto()
68
+
69
+ # Any error below will trigger a sound
70
+ 1 / 0
71
+ ```
72
+
73
+ ### 🎭 Switching Modes
74
+ You can control the vibe of your errors by passing a `mode` to `auto()`.
75
+
76
+ ```python
77
+ # For a more professional/minimalist feel
78
+ suserror.auto(mode="subtle")
79
+
80
+ # For when you really messed up
81
+ suserror.auto(mode="chaotic")
82
+ ```
83
+
84
+ ### đŸ•šī¸ Manual Mode
85
+ Trigger a sound effect programmatically whenever you want.
86
+
87
+ ```python
88
+ import suserror
89
+
90
+ try:
91
+ process_sensitive_data()
92
+ except DataError:
93
+ suserror.play_error(mode="chaotic")
94
+ # Log the error or handle it
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 📂 Sound Categories
100
+
101
+ The package comes with several pre-bundled sounds categorized as follows:
102
+
103
+ - **Subtle**: Minimalist pings and short alerts (e.g., `anime-ahh.mp3`).
104
+ - **Chaotic**: Longer, louder, or more "sus" sounds (e.g., `among-us-role-reveal-sound.mp3`, `fahhhhhhhhhhhhhh.mp3`).
105
+
106
+ ---
107
+
108
+ ## đŸ› ī¸ Development & Customization
109
+
110
+ To add your own sound effects:
111
+ 1. Navigate to the `suserror/sounds/` directory.
112
+ 2. Drop your `.mp3` files there.
113
+ 3. (Optional) Update `SOUND_MODES` in `player.py` to categorize them.
114
+
115
+ ---
116
+
117
+ ## 📜 License
118
+
119
+ Distributed under the MIT License. See `LICENSE` for more information.
120
+
121
+ ---
122
+
123
+ <p align="center">Made with â¤ī¸ for the Python community</p>
@@ -0,0 +1,103 @@
1
+ # 🚨 suserror
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/suserror.svg)](https://pypi.org/project/suserror/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Python Versions](https://img.shields.io/pypi/pyversions/suserror.svg)](https://pypi.org/project/suserror/)
6
+
7
+ **suserror** is a lightweight, fun developer utility that turns your Python exceptions into an auditory experience. Whether you want a subtle alert or total chaos, `suserror` ensures you *hear* your mistakes.
8
+
9
+ ---
10
+
11
+ ## ✨ Features
12
+
13
+ - 🎧 **Instant Feedback**: Plays a random sound whenever an exception goes uncaught.
14
+ - ⚡ **Non-blocking**: Sound playback happens in a daemon thread; your program won't freeze.
15
+ - 🎭 **Sound Modes**: Choose between `subtle` for a quick heads-up or `chaotic` for maximum impact.
16
+ - đŸ› ī¸ **Customizable**: Drop your own `.mp3` files into the `sounds/` folder to personalize your errors.
17
+ - 🐍 **Universal**: Works seamlessly with any Python 3.8+ project.
18
+
19
+ ---
20
+
21
+ ## 🚀 Installation
22
+
23
+ For the best experience, install `suserror` in a virtual environment:
24
+
25
+ ```bash
26
+ # Create a virtual environment
27
+ python3 -m venv venv
28
+ source venv/bin/activate
29
+
30
+ # Install suserror
31
+ pip install .
32
+ ```
33
+
34
+ *Note: Depends on `pygame` for high-quality audio handling.*
35
+
36
+ ---
37
+
38
+ ## 📖 Usage
39
+
40
+ ### đŸ§™â€â™‚ī¸ Automatic Mode (The "Set and Forget")
41
+ Just one line at the top of your script, and you're good to go. All uncaught exceptions will trigger a random sound.
42
+
43
+ ```python
44
+ import suserror
45
+
46
+ # Start the auto-hook (default mode is 'all')
47
+ suserror.auto()
48
+
49
+ # Any error below will trigger a sound
50
+ 1 / 0
51
+ ```
52
+
53
+ ### 🎭 Switching Modes
54
+ You can control the vibe of your errors by passing a `mode` to `auto()`.
55
+
56
+ ```python
57
+ # For a more professional/minimalist feel
58
+ suserror.auto(mode="subtle")
59
+
60
+ # For when you really messed up
61
+ suserror.auto(mode="chaotic")
62
+ ```
63
+
64
+ ### đŸ•šī¸ Manual Mode
65
+ Trigger a sound effect programmatically whenever you want.
66
+
67
+ ```python
68
+ import suserror
69
+
70
+ try:
71
+ process_sensitive_data()
72
+ except DataError:
73
+ suserror.play_error(mode="chaotic")
74
+ # Log the error or handle it
75
+ ```
76
+
77
+ ---
78
+
79
+ ## 📂 Sound Categories
80
+
81
+ The package comes with several pre-bundled sounds categorized as follows:
82
+
83
+ - **Subtle**: Minimalist pings and short alerts (e.g., `anime-ahh.mp3`).
84
+ - **Chaotic**: Longer, louder, or more "sus" sounds (e.g., `among-us-role-reveal-sound.mp3`, `fahhhhhhhhhhhhhh.mp3`).
85
+
86
+ ---
87
+
88
+ ## đŸ› ī¸ Development & Customization
89
+
90
+ To add your own sound effects:
91
+ 1. Navigate to the `suserror/sounds/` directory.
92
+ 2. Drop your `.mp3` files there.
93
+ 3. (Optional) Update `SOUND_MODES` in `player.py` to categorize them.
94
+
95
+ ---
96
+
97
+ ## 📜 License
98
+
99
+ Distributed under the MIT License. See `LICENSE` for more information.
100
+
101
+ ---
102
+
103
+ <p align="center">Made with â¤ī¸ for the Python community</p>
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "suserror"
7
+ version = "0.2.0"
8
+ authors = [
9
+ { name="Ketan", email="dev@example.com" },
10
+ ]
11
+ description = "A lightweight developer utility that plays professional/chaotic sound effects on Python exceptions."
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ keywords = ["error", "sound", "utility", "debugging", "fun", "exception"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "Topic :: Software Development :: Debuggers",
19
+ "Programming Language :: Python :: 3",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ ]
23
+ dependencies = [
24
+ "pygame>=2.0.0",
25
+ ]
26
+
27
+ [project.urls]
28
+ "Homepage" = "https://github.com/Ketan6969/suserror"
29
+ "Bug Tracker" = "https://github.com/Ketan6969/suserror/issues"
30
+
31
+ [tool.setuptools.packages.find]
32
+ where = ["."]
33
+ include = ["suserror*"]
34
+
35
+ [tool.setuptools.package-data]
36
+ suserror = ["sounds/*.mp3"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,35 @@
1
+ import sys
2
+ from .player import play_error
3
+
4
+ __all__ = ["play_error", "auto"]
5
+
6
+ _original_excepthook = None
7
+ _current_mode = "all"
8
+
9
+ def _sus_excepthook(type, value, traceback):
10
+ """Custom excepthook that plays a sound and then calls the original hook."""
11
+ play_error(mode=_current_mode)
12
+ if _original_excepthook:
13
+ _original_excepthook(type, value, traceback)
14
+ else:
15
+ sys.__excepthook__(type, value, traceback)
16
+
17
+ def auto(mode="all"):
18
+ """
19
+ Attaches suserror to sys.excepthook for automatic sound playback on uncaught exceptions.
20
+
21
+ Args:
22
+ mode (str): 'subtle', 'chaotic', or 'all' (default).
23
+ """
24
+ global _original_excepthook, _current_mode
25
+ _current_mode = mode
26
+ if sys.excepthook is not _sus_excepthook:
27
+ _original_excepthook = sys.excepthook
28
+ sys.excepthook = _sus_excepthook
29
+
30
+ def stop():
31
+ """Restores the original excepthook."""
32
+ global _original_excepthook
33
+ if _original_excepthook:
34
+ sys.excepthook = _original_excepthook
35
+ _original_excepthook = None
@@ -0,0 +1,83 @@
1
+ import os
2
+ import random
3
+ import threading
4
+ import pygame
5
+
6
+ # Initialize pygame mixer
7
+ try:
8
+ pygame.mixer.init()
9
+ except Exception:
10
+ pass
11
+
12
+ def _play_sound_sync(sound_path):
13
+ """Internal helper to play sound synchronously in a thread."""
14
+ try:
15
+ if not pygame.mixer.get_init():
16
+ pygame.mixer.init()
17
+
18
+ sound = pygame.mixer.Sound(sound_path)
19
+ sound.play()
20
+
21
+ # Wait for the sound to finish playing
22
+ while pygame.mixer.get_busy():
23
+ pygame.time.delay(100)
24
+ except Exception:
25
+ # Gracefully handle audio errors
26
+ pass
27
+
28
+ # Sound categories based on user-provided files
29
+ SOUND_MODES = {
30
+ "subtle": [
31
+ "anime-ahh.mp3",
32
+ "gopgopgop.mp3"
33
+ ],
34
+ "chaotic": [
35
+ "among-us-role-reveal-sound.mp3",
36
+ "fahhhhhhhhhhhhhh.mp3",
37
+ "jhinka-chika-jhinka-chika.mp3",
38
+ "kya-cheda-bhosdi.mp3"
39
+ ]
40
+ }
41
+
42
+ def play_error(mode="all"):
43
+ """
44
+ Plays a random sound from the bundled sounds directory in a non-blocking thread.
45
+
46
+ Args:
47
+ mode (str): One of 'subtle', 'chaotic', or 'all' (default).
48
+ """
49
+ try:
50
+ # Get the path to the sounds directory relative to this file
51
+ current_dir = os.path.dirname(os.path.abspath(__file__))
52
+ sounds_dir = os.path.join(current_dir, "sounds")
53
+
54
+ if not os.path.exists(sounds_dir):
55
+ return
56
+
57
+ # List all mp3 files in the sounds directory
58
+ all_sounds = [f for f in os.listdir(sounds_dir) if f.endswith(".mp3")]
59
+
60
+ if not all_sounds:
61
+ return
62
+
63
+ # Filter sounds based on mode
64
+ if mode in SOUND_MODES:
65
+ # Use only sounds that exist in the directory AND are in the mode list
66
+ available_in_mode = [s for s in SOUND_MODES[mode] if s in all_sounds]
67
+ if available_in_mode:
68
+ sounds_to_choose = available_in_mode
69
+ else:
70
+ # Fallback to all sounds if mode exists but none of its sounds are found
71
+ sounds_to_choose = all_sounds
72
+ else:
73
+ sounds_to_choose = all_sounds
74
+
75
+ # Randomly select a sound
76
+ selected_sound = random.choice(sounds_to_choose)
77
+ sound_path = os.path.join(sounds_dir, selected_sound)
78
+
79
+ # Play sound in a new thread to avoid blocking
80
+ threading.Thread(target=_play_sound_sync, args=(sound_path,), daemon=True).start()
81
+ except Exception:
82
+ # Gracefully handle all errors to avoid crashing the main application
83
+ pass
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: suserror
3
+ Version: 0.2.0
4
+ Summary: A lightweight developer utility that plays professional/chaotic sound effects on Python exceptions.
5
+ Author-email: Ketan <dev@example.com>
6
+ Project-URL: Homepage, https://github.com/Ketan6969/suserror
7
+ Project-URL: Bug Tracker, https://github.com/Ketan6969/suserror/issues
8
+ Keywords: error,sound,utility,debugging,fun,exception
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Software Development :: Debuggers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.8
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: pygame>=2.0.0
19
+ Dynamic: license-file
20
+
21
+ # 🚨 suserror
22
+
23
+ [![PyPI version](https://img.shields.io/pypi/v/suserror.svg)](https://pypi.org/project/suserror/)
24
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
25
+ [![Python Versions](https://img.shields.io/pypi/pyversions/suserror.svg)](https://pypi.org/project/suserror/)
26
+
27
+ **suserror** is a lightweight, fun developer utility that turns your Python exceptions into an auditory experience. Whether you want a subtle alert or total chaos, `suserror` ensures you *hear* your mistakes.
28
+
29
+ ---
30
+
31
+ ## ✨ Features
32
+
33
+ - 🎧 **Instant Feedback**: Plays a random sound whenever an exception goes uncaught.
34
+ - ⚡ **Non-blocking**: Sound playback happens in a daemon thread; your program won't freeze.
35
+ - 🎭 **Sound Modes**: Choose between `subtle` for a quick heads-up or `chaotic` for maximum impact.
36
+ - đŸ› ī¸ **Customizable**: Drop your own `.mp3` files into the `sounds/` folder to personalize your errors.
37
+ - 🐍 **Universal**: Works seamlessly with any Python 3.8+ project.
38
+
39
+ ---
40
+
41
+ ## 🚀 Installation
42
+
43
+ For the best experience, install `suserror` in a virtual environment:
44
+
45
+ ```bash
46
+ # Create a virtual environment
47
+ python3 -m venv venv
48
+ source venv/bin/activate
49
+
50
+ # Install suserror
51
+ pip install .
52
+ ```
53
+
54
+ *Note: Depends on `pygame` for high-quality audio handling.*
55
+
56
+ ---
57
+
58
+ ## 📖 Usage
59
+
60
+ ### đŸ§™â€â™‚ī¸ Automatic Mode (The "Set and Forget")
61
+ Just one line at the top of your script, and you're good to go. All uncaught exceptions will trigger a random sound.
62
+
63
+ ```python
64
+ import suserror
65
+
66
+ # Start the auto-hook (default mode is 'all')
67
+ suserror.auto()
68
+
69
+ # Any error below will trigger a sound
70
+ 1 / 0
71
+ ```
72
+
73
+ ### 🎭 Switching Modes
74
+ You can control the vibe of your errors by passing a `mode` to `auto()`.
75
+
76
+ ```python
77
+ # For a more professional/minimalist feel
78
+ suserror.auto(mode="subtle")
79
+
80
+ # For when you really messed up
81
+ suserror.auto(mode="chaotic")
82
+ ```
83
+
84
+ ### đŸ•šī¸ Manual Mode
85
+ Trigger a sound effect programmatically whenever you want.
86
+
87
+ ```python
88
+ import suserror
89
+
90
+ try:
91
+ process_sensitive_data()
92
+ except DataError:
93
+ suserror.play_error(mode="chaotic")
94
+ # Log the error or handle it
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 📂 Sound Categories
100
+
101
+ The package comes with several pre-bundled sounds categorized as follows:
102
+
103
+ - **Subtle**: Minimalist pings and short alerts (e.g., `anime-ahh.mp3`).
104
+ - **Chaotic**: Longer, louder, or more "sus" sounds (e.g., `among-us-role-reveal-sound.mp3`, `fahhhhhhhhhhhhhh.mp3`).
105
+
106
+ ---
107
+
108
+ ## đŸ› ī¸ Development & Customization
109
+
110
+ To add your own sound effects:
111
+ 1. Navigate to the `suserror/sounds/` directory.
112
+ 2. Drop your `.mp3` files there.
113
+ 3. (Optional) Update `SOUND_MODES` in `player.py` to categorize them.
114
+
115
+ ---
116
+
117
+ ## 📜 License
118
+
119
+ Distributed under the MIT License. See `LICENSE` for more information.
120
+
121
+ ---
122
+
123
+ <p align="center">Made with â¤ī¸ for the Python community</p>
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ suserror/__init__.py
5
+ suserror/player.py
6
+ suserror.egg-info/PKG-INFO
7
+ suserror.egg-info/SOURCES.txt
8
+ suserror.egg-info/dependency_links.txt
9
+ suserror.egg-info/requires.txt
10
+ suserror.egg-info/top_level.txt
11
+ suserror/sounds/among-us-role-reveal-sound.mp3
12
+ suserror/sounds/anime-ahh.mp3
13
+ suserror/sounds/fahhhhhhhhhhhhhh.mp3
14
+ suserror/sounds/gopgopgop.mp3
15
+ suserror/sounds/jhinka-chika-jhinka-chika.mp3
16
+ suserror/sounds/kya-cheda-bhosdi.mp3
@@ -0,0 +1 @@
1
+ pygame>=2.0.0
@@ -0,0 +1 @@
1
+ suserror