thothspinner 1.2.4__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.
Files changed (31) hide show
  1. thothspinner-1.2.4/PKG-INFO +502 -0
  2. thothspinner-1.2.4/README.md +472 -0
  3. thothspinner-1.2.4/pyproject.toml +92 -0
  4. thothspinner-1.2.4/src/thothspinner/__browse__.py +114 -0
  5. thothspinner-1.2.4/src/thothspinner/__init__.py +31 -0
  6. thothspinner-1.2.4/src/thothspinner/__main__.py +92 -0
  7. thothspinner-1.2.4/src/thothspinner/core/__init__.py +8 -0
  8. thothspinner-1.2.4/src/thothspinner/core/color.py +36 -0
  9. thothspinner-1.2.4/src/thothspinner/core/states.py +48 -0
  10. thothspinner-1.2.4/src/thothspinner/py.typed +0 -0
  11. thothspinner-1.2.4/src/thothspinner/rich/__init__.py +21 -0
  12. thothspinner-1.2.4/src/thothspinner/rich/components/__init__.py +17 -0
  13. thothspinner-1.2.4/src/thothspinner/rich/components/base.py +43 -0
  14. thothspinner-1.2.4/src/thothspinner/rich/components/hint.py +196 -0
  15. thothspinner-1.2.4/src/thothspinner/rich/components/message.py +600 -0
  16. thothspinner-1.2.4/src/thothspinner/rich/components/progress.py +197 -0
  17. thothspinner-1.2.4/src/thothspinner/rich/components/spinner.py +313 -0
  18. thothspinner-1.2.4/src/thothspinner/rich/components/state.py +16 -0
  19. thothspinner-1.2.4/src/thothspinner/rich/components/timer.py +271 -0
  20. thothspinner-1.2.4/src/thothspinner/rich/context.py +65 -0
  21. thothspinner-1.2.4/src/thothspinner/rich/spinners/__init__.py +7 -0
  22. thothspinner-1.2.4/src/thothspinner/rich/spinners/frames.py +224 -0
  23. thothspinner-1.2.4/src/thothspinner/rich/thothspinner.py +984 -0
  24. thothspinner-1.2.4/src/thothspinner/textual/__init__.py +25 -0
  25. thothspinner-1.2.4/src/thothspinner/textual/widgets/__init__.py +19 -0
  26. thothspinner-1.2.4/src/thothspinner/textual/widgets/hint.py +268 -0
  27. thothspinner-1.2.4/src/thothspinner/textual/widgets/message.py +525 -0
  28. thothspinner-1.2.4/src/thothspinner/textual/widgets/progress.py +459 -0
  29. thothspinner-1.2.4/src/thothspinner/textual/widgets/spinner.py +378 -0
  30. thothspinner-1.2.4/src/thothspinner/textual/widgets/thothspinner.py +909 -0
  31. thothspinner-1.2.4/src/thothspinner/textual/widgets/timer.py +431 -0
