fated 0.2.2__tar.gz → 0.3.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.
Files changed (30) hide show
  1. fated-0.3.0/PKG-INFO +455 -0
  2. fated-0.3.0/README.md +434 -0
  3. {fated-0.2.2 → fated-0.3.0}/fate/__init__.py +11 -1
  4. {fated-0.2.2 → fated-0.3.0}/fate/__pycache__/__init__.cpython-311.pyc +0 -0
  5. fated-0.3.0/fate/__pycache__/interactive.cpython-311.pyc +0 -0
  6. fated-0.3.0/fate/__pycache__/utils.cpython-311.pyc +0 -0
  7. fated-0.3.0/fate/interactive.py +249 -0
  8. {fated-0.2.2 → fated-0.3.0}/fate/utils.py +4 -0
  9. fated-0.3.0/fated.egg-info/PKG-INFO +455 -0
  10. {fated-0.2.2 → fated-0.3.0}/fated.egg-info/SOURCES.txt +2 -0
  11. {fated-0.2.2 → fated-0.3.0}/pyproject.toml +1 -1
  12. fated-0.2.2/PKG-INFO +0 -129
  13. fated-0.2.2/README.md +0 -108
  14. fated-0.2.2/fate/__pycache__/utils.cpython-311.pyc +0 -0
  15. fated-0.2.2/fated.egg-info/PKG-INFO +0 -129
  16. {fated-0.2.2 → fated-0.3.0}/LICENSE +0 -0
  17. {fated-0.2.2 → fated-0.3.0}/MANIFEST.in +0 -0
  18. {fated-0.2.2 → fated-0.3.0}/fate/__init__.py.bak +0 -0
  19. {fated-0.2.2 → fated-0.3.0}/fate/__pycache__/animation.cpython-311.pyc +0 -0
  20. {fated-0.2.2 → fated-0.3.0}/fate/__pycache__/effects.cpython-311.pyc +0 -0
  21. {fated-0.2.2 → fated-0.3.0}/fate/__pycache__/styles.cpython-311.pyc +0 -0
  22. {fated-0.2.2 → fated-0.3.0}/fate/animation.py +0 -0
  23. {fated-0.2.2 → fated-0.3.0}/fate/effects.py +0 -0
  24. {fated-0.2.2 → fated-0.3.0}/fate/shortcuts.py +0 -0
  25. {fated-0.2.2 → fated-0.3.0}/fate/styles.py +0 -0
  26. {fated-0.2.2 → fated-0.3.0}/fated.egg-info/dependency_links.txt +0 -0
  27. {fated-0.2.2 → fated-0.3.0}/fated.egg-info/requires.txt +0 -0
  28. {fated-0.2.2 → fated-0.3.0}/fated.egg-info/top_level.txt +0 -0
  29. {fated-0.2.2 → fated-0.3.0}/setup.cfg +0 -0
  30. {fated-0.2.2 → fated-0.3.0}/setup.py +0 -0
