anvil-atui 0.1.5__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 Davozen
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,227 @@
1
+ Metadata-Version: 2.4
2
+ Name: anvil-atui
3
+ Version: 0.1.5
4
+ Summary: Console output manager with spinners, progress bars, and styled UI
5
+ License: MIT
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Dynamic: license-file
10
+
11
+ # Anvil
12
+
13
+ ![Anvil](anvil.png)
14
+
15
+ Styled console output for Python. Zero dependencies.
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ pip install anvil-atui
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```python
26
+ from anvil import console as ui
27
+ ```
28
+
29
+ ## Messages
30
+
31
+ ```python
32
+ ui.info("loading config")
33
+ # → loading config
34
+
35
+ ui.success("done")
36
+ # ✓ done
37
+
38
+ ui.warning("file is outdated")
39
+ # ! file is outdated
40
+
41
+ ui.error("connection failed")
42
+ # ✗ connection failed
43
+
44
+ ui.step("intermediate step")
45
+ # · intermediate step
46
+
47
+ ui.debug("value x = 42") # only when verbose=True
48
+ # · value x = 42
49
+ ```
50
+
51
+ ## Sections
52
+
53
+ ```python
54
+ ui.title("Setup")
55
+
56
+ with ui.section("Check dependencies"):
57
+ ui.step("python3")
58
+ ui.step("git")
59
+
60
+ # output:
61
+ # ─────────────────────────
62
+ # Setup
63
+ # ─────────────────────────
64
+ # Check dependencies
65
+ # · python3
66
+ # · git
67
+ ```
68
+
69
+ ## Spinner
70
+
71
+ ```python
72
+ with ui.spinner("connecting to server") as sp:
73
+ connect()
74
+ sp.set_final("connected")
75
+
76
+ # output during work:
77
+ # ⟳ connecting to server
78
+
79
+ # output after completion:
80
+ # ✓ connected
81
+ ```
82
+
83
+ ## Progress
84
+
85
+ ```python
86
+ files = ["a.txt", "b.txt", "c.txt"]
87
+ with ui.progress("copying files", total=len(files)) as bar:
88
+ for i, f in enumerate(files, 1):
89
+ copy(f)
90
+ bar.update(i)
91
+
92
+ # output:
93
+ # copying files ████████░░░░░░░░░░░░░░░░ 50% (2/3)
94
+ ```
95
+
96
+ ## Task
97
+
98
+ ```python
99
+ with ui.task("Compile project"):
100
+ build()
101
+
102
+ # output on success:
103
+ # ✓ Compile project (2.3s)
104
+
105
+ # output on failure:
106
+ # ✗ Compile project
107
+ # ✗ connection failed
108
+ ```
109
+
110
+ ## Numbered steps
111
+
112
+ ```python
113
+ steps = ["Download", "Extract", "Check", "Install"]
114
+ for i, name in enumerate(steps, 1):
115
+ with ui.numbered_step(i, len(steps), name):
116
+ do_step(i)
117
+
118
+ # output:
119
+ # [1/4] Download
120
+ # [2/4] Extract
121
+ # [3/4] Check
122
+ # [4/4] Install
123
+ ```
124
+
125
+ ## Info block
126
+
127
+ ```python
128
+ ui.info_block("my-package", {"mp3": 12, "txt": 3}, footer="total 15 files")
129
+
130
+ # output:
131
+ # ─────────────────────────
132
+ # my-package
133
+ # mp3 12 · txt 3
134
+ # total 15 files
135
+ # ─────────────────────────
136
+ ```
137
+
138
+ ## Table
139
+
140
+ ```python
141
+ ui.table(["File", "Size", "Status"], [
142
+ ["a.mp3", "3.2 MB", "ok"],
143
+ ["b.txt", "1 KB", "ok"],
144
+ ])
145
+
146
+ # output:
147
+ # File Size Status
148
+ # ─────────────────────────
149
+ # a.mp3 3.2 MB ok
150
+ # b.txt 1 KB ok
151
+ ```
152
+
153
+ ## Box
154
+
155
+ ```python
156
+ ui.box("Warning: action cannot be undone!", style="warn")
157
+
158
+ # output:
159
+ # ┌──────────────────────────┐
160
+ # │ Warning: action cannot be undone! │
161
+ # └──────────────────────────┘
162
+ ```
163
+
164
+ ## Input
165
+
166
+ ```python
167
+ name = ui.ask("Enter name", default="guest")
168
+ # Enter name [guest]: →
169
+
170
+ ok = ui.confirm("Continue?", default=True)
171
+ # Continue? [Y/n]: →
172
+
173
+ choice = ui.select("Environment", ["dev", "staging", "prod"])
174
+ # Environment
175
+ # 1) dev
176
+ # 2) staging
177
+ # 3) prod
178
+ # Your choice [1-3, default 1]: →
179
+
180
+ secret = ui.password("Access token")
181
+ # Access token: →
182
+ ```
183
+
184
+ ## Timer
185
+
186
+ ```python
187
+ with ui.timer("full run"):
188
+ do_everything()
189
+
190
+ # output:
191
+ # · full run: 12.5s
192
+ ```
193
+
194
+ ## Run wrapper
195
+
196
+ ```python
197
+ def main():
198
+ ...
199
+
200
+ if __name__ == "__main__":
201
+ ui.run(main)
202
+ ```
203
+
204
+ Catches Ctrl+C and unhandled exceptions. Exits with code 130 on interrupt, 1 on error.
205
+
206
+ ## Environment
207
+
208
+ | Variable | Effect |
209
+ |----------|--------|
210
+ | `NO_COLOR=1` | No color |
211
+ | `NO_MOTION=1` | No animation |
212
+ | No TTY | Animation disabled |
213
+ | No truecolor | 16-color fallback |
214
+ | No UTF-8 | ASCII fallback |
215
+
216
+ ## Singleton
217
+
218
+ ```python
219
+ from anvil import console, get_manager
220
+
221
+ ui = console
222
+ ui = get_manager()
223
+ ```
224
+
225
+ ## License
226
+
227
+ MIT - see [LICENSE](LICENSE).
@@ -0,0 +1,217 @@
1
+ # Anvil
2
+
3
+ ![Anvil](anvil.png)
4
+
5
+ Styled console output for Python. Zero dependencies.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install anvil-atui
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```python
16
+ from anvil import console as ui
17
+ ```
18
+
19
+ ## Messages
20
+
21
+ ```python
22
+ ui.info("loading config")
23
+ # → loading config
24
+
25
+ ui.success("done")
26
+ # ✓ done
27
+
28
+ ui.warning("file is outdated")
29
+ # ! file is outdated
30
+
31
+ ui.error("connection failed")
32
+ # ✗ connection failed
33
+
34
+ ui.step("intermediate step")
35
+ # · intermediate step
36
+
37
+ ui.debug("value x = 42") # only when verbose=True
38
+ # · value x = 42
39
+ ```
40
+
41
+ ## Sections
42
+
43
+ ```python
44
+ ui.title("Setup")
45
+
46
+ with ui.section("Check dependencies"):
47
+ ui.step("python3")
48
+ ui.step("git")
49
+
50
+ # output:
51
+ # ─────────────────────────
52
+ # Setup
53
+ # ─────────────────────────
54
+ # Check dependencies
55
+ # · python3
56
+ # · git
57
+ ```
58
+
59
+ ## Spinner
60
+
61
+ ```python
62
+ with ui.spinner("connecting to server") as sp:
63
+ connect()
64
+ sp.set_final("connected")
65
+
66
+ # output during work:
67
+ # ⟳ connecting to server
68
+
69
+ # output after completion:
70
+ # ✓ connected
71
+ ```
72
+
73
+ ## Progress
74
+
75
+ ```python
76
+ files = ["a.txt", "b.txt", "c.txt"]
77
+ with ui.progress("copying files", total=len(files)) as bar:
78
+ for i, f in enumerate(files, 1):
79
+ copy(f)
80
+ bar.update(i)
81
+
82
+ # output:
83
+ # copying files ████████░░░░░░░░░░░░░░░░ 50% (2/3)
84
+ ```
85
+
86
+ ## Task
87
+
88
+ ```python
89
+ with ui.task("Compile project"):
90
+ build()
91
+
92
+ # output on success:
93
+ # ✓ Compile project (2.3s)
94
+
95
+ # output on failure:
96
+ # ✗ Compile project
97
+ # ✗ connection failed
98
+ ```
99
+
100
+ ## Numbered steps
101
+
102
+ ```python
103
+ steps = ["Download", "Extract", "Check", "Install"]
104
+ for i, name in enumerate(steps, 1):
105
+ with ui.numbered_step(i, len(steps), name):
106
+ do_step(i)
107
+
108
+ # output:
109
+ # [1/4] Download
110
+ # [2/4] Extract
111
+ # [3/4] Check
112
+ # [4/4] Install
113
+ ```
114
+
115
+ ## Info block
116
+
117
+ ```python
118
+ ui.info_block("my-package", {"mp3": 12, "txt": 3}, footer="total 15 files")
119
+
120
+ # output:
121
+ # ─────────────────────────
122
+ # my-package
123
+ # mp3 12 · txt 3
124
+ # total 15 files
125
+ # ─────────────────────────
126
+ ```
127
+
128
+ ## Table
129
+
130
+ ```python
131
+ ui.table(["File", "Size", "Status"], [
132
+ ["a.mp3", "3.2 MB", "ok"],
133
+ ["b.txt", "1 KB", "ok"],
134
+ ])
135
+
136
+ # output:
137
+ # File Size Status
138
+ # ─────────────────────────
139
+ # a.mp3 3.2 MB ok
140
+ # b.txt 1 KB ok
141
+ ```
142
+
143
+ ## Box
144
+
145
+ ```python
146
+ ui.box("Warning: action cannot be undone!", style="warn")
147
+
148
+ # output:
149
+ # ┌──────────────────────────┐
150
+ # │ Warning: action cannot be undone! │
151
+ # └──────────────────────────┘
152
+ ```
153
+
154
+ ## Input
155
+
156
+ ```python
157
+ name = ui.ask("Enter name", default="guest")
158
+ # Enter name [guest]: →
159
+
160
+ ok = ui.confirm("Continue?", default=True)
161
+ # Continue? [Y/n]: →
162
+
163
+ choice = ui.select("Environment", ["dev", "staging", "prod"])
164
+ # Environment
165
+ # 1) dev
166
+ # 2) staging
167
+ # 3) prod
168
+ # Your choice [1-3, default 1]: →
169
+
170
+ secret = ui.password("Access token")
171
+ # Access token: →
172
+ ```
173
+
174
+ ## Timer
175
+
176
+ ```python
177
+ with ui.timer("full run"):
178
+ do_everything()
179
+
180
+ # output:
181
+ # · full run: 12.5s
182
+ ```
183
+
184
+ ## Run wrapper
185
+
186
+ ```python
187
+ def main():
188
+ ...
189
+
190
+ if __name__ == "__main__":
191
+ ui.run(main)
192
+ ```
193
+
194
+ Catches Ctrl+C and unhandled exceptions. Exits with code 130 on interrupt, 1 on error.
195
+
196
+ ## Environment
197
+
198
+ | Variable | Effect |
199
+ |----------|--------|
200
+ | `NO_COLOR=1` | No color |
201
+ | `NO_MOTION=1` | No animation |
202
+ | No TTY | Animation disabled |
203
+ | No truecolor | 16-color fallback |
204
+ | No UTF-8 | ASCII fallback |
205
+
206
+ ## Singleton
207
+
208
+ ```python
209
+ from anvil import console, get_manager
210
+
211
+ ui = console
212
+ ui = get_manager()
213
+ ```
214
+
215
+ ## License
216
+
217
+ MIT - see [LICENSE](LICENSE).
@@ -0,0 +1,3 @@
1
+ from anvil.console import ConsoleManager, Progress, Spinner, console, get_manager
2
+
3
+ __all__ = ["ConsoleManager", "Progress", "Spinner", "console", "get_manager"]