@@ -0,0 +1,502 @@
1
+ Metadata-Version: 2.4
2
+ Name: thothspinner
3
+ Version: 1.2.4
4
+ Summary: A highly configurable progress indicator library for Python with Rich and Textual support
5
+ Keywords: spinner,progress,terminal,cli,rich,textual,animation,loading,progress-bar,tui
6
+ Author: Steve Morin
7
+ Author-email: Steve Morin <steve.morin@gmail.com>
8
+ License-Expression: MIT
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Terminals
19
+ Classifier: Topic :: System :: Monitoring
20
+ Classifier: Typing :: Typed
21
+ Requires-Dist: rich>=13
22
+ Requires-Dist: textual>=6.1.0
23
+ Requires-Python: >=3.11
24
+ Project-URL: Homepage, https://github.com/smorin/thothspinner
25
+ Project-URL: Repository, https://github.com/smorin/thothspinner
26
+ Project-URL: Documentation, https://github.com/smorin/thothspinner/blob/main/docs/thothspinner_rich.md
27
+ Project-URL: Changelog, https://github.com/smorin/thothspinner/blob/main/CHANGELOG.md
28
+ Project-URL: Bug Tracker, https://github.com/smorin/thothspinner/issues
29
+ Description-Content-Type: text/markdown
30
+
31
+ # ThothSpinner
32
+
33
+ [![PyPI version](https://img.shields.io/pypi/v/thothspinner.svg)](https://pypi.org/project/thothspinner/)
34
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
35
+ [![Rich](https://img.shields.io/badge/rich-14.1+-green.svg)](https://github.com/Textualize/rich)
36
+ [![Coverage](https://img.shields.io/badge/coverage-97%25+-brightgreen.svg)](htmlcov/index.html)
37
+ [![Documentation](https://img.shields.io/badge/docs-comprehensive-blue.svg)](docs/thothspinner_rich.md)
38
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
39
+
40
+ A highly configurable progress indicator library for Python, built on Rich. ThothSpinner provides beautiful, composable terminal UI components including spinners, progress bars, timers, and animated messages with shimmer effects.
41
+
42
+ ## Demo
43
+
44
+ ![ThothSpinner demo](docs/images/demo.gif)
45
+
46
+ ## ✨ Features
47
+
48
+ - 🎨 **Modular Components**: Mix and match spinner, progress, timer, message, and hint components
49
+ - πŸ”„ **State Management**: Built-in success/error states with automatic transitions
50
+ - ✨ **Shimmer Effects**: Eye-catching animation effects for messages
51
+ - 🎯 **Thread-Safe**: Proper locking for concurrent operations
52
+ - πŸš€ **Performance Optimized**: Efficient rendering with minimal CPU usage
53
+ - 🎭 **Rich Integration**: Seamless integration with Rich Console and Live displays
54
+ - πŸ“Ί **Textual Support**: Native Textual widgets with reactive state management
55
+
56
+ ## πŸ“š Documentation
57
+
58
+ - **[Rich API Reference](docs/thothspinner_rich.md)** - Complete API documentation for Rich components
59
+ - **[Textual API Reference](docs/thothspinner_textual.md)** - Textual widget documentation
60
+ - **[Examples Gallery](docs/examples/README.md)** - Runnable Rich examples
61
+ - **[Textual Examples](docs/examples/TEXTUAL_README.md)** - Textual application examples
62
+ - **[Rich to Textual Guide](docs/rich_to_textual_guide.md)** - Migration guide
63
+ - **[Troubleshooting Guide](docs/troubleshooting.md)** - Solutions to common issues
64
+ - **[Release Guide](RELEASE.md)** - Build, publish, and CI/CD architecture
65
+ - **[First-Time Publish Guide](PUBLISH.md)** - Step-by-step v1.0.0 PyPI publish walkthrough
66
+
67
+ ## πŸš€ Quick Start
68
+
69
+ ### Setup
70
+
71
+ ```bash
72
+ # Install from PyPI
73
+ pip install thothspinner
74
+ # or with uv (recommended)
75
+ uv add thothspinner
76
+ ```
77
+
78
+ ### Explore Spinner Styles
79
+
80
+ ![ThothSpinner Style Browser](docs/images/thoth-spinner-style-browser.png)
81
+
82
+ ```bash
83
+ # Preview all 48 spinner styles in the terminal
84
+ thothspinner preview
85
+
86
+ # Preview a specific style
87
+ thothspinner preview npm_dots
88
+
89
+ # Open interactive TUI style browser
90
+ thothspinner browse
91
+ ```
92
+
93
+ ### Basic Usage
94
+
95
+ ```python
96
+ from thothspinner import ThothSpinner
97
+ from rich.console import Console
98
+ from rich.live import Live
99
+ import time
100
+
101
+ console = Console()
102
+
103
+ # Simple usage with all components
104
+ with Live(ThothSpinner(), console=console) as live:
105
+ spinner = live.renderable
106
+ spinner.start()
107
+
108
+ # Simulate work with progress
109
+ for i in range(100):
110
+ spinner.update_progress(current=i, total=100)
111
+ time.sleep(0.05)
112
+
113
+ spinner.success("Task completed!")
114
+ ```
115
+
116
+ ### Textual Quick Start
117
+
118
+ ```python
119
+ from textual.app import App, ComposeResult
120
+ from thothspinner.textual import TextualThothSpinner
121
+ import asyncio
122
+
123
+ class MyApp(App):
124
+ def compose(self) -> ComposeResult:
125
+ yield TextualThothSpinner(
126
+ spinner_style="npm_dots",
127
+ message_text="Processing data",
128
+ message_shimmer=True,
129
+ )
130
+
131
+ async def on_mount(self) -> None:
132
+ spinner = self.query_one(TextualThothSpinner)
133
+ spinner.start()
134
+ await asyncio.sleep(2)
135
+ spinner.success("Done!")
136
+
137
+ MyApp().run()
138
+ ```
139
+
140
+ ### Run the Examples
141
+
142
+ ```bash
143
+ # Run all examples (Rich + Textual)
144
+ just examples
145
+
146
+ # Or run by category
147
+ just examples-thothspinner # Rich ThothSpinner examples
148
+ just examples-textual # Textual widget examples
149
+
150
+ # Or run individual examples
151
+ just example-thothspinner-basic
152
+ just example-thothspinner-full
153
+ just example-progress
154
+ just example-timer
155
+ just example-message
156
+ just example-message-shimmer
157
+ ```
158
+
159
+ ## πŸ“¦ Installation
160
+
161
+ ### Prerequisites
162
+ - Python 3.11+
163
+ - [uv](https://docs.astral.sh/uv/) package manager (recommended)
164
+ - [just](https://github.com/casey/just) command runner (optional)
165
+
166
+ ### Install from Source
167
+
168
+ ```bash
169
+ # Clone the repository
170
+ git clone https://github.com/smorin/thothspinner.git
171
+ cd thothspinner
172
+
173
+ # Install with uv (recommended)
174
+ uv sync
175
+
176
+ # Or with pip
177
+ pip install -e .
178
+ ```
179
+
180
+ ### Install from PyPI
181
+
182
+ ```bash
183
+ pip install thothspinner
184
+
185
+ # Or with uv (recommended)
186
+ uv add thothspinner
187
+ ```
188
+
189
+ ## 🎯 Available Components
190
+
191
+ ### Core Components
192
+
193
+ - **SpinnerComponent**: Animated spinners with multiple styles (npm_dots, claude_stars, etc.)
194
+ - **ProgressComponent**: Progress counters with various formats (percentage, fraction, etc.)
195
+ - **TimerComponent**: Elapsed time display with flexible formatting
196
+ - **MessageComponent**: Rotating action words with shimmer effects
197
+ - **HintComponent**: Static hint text for instructions
198
+ - **ThothSpinner**: Orchestrator that combines all components
199
+
200
+ ### Example Usage
201
+
202
+ ```python
203
+ from thothspinner import ThothSpinner
204
+ from thothspinner.rich.components import SpinnerComponent, ProgressComponent
205
+
206
+ # Individual components
207
+ spinner = SpinnerComponent(style="claude_stars", color="#FFA500")
208
+ progress = ProgressComponent(format={"style": "percentage"}, color="#00FF00")
209
+
210
+ # Or use the orchestrator for everything
211
+ spinner = ThothSpinner(
212
+ spinner_style="npm_dots",
213
+ message_text="Processing data", # initial rotating message text
214
+ message_shimmer=True,
215
+ progress_format="percentage",
216
+ timer_format="auto",
217
+ hint_text="(esc to cancel)"
218
+ )
219
+ ```
220
+
221
+ `set_message()` updates the current rotating message text. Use
222
+ `set_message_pinned()` only when you explicitly want a non-rotating message.
223
+
224
+ ### Configuration
225
+
226
+ ThothSpinner supports both kwargs and dictionary configuration:
227
+
228
+ ```python
229
+ # Using kwargs
230
+ spinner = ThothSpinner(
231
+ spinner_style="claude_stars",
232
+ message_shimmer=True,
233
+ success_duration=2.0 # Auto-clear after 2 seconds
234
+ )
235
+
236
+ # Using configuration dictionary
237
+ config = {
238
+ "defaults": {"color": "#D97706"},
239
+ "elements": {
240
+ "spinner": {"style": "npm_dots"},
241
+ "message": {"shimmer": {"enabled": True, "width": 3}},
242
+ "progress": {"format": {"style": "percentage"}}
243
+ },
244
+ "states": {
245
+ "success": {
246
+ "spinner": {"icon": "βœ“", "color": "#00FF00"},
247
+ "message": {"text": "Complete!"}
248
+ }
249
+ }
250
+ }
251
+ spinner = ThothSpinner.from_dict(config)
252
+ ```
253
+
254
+ ## πŸ› οΈ Development
255
+
256
+ ### Project Structure
257
+
258
+ ```
259
+ thothspinner/
260
+ β”œβ”€β”€ src/thothspinner/ # Source code
261
+ β”‚ β”œβ”€β”€ rich/ # Rich-based components
262
+ β”‚ β”‚ β”œβ”€β”€ components/ # Individual components
263
+ β”‚ β”‚ └── thothspinner.py # Main orchestrator
264
+ β”‚ └── textual/ # Textual widgets
265
+ β”œβ”€β”€ tests/ # Test suite (97%+ coverage)
266
+ β”œβ”€β”€ docs/ # Documentation
267
+ β”‚ β”œβ”€β”€ thothspinner_rich.md # Rich API reference
268
+ β”‚ β”œβ”€β”€ thothspinner_textual.md # Textual API reference
269
+ β”‚ β”œβ”€β”€ examples/ # Example scripts
270
+ β”‚ └── troubleshooting.md # Troubleshooting guide
271
+ β”œβ”€β”€ examples/ # Demo scripts
272
+ β”œβ”€β”€ justfile # Task automation
273
+ └── pyproject.toml # Project configuration
274
+ ```
275
+
276
+ ### Development Commands
277
+
278
+ ```bash
279
+ # Format code
280
+ just format
281
+
282
+ # Lint code
283
+ just lint
284
+
285
+ # Type check
286
+ just typecheck
287
+
288
+ # Run tests with coverage
289
+ just test-cov
290
+
291
+ # Security scan (bandit)
292
+ just security
293
+
294
+ # Generate changelog (git-cliff)
295
+ just changelog
296
+
297
+ # Version management
298
+ just current-version
299
+ just bump-patch
300
+ just bump-minor
301
+ just bump-major
302
+
303
+ # Regenerate visual regression snapshots
304
+ just update-snapshots
305
+
306
+ # Run all checks (format, lint, typecheck, security, test)
307
+ just all
308
+
309
+ # Clean build artifacts
310
+ just clean
311
+ ```
312
+
313
+ ### CLI Tools
314
+
315
+ ```bash
316
+ # Preview all 48 spinner styles
317
+ uv run thothspinner preview
318
+
319
+ # Preview a specific style
320
+ uv run thothspinner preview npm_dots
321
+
322
+ # Open interactive TUI style browser
323
+ uv run thothspinner browse
324
+ ```
325
+
326
+ ### Generating the Demo GIF
327
+
328
+ ```bash
329
+ # Install GIF generation tools (macOS only, one-time)
330
+ just install-readme-animation
331
+
332
+ # Generate demo.gif
333
+ just demo-gif
334
+
335
+ # Verify it looks right
336
+ open docs/images/demo.gif
337
+
338
+ # Commit and push
339
+ git add docs/images/demo.gif
340
+ git commit -m "docs: add demo.gif for README"
341
+ git push origin main
342
+ ```
343
+
344
+ ### Testing
345
+
346
+ The project maintains 97%+ test coverage, including visual regression tests via `pytest-textual-snapshot`:
347
+
348
+ ```bash
349
+ # Run tests
350
+ just test
351
+
352
+ # Run tests with coverage report
353
+ just test-cov
354
+ # Coverage report generated at htmlcov/index.html
355
+
356
+ # Run specific test file
357
+ just test tests/rich/test_spinner.py
358
+
359
+ # Regenerate visual regression snapshots (Textual widgets)
360
+ just update-snapshots
361
+ ```
362
+
363
+ ## πŸ“– Examples
364
+
365
+ ### Basic Progress Bar
366
+
367
+ ```python
368
+ from thothspinner import ThothSpinner
369
+ from rich.live import Live
370
+
371
+ with Live(ThothSpinner()) as live:
372
+ spinner = live.renderable
373
+ spinner.start()
374
+
375
+ for i in range(100):
376
+ spinner.update_progress(current=i, total=100)
377
+ time.sleep(0.05)
378
+
379
+ spinner.success()
380
+ ```
381
+
382
+ ### File Processing
383
+
384
+ ```python
385
+ from pathlib import Path
386
+
387
+ files = list(Path(".").glob("*.py"))
388
+ spinner = ThothSpinner(progress_format="fraction")
389
+
390
+ with Live(spinner) as live:
391
+ spinner.start()
392
+
393
+ for i, file in enumerate(files):
394
+ spinner.set_message(text=f"Processing {file.name}") # rotating message update
395
+ spinner.update_progress(current=i, total=len(files))
396
+ process_file(file)
397
+
398
+ spinner.success(f"Processed {len(files)} files")
399
+ ```
400
+
401
+ ### Error Handling
402
+
403
+ ```python
404
+ with Live(ThothSpinner()) as live:
405
+ spinner = live.renderable
406
+ spinner.start()
407
+
408
+ try:
409
+ risky_operation()
410
+ spinner.success("Operation successful")
411
+ except Exception as e:
412
+ spinner.error(f"Operation failed: {e}")
413
+ ```
414
+
415
+ More examples in the [Examples Gallery](docs/examples/README.md).
416
+
417
+ ## πŸ—ΊοΈ Roadmap
418
+
419
+ ### Completed Milestones
420
+
421
+ βœ… **M01–M05: Core Rich Components** (v0.1.0–v0.5.0)
422
+ - Hint, Spinner, Progress, Timer, and Message components
423
+ - ThothSpinner orchestrator with state management
424
+ - 97%+ test coverage, thread-safe operations with proper locking
425
+
426
+ βœ… **M06: Rich Documentation** (v0.6.0)
427
+ - Comprehensive API reference, examples gallery with 20+ examples, troubleshooting guide
428
+
429
+ βœ… **M07–M13: Textual Components & Documentation** (v0.7.0–v0.13.0)
430
+ - Full Textual widget set with reactive state management
431
+ - Feature parity with all Rich components
432
+ - Textual examples, integration guides, and API reference
433
+
434
+ βœ… **M15: Progress Bar Format & Animation Smoothing** (v1.1.0)
435
+ - Bar format style for Textual ProgressWidget with configurable fill characters
436
+ - Smooth animated transitions when progress values change
437
+
438
+ βœ… **M14: Publishing to PyPI** (v1.0.0)
439
+ - PyPI package publication with OIDC trusted publishing
440
+ - GitHub Actions CI/CD pipeline (test matrix, CodeQL, publish)
441
+ - Release automation with git-cliff changelog generation
442
+
443
+ ### Releasing
444
+
445
+ **First time?** Follow the **[First-Time Publish Guide](PUBLISH.md)** for step-by-step OIDC setup and the v1.0.0 publish walkthrough.
446
+
447
+ For subsequent releases, see the **[Release Guide](RELEASE.md)**. Quick reference:
448
+
449
+ ```bash
450
+ # 1. Bump version (pick one), then run checks and commit:
451
+ just bump-patch # or bump-minor / bump-major
452
+ just all # format, lint, typecheck, security, test β€” must all pass
453
+ git add pyproject.toml
454
+ git commit -m "chore: release v1.2.3"
455
+ git push origin main
456
+
457
+ # 2. Tag and publish (auto-generates changelog, builds, tags, pushes β†’ triggers CI β†’ PyPI)
458
+ just release 1.2.3
459
+ ```
460
+
461
+ Releases are published automatically via OIDC trusted publishing β€” no API tokens required. See [RELEASE.md](RELEASE.md) for OIDC setup, CI/CD pipeline details, and troubleshooting.
462
+
463
+ ## 🀝 Contributing
464
+
465
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for full details. Quick summary:
466
+
467
+ 1. Check the [MILESTONES.md](MILESTONES.md) for current tasks
468
+ 2. Follow the established code patterns
469
+ 3. Maintain test coverage above 90%
470
+ 4. Use the development toolchain (just commands)
471
+ 5. Write tests for new features
472
+ 6. Update documentation as needed
473
+
474
+ For milestone-specific work, reference tasks in the milestone documents (M01.md, M02.md, etc.).
475
+
476
+ ### Zero-Setup with GitHub Codespaces
477
+
478
+ A `.devcontainer` config is included β€” open in Codespaces or VS Code Dev Containers for an instant, pre-configured development environment.
479
+
480
+ ## πŸ“„ License
481
+
482
+ MIT License - See [LICENSE](LICENSE) file for details.
483
+
484
+ ## πŸ™ Acknowledgments
485
+
486
+ - Built on the excellent [Rich](https://github.com/Textualize/rich) and [Textual](https://github.com/Textualize/textual) libraries by Will McGugan
487
+ - Inspired by various terminal UI libraries including ora, cli-spinners, and progress
488
+ - Name inspired by Thoth, ancient Egyptian deity of wisdom and writing
489
+ - Development patterns influenced by Rich's battle-tested implementation
490
+
491
+ ## πŸ’¬ Support
492
+
493
+ For issues, questions, or suggestions:
494
+
495
+ - πŸ“ [Open an issue](https://github.com/smorin/thothspinner/issues) on GitHub
496
+ - πŸ“š Check the [Documentation](docs/thothspinner_rich.md)
497
+ - πŸ” Review the [Troubleshooting Guide](docs/troubleshooting.md)
498
+ - πŸ“§ Contact the maintainers
499
+
500
+ ---
501
+
502
+ **Current Version:** 1.0.0 | **Python:** 3.11+ | **Coverage:** 97%+ | **[Rich Docs](docs/thothspinner_rich.md)** | **[Textual Docs](docs/thothspinner_textual.md)**