tooly-dev 1.1.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SuperDragon777
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,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: tooly-dev
3
+ Version: 1.1.0
4
+ Summary: Lightweight terminal utilities
5
+ Author: SuperDragon777
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 SuperDragon777
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/SuperDragon777/tooly
29
+ Keywords: terminal,cli,colors,spinner,developer-tools
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Operating System :: OS Independent
33
+ Classifier: Environment :: Console
34
+ Classifier: Topic :: Terminals
35
+ Requires-Python: >=3.8
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Dynamic: license-file
39
+
40
+ # tooly
41
+
42
+ Lightweight terminal utilities for Python developers.
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install tooly-dev
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ ```python
53
+ import tooly
54
+ import time
55
+
56
+ colors = tooly.ColorSystem() # recommended
57
+ wait_time = 0.5
58
+
59
+ print(colors.info("Welcome to Tooly!")) # Color example
60
+
61
+ tooly.typewrite(colors.info("Example text"), delay=0.05) # Typewrite example
62
+
63
+ with tooly.measure("Example measure"):
64
+ # Do something
65
+ time.sleep(wait_time)
66
+
67
+ with tooly.spinner("Example spinner", done_msg="Exaple spinner done"):
68
+ #Do something
69
+ time.sleep(wait_time)
70
+
71
+ text = "Some interesting text with keywords"
72
+ print(colors.highlight(text, ["keywords", "text"], "yellow")) # text, keywords, color
73
+
74
+ # You can use indent for file tree for exaple
75
+ print(colors.indent("Example folder/", 0))
76
+ print(colors.indent("Example python file", 1))
77
+ print(colors.indent("Example readme file", 1))
78
+ print(colors.indent("Example subfolder/", 1))
79
+ print(colors.indent("howtodoerrors.txt", 2))
80
+ print(colors.indent("Example file", 0))
81
+ ```
82
+
83
+ ## License
84
+
85
+ MIT
@@ -0,0 +1,46 @@
1
+ # tooly
2
+
3
+ Lightweight terminal utilities for Python developers.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install tooly-dev
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ import tooly
15
+ import time
16
+
17
+ colors = tooly.ColorSystem() # recommended
18
+ wait_time = 0.5
19
+
20
+ print(colors.info("Welcome to Tooly!")) # Color example
21
+
22
+ tooly.typewrite(colors.info("Example text"), delay=0.05) # Typewrite example
23
+
24
+ with tooly.measure("Example measure"):
25
+ # Do something
26
+ time.sleep(wait_time)
27
+
28
+ with tooly.spinner("Example spinner", done_msg="Exaple spinner done"):
29
+ #Do something
30
+ time.sleep(wait_time)
31
+
32
+ text = "Some interesting text with keywords"
33
+ print(colors.highlight(text, ["keywords", "text"], "yellow")) # text, keywords, color
34
+
35
+ # You can use indent for file tree for exaple
36
+ print(colors.indent("Example folder/", 0))
37
+ print(colors.indent("Example python file", 1))
38
+ print(colors.indent("Example readme file", 1))
39
+ print(colors.indent("Example subfolder/", 1))
40
+ print(colors.indent("howtodoerrors.txt", 2))
41
+ print(colors.indent("Example file", 0))
42
+ ```
43
+
44
+ ## License
45
+
46
+ MIT
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tooly-dev"
7
+ version = "1.1.0"
8
+ description = "Lightweight terminal utilities"
9
+ readme = "README.md"
10
+ license = { file = "LICENSE" }
11
+ authors = [
12
+ { name = "SuperDragon777" }
13
+ ]
14
+ requires-python = ">=3.8"
15
+ keywords = ["terminal", "cli", "colors", "spinner", "developer-tools"]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ "Environment :: Console",
21
+ "Topic :: Terminals",
22
+ ]
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/SuperDragon777/tooly"
26
+
27
+ [tool.setuptools]
28
+ py-modules = ["tooly"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,143 @@
1
+ __version__ = "1.1.0"
2
+ __author__ = "SuperDragon777"
3
+ __all__ = ["ColorSystem"]
4
+
5
+ import platform
6
+ import sys
7
+ import os
8
+ import time
9
+ from contextlib import contextmanager
10
+
11
+ class ColorSystem:
12
+ def __init__(self):
13
+ self.support_colors = self._check_color_support()
14
+
15
+ def _check_color_support(self):
16
+ if platform.system() == 'Windows':
17
+ if sys.platform == 'win32':
18
+ os.system('color')
19
+ return True
20
+
21
+ if 'TERM' in os.environ and os.environ['TERM'] != 'dumb':
22
+ return True
23
+
24
+ return sys.stdout.isatty()
25
+
26
+ def _colorize(self, text, color_code):
27
+ if not self.support_colors:
28
+ return text
29
+ return f"\033[{color_code}m{text}\033[0m"
30
+
31
+ def red(self, text):
32
+ return self._colorize(text, "91")
33
+
34
+ def green(self, text):
35
+ return self._colorize(text, "92")
36
+
37
+ def yellow(self, text):
38
+ return self._colorize(text, "93")
39
+
40
+ def blue(self, text):
41
+ return self._colorize(text, "94")
42
+
43
+ def grey(self, text):
44
+ return self._colorize(text, "90")
45
+
46
+ def bold(self, text):
47
+ return self._colorize(text, "1")
48
+
49
+ def success(self, text):
50
+ return self.green(f"[✓] {text}")
51
+
52
+ def error(self, text):
53
+ return self.red(f"[X] {text}")
54
+
55
+ def warning(self, text):
56
+ return self.yellow(f"[!] {text}")
57
+
58
+ def info(self, text):
59
+ return self.blue(f"[i] {text}")
60
+
61
+ def highlight(self, text: str, keywords: list[str], color: str = "yellow") -> str:
62
+ colorize = getattr(self, color, self.yellow)
63
+ for kw in keywords:
64
+ text = text.replace(kw, colorize(kw))
65
+ return text
66
+
67
+ def indent(self, text: str, level: int = 1) -> str:
68
+ palette = ["94", "92", "93", "91", "95"]
69
+ code = palette[level % len(palette)]
70
+ prefix = " " * level + "│ "
71
+ return self._colorize(prefix, code) + text
72
+
73
+ def typewrite(
74
+ text: str,
75
+ delay: float = 0.1,
76
+ stream=sys.stdout,
77
+ end: str = "\n",
78
+ ) -> None:
79
+ write = stream.write
80
+ for char in text:
81
+ write(char)
82
+ stream.flush()
83
+ time.sleep(delay)
84
+ write(end)
85
+ stream.flush()
86
+
87
+ @contextmanager
88
+ def measure(label: str = "runtime", stream=sys.stdout, precision: int = 3):
89
+ colors = ColorSystem()
90
+ start = time.perf_counter()
91
+ try:
92
+ yield
93
+ finally:
94
+ elapsed = time.perf_counter() - start
95
+ formatted = _format_duration(elapsed, precision)
96
+ stream.write(colors.grey(f"[⏲] {label}: {formatted}\n"))
97
+ stream.flush()
98
+
99
+
100
+ def _format_duration(seconds: float, precision: int = 3) -> str:
101
+ if seconds < 1e-3:
102
+ return f"{seconds * 1_000_000:.{precision}f}µs"
103
+ elif seconds < 1:
104
+ return f"{seconds * 1_000:.{precision}f}ms"
105
+ elif seconds < 60:
106
+ return f"{seconds:.{precision}f}s"
107
+ elif seconds < 3600:
108
+ minutes = int(seconds // 60)
109
+ secs = seconds % 60
110
+ return f"{minutes}m {secs:.{precision}f}s"
111
+ else:
112
+ hours = int(seconds // 3600)
113
+ minutes = int((seconds % 3600) // 60)
114
+ secs = seconds % 60
115
+ return f"{hours}h {minutes}m {secs:.{precision}f}s"
116
+
117
+ @contextmanager
118
+ def spinner(label: str = "Loading", frames="⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏", done_msg: str = "Done"):
119
+ import threading
120
+ colors = ColorSystem()
121
+ stop_event = threading.Event()
122
+
123
+ def _spin():
124
+ i = 0
125
+ while not stop_event.is_set():
126
+ sys.stdout.write(f"\r{frames[i % len(frames)]} {label}...")
127
+ sys.stdout.flush()
128
+ i += 1
129
+ time.sleep(0.1)
130
+
131
+ t = threading.Thread(target=_spin, daemon=True)
132
+ t.start()
133
+ try:
134
+ yield
135
+ finally:
136
+ stop_event.set()
137
+ t.join()
138
+ sys.stdout.write("\r" + " " * (len(label) + 10) + "\r")
139
+ sys.stdout.write(colors.success(done_msg) + "\n") # ← вот это
140
+ sys.stdout.flush()
141
+
142
+ if __name__ == "__main__":
143
+ print(ColorSystem().info("Tooly v{}".format(__version__)))
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: tooly-dev
3
+ Version: 1.1.0
4
+ Summary: Lightweight terminal utilities
5
+ Author: SuperDragon777
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 SuperDragon777
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/SuperDragon777/tooly
29
+ Keywords: terminal,cli,colors,spinner,developer-tools
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Operating System :: OS Independent
33
+ Classifier: Environment :: Console
34
+ Classifier: Topic :: Terminals
35
+ Requires-Python: >=3.8
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Dynamic: license-file
39
+
40
+ # tooly
41
+
42
+ Lightweight terminal utilities for Python developers.
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install tooly-dev
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ ```python
53
+ import tooly
54
+ import time
55
+
56
+ colors = tooly.ColorSystem() # recommended
57
+ wait_time = 0.5
58
+
59
+ print(colors.info("Welcome to Tooly!")) # Color example
60
+
61
+ tooly.typewrite(colors.info("Example text"), delay=0.05) # Typewrite example
62
+
63
+ with tooly.measure("Example measure"):
64
+ # Do something
65
+ time.sleep(wait_time)
66
+
67
+ with tooly.spinner("Example spinner", done_msg="Exaple spinner done"):
68
+ #Do something
69
+ time.sleep(wait_time)
70
+
71
+ text = "Some interesting text with keywords"
72
+ print(colors.highlight(text, ["keywords", "text"], "yellow")) # text, keywords, color
73
+
74
+ # You can use indent for file tree for exaple
75
+ print(colors.indent("Example folder/", 0))
76
+ print(colors.indent("Example python file", 1))
77
+ print(colors.indent("Example readme file", 1))
78
+ print(colors.indent("Example subfolder/", 1))
79
+ print(colors.indent("howtodoerrors.txt", 2))
80
+ print(colors.indent("Example file", 0))
81
+ ```
82
+
83
+ ## License
84
+
85
+ MIT
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ tooly.py
5
+ tooly_dev.egg-info/PKG-INFO
6
+ tooly_dev.egg-info/SOURCES.txt
7
+ tooly_dev.egg-info/dependency_links.txt
8
+ tooly_dev.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ tooly