fated-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,455 @@
1
+ Metadata-Version: 2.4
2
+ Name: fated
3
+ Version: 0.3.0
4
+ Summary: A Python library for adding visual effects to terminal text output
5
+ Author-email: Fred <fredised@users.noreply.github.com>
6
+ Project-URL: Homepage, https://github.com/fredised/fated
7
+ Project-URL: Bug Tracker, https://github.com/fredised/fated/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Classifier: Topic :: Text Processing :: General
13
+ Classifier: Intended Audience :: Developers
14
+ Requires-Python: >=3.7
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: build>=1.1.1
18
+ Requires-Dist: setuptools>=68.0.0
19
+ Requires-Dist: twine>=4.0.2
20
+ Dynamic: license-file
21
+
22
+ # Fated - Text Effects Library for Python
23
+
24
+ ![Version](https://img.shields.io/pypi/v/fated)
25
+ ![Python Version](https://img.shields.io/pypi/pyversions/fated)
26
+ ![License](https://img.shields.io/github/license/fredised/fated)
27
+
28
+ Fated is a Python library that adds visual effects to text output including typewriter animation and other text styling options. It provides a simple API for creating rich, animated terminal text with no external dependencies.
29
+
30
+ Make your terminal applications more engaging with smooth animations, colorful text, and eye-catching effects!
31
+
32
+ ## Features
33
+
34
+ - **Text Animation Effects**: Typewriter, blink, fade-in, wave, glitch, shake, matrix, and more
35
+ - **Text Styling**: Colors, background colors, bold, italic, underline, and other text styles
36
+ - **Chainable Effects**: Combine multiple effects together seamlessly
37
+ - **Simple API**: Intuitive interface that works with standard print function
38
+ - **Alternative Syntax**: Use the + operator with shortcut objects for even cleaner code
39
+ - **Interactive Components**: Progress bars, menus, typing prompts, and loading animations
40
+ - **No Dependencies**: Uses only Python standard library modules
41
+ - **Cross-Platform**: Works on Windows, macOS, and Linux terminals that support ANSI escape codes
42
+
43
+ ## Installation
44
+
45
+ Install directly from PyPI using pip:
46
+
47
+ ```bash
48
+ pip install fated
49
+ ```
50
+
51
+ For the latest version with bug fixes:
52
+
53
+ ```bash
54
+ pip install fated==0.2.2
55
+ ```
56
+
57
+ Alternative installation methods:
58
+
59
+ 1. Clone the repository and include the `fate` folder in your project:
60
+
61
+ ```bash
62
+ git clone https://github.com/fredised/fated.git
63
+ ```
64
+
65
+ 2. Or simply copy the `fate` directory to your project.
66
+
67
+ ## Getting Started
68
+
69
+ 1. Install the library:
70
+ ```bash
71
+ pip install fated
72
+ ```
73
+
74
+ 2. Create a new Python file (e.g., `demo.py`):
75
+ ```python
76
+ from fate import typewriter, color, style
77
+
78
+ # Try a simple typewriter effect
79
+ print(typewriter("Hello, World!"))
80
+
81
+ # Add some color
82
+ print(color.green("Success!"))
83
+
84
+ # Combine effects
85
+ print(style.bold(color.blue("Important information")))
86
+ ```
87
+
88
+ 3. Run your script:
89
+ ```bash
90
+ python demo.py
91
+ ```
92
+
93
+ 4. Explore other effects in the documentation below!
94
+
95
+ ## Compatibility
96
+
97
+ Fated works best in terminals that support ANSI escape codes:
98
+ - Modern versions of Windows Terminal, PowerShell, and cmd.exe
99
+ - macOS Terminal, iTerm2
100
+ - Linux terminals (GNOME Terminal, Konsole, xterm, etc.)
101
+ - VS Code integrated terminal
102
+ - Jupyter notebooks (results may vary)
103
+
104
+ ## Usage
105
+
106
+ ### Traditional Syntax
107
+
108
+ ```python
109
+ from fate import typewriter, color, style
110
+
111
+ # Simple typewriter effect
112
+ print(typewriter("Hello, World!"))
113
+
114
+ # Colored text
115
+ print(color.red("This text is red"))
116
+ print(color.blue("This text is blue"))
117
+ print(color.rgb(255, 128, 0)("Custom orange text"))
118
+
119
+ # Text styling
120
+ print(style.bold("Bold text"))
121
+ print(style.italic("Italic text"))
122
+ print(style.underline("Underlined text"))
123
+
124
+ # Background colors
125
+ print(color.bg.yellow("Text with yellow background"))
126
+ print(color.bg.rgb(0, 128, 128)("Custom teal background"))
127
+
128
+ # Chain multiple effects
129
+ print(style.bold(color.green(typewriter("Bold green typewriter text"))))
130
+
131
+ # Predefined combinations
132
+ from fate import error, warning, success, info
133
+ print(error("Error message"))
134
+ print(warning("Warning message"))
135
+ print(success("Success message"))
136
+ print(info("Information message"))
137
+ ```
138
+
139
+ ### Shortcut Syntax (New!)
140
+
141
+ ```python
142
+ from fate.shortcuts import fateTypeWriter, fateRed, fateBold, fateBgYellow
143
+
144
+ # Use the + operator
145
+ print(fateTypeWriter + "Hello, World!")
146
+
147
+ # Colored text
148
+ print(fateRed + "This text is red")
149
+
150
+ # Text styling
151
+ print(fateBold + "Bold text")
152
+
153
+ # Background colors
154
+ print(fateBgYellow + "Text with yellow background")
155
+
156
+ # Combine shortcuts (in order from right to left)
157
+ print(fateBold + fateRed + "Bold red text")
158
+
159
+ # Custom parameters
160
+ print(fateTypeWriter(speed=20) + "Fast typing!")
161
+ print(fateGlitch(intensity=5, duration=2.0) + "Intense glitching effect")
162
+
163
+ # Predefined combinations
164
+ from fate.shortcuts import fateError, fateSuccess, fateWarning, fateInfo
165
+ print(fateError + "Error message")
166
+ print(fateWarning + "Warning message")
167
+ print(fateSuccess + "Success message")
168
+ print(fateInfo + "Information message")
169
+ ```
170
+
171
+ ### Practical Applications
172
+
173
+ ```python
174
+ from fate import typewriter, color, style
175
+ import time
176
+
177
+ # Create an interactive CLI application with styled output
178
+ def interactive_cli():
179
+ print(style.bold(color.blue("Welcome to My App!")))
180
+ time.sleep(0.5)
181
+
182
+ print(typewriter("Loading settings..."))
183
+ time.sleep(1)
184
+ print(color.green("✓ Settings loaded successfully"))
185
+
186
+ user_input = input(color.yellow("Enter your name: "))
187
+ print(typewriter(f"Hello, {style.bold(user_input)}! Nice to meet you."))
188
+
189
+ # Password input with masked animation
190
+ from fate import reveal_masked
191
+ password = input("Enter password: ")
192
+ print("Verifying: ", end="")
193
+ print(reveal_masked("*" * len(password)))
194
+ print(color.green("✓ Access granted"))
195
+ ```
196
+
197
+ ## Examples
198
+
199
+ The repository includes example files:
200
+
201
+ - `examples.py` - Comprehensive demonstration of all effects with traditional syntax
202
+ - `shortcut_example.py` - Basic demonstration of the new shortcut syntax
203
+ - `shortcut_demo.py` - Interactive demonstration of various shortcut combinations
204
+ - `interactive_example.py` - Showcases the interactive components (menus, progress bars, etc.)
205
+ - `test_fix.py` - Test script for verifying the typewriter effect fix
206
+
207
+ Run the examples to see the library in action:
208
+
209
+ ```bash
210
+ # Full demonstration with traditional syntax
211
+ python examples.py
212
+
213
+ # Demonstration of the shortcut syntax
214
+ python shortcut_example.py
215
+
216
+ # Interactive demonstration with various combinations
217
+ python shortcut_demo.py
218
+
219
+ # Interactive components demonstration
220
+ python interactive_example.py
221
+ ```
222
+
223
+ ## Available Effects
224
+
225
+ ### Text Animation Effects
226
+
227
+ - `typewriter` - Types text character by character
228
+ - `blink` - Makes text blink
229
+ - `fade_in` - Gradually reveals text
230
+ - `wave` - Creates a wave-like animation
231
+ - `glitch` - Creates a glitchy, distorted effect
232
+ - `shake` - Shakes the text
233
+ - `rainbow` - Cycles through rainbow colors
234
+ - `typing_with_errors` - Realistic typing with random errors
235
+ - `matrix_effect` - Matrix-like falling character effect
236
+ - `slide_in` - Slides text in from left or right
237
+ - `reveal_masked` - Reveals masked text character by character
238
+
239
+ ### Colors
240
+
241
+ - Standard colors: `red`, `green`, `blue`, `yellow`, `magenta`, `cyan`, `white`, `black`
242
+ - Bright variants: `bright_red`, `bright_green`, `bright_blue`, etc.
243
+ - Custom colors: `color.rgb(r, g, b)` - Create custom colors using RGB values (0-255)
244
+
245
+ ### Background Colors
246
+
247
+ Available through the `color.bg` namespace:
248
+ - Standard backgrounds: `bg.red`, `bg.green`, `bg.blue`, etc.
249
+ - Bright variants: `bg.bright_red`, `bg.bright_green`, etc.
250
+ - Custom backgrounds: `color.bg.rgb(r, g, b)` - Create custom background colors
251
+
252
+ ### Text Styles
253
+
254
+ - `bold` - Bold text
255
+ - `italic` - Italic text (not supported in all terminals)
256
+ - `underline` - Underlined text
257
+ - `dim` - Dimmed text
258
+ - `reverse` - Reversed colors (swaps foreground and background)
259
+ - `strike` - Strikethrough text (not supported in all terminals)
260
+
261
+ ### Predefined Combinations
262
+
263
+ - `error` - Red text with typewriter effect (for error messages)
264
+ - `warning` - Yellow text with blink effect (for warnings)
265
+ - `success` - Green text with fade-in effect (for success messages)
266
+ - `info` - Blue text with glitch effect (for information messages)
267
+
268
+ ### Interactive Components
269
+
270
+ - `progress_bar` - Display an animated progress bar
271
+ - `typing_prompt` - Show a typewriter-animated prompt and get user input
272
+ - `menu` - Display an interactive menu with styled options
273
+ - `loading_animation` - Show a simple loading animation
274
+ - `countdown` - Display a countdown timer
275
+
276
+ ## Advanced Usage
277
+
278
+ ### Interactive Components
279
+
280
+ The library includes interactive components for building command-line interfaces:
281
+
282
+ ```python
283
+ from fate import color, style
284
+ from fate import progress_bar, typing_prompt, menu, loading_animation, countdown
285
+
286
+ # Display an animated progress bar
287
+ progress_bar(
288
+ total=20, # Total number of steps
289
+ prefix="Processing:", # Text before the bar
290
+ suffix="Complete", # Text after the bar
291
+ color_func=color.green, # Color function to apply
292
+ delay=0.1 # Delay between updates
293
+ )
294
+
295
+ # Display a typewriter-animated prompt and get user input
296
+ name = typing_prompt(
297
+ prompt="What is your name? ",
298
+ typing_speed=15,
299
+ prompt_color=color.yellow
300
+ )
301
+ print(f"Hello, {style.bold(name)}!")
302
+
303
+ # Display an interactive menu
304
+ options = ["Option 1", "Option 2", "Option 3", "Exit"]
305
+ choice = menu(
306
+ title="Select an Option",
307
+ options=options,
308
+ title_style=style.bold,
309
+ option_style=color.cyan,
310
+ animate=True
311
+ )
312
+ print(f"You selected: {options[choice]}")
313
+
314
+ # Show a loading animation
315
+ loading_animation(
316
+ message="Connecting to server",
317
+ duration=3.0,
318
+ color_func=color.green
319
+ )
320
+
321
+ # Display a countdown timer
322
+ countdown(
323
+ seconds=5,
324
+ prefix="Starting in",
325
+ suffix="seconds",
326
+ color_func=color.yellow
327
+ )
328
+ ```
329
+
330
+ ### Custom Animation Parameters
331
+
332
+ Most effects accept parameters to customize their behavior:
333
+
334
+ ```python
335
+ # Customize typewriter effect
336
+ print(typewriter("Slow typing...", speed=5)) # Slower typing (5 chars/sec)
337
+ print(typewriter("Fast typing!", speed=30)) # Faster typing (30 chars/sec)
338
+
339
+ # Customize blink effect
340
+ print(blink("More blinks", count=5, speed=3)) # 5 blinks at 3 blinks/sec
341
+
342
+ # Customize glitch effect
343
+ print(glitch("Intense glitching", intensity=5, duration=2.0)) # More characters affected
344
+
345
+ # Customize wave effect
346
+ print(wave("Long wave effect", cycles=4, speed=15)) # 4 cycles at 15 frames/sec
347
+ ```
348
+
349
+ ### Creating Custom Effects
350
+
351
+ You can create your own custom effects by combining existing effects or writing new animation functions:
352
+
353
+ ```python
354
+ from fate import create_effect, animate_text
355
+ import random
356
+ import time
357
+
358
+ @create_effect
359
+ def jumble(text, iterations=5, speed=10):
360
+ """
361
+ Custom effect that jumbles characters randomly before settling.
362
+
363
+ Args:
364
+ text: The text to animate
365
+ iterations: Number of random jumbles
366
+ speed: Speed of animation
367
+
368
+ Returns:
369
+ The original text after animation
370
+ """
371
+ def render_frame(content, step):
372
+ if step >= iterations:
373
+ return content
374
+
375
+ jumbled = list(content)
376
+ # Jumble some characters
377
+ for i in range(min(step + 1, len(jumbled))):
378
+ idx = random.randint(0, len(jumbled) - 1)
379
+ if jumbled[idx].isalpha():
380
+ jumbled[idx] = chr(random.randint(65, 90) if jumbled[idx].isupper() else random.randint(97, 122))
381
+
382
+ return ''.join(jumbled)
383
+
384
+ return animate_text(text, render_func=render_frame, delay=1/speed)
385
+
386
+ # Use your custom effect
387
+ print(jumble("Custom jumble effect"))
388
+ ```
389
+
390
+ ## Troubleshooting
391
+
392
+ ### Colors or effects not displaying correctly?
393
+
394
+ 1. Make sure your terminal supports ANSI escape codes
395
+ 2. On Windows, try using Windows Terminal or PowerShell instead of old cmd.exe
396
+ 3. Check if your terminal settings have ANSI color support enabled
397
+ 4. If running in a custom environment, ensure it interprets escape sequences correctly
398
+
399
+ ### Performance issues with long animations?
400
+
401
+ For very long texts or slow terminals, you can:
402
+ 1. Increase the animation speed parameter
403
+ 2. Break text into smaller chunks
404
+ 3. Use simpler effects for large text blocks
405
+
406
+ ### Text appearing twice or animation issues?
407
+
408
+ If you encounter any issues with text appearing twice during animations or other visual glitches:
409
+ 1. Make sure you're using the latest version (0.2.2 or later)
410
+ 2. Try setting `print_final=False` if available in the effect function
411
+ 3. Ensure you're not printing the result multiple times
412
+
413
+ ## Contributing
414
+
415
+ Contributions are welcome! Here's how you can help:
416
+
417
+ 1. Report bugs or request features by opening an issue
418
+ 2. Improve documentation
419
+ 3. Add new effects or styles
420
+ 4. Fix bugs or optimize existing code
421
+ 5. Add tests or examples
422
+
423
+ ### Development Setup
424
+
425
+ ```bash
426
+ # Clone the repository
427
+ git clone https://github.com/fredised/fated.git
428
+ cd fated
429
+
430
+ # Install development dependencies
431
+ pip install -e .
432
+ ```
433
+
434
+ ### Pull Request Process
435
+
436
+ 1. Fork the repository
437
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
438
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
439
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
440
+ 5. Open a Pull Request
441
+
442
+ ## License
443
+
444
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
445
+
446
+ ## Acknowledgments
447
+
448
+ - Inspired by various text animation libraries and demos
449
+ - Thanks to all contributors who have helped improve this library
450
+
451
+ ---
452
+
453
+ <p align="center">
454
+ Made with ❤️ by <a href="https://github.com/fredised">Fred</a>
455
+ </p>