typio 0.0.0__tar.gz → 0.1__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.
- typio-0.1/AUTHORS.md +12 -0
- typio-0.1/CHANGELOG.md +23 -0
- typio-0.1/LICENSE +21 -0
- typio-0.1/MANIFEST.in +6 -0
- typio-0.1/PKG-INFO +209 -0
- typio-0.1/README.md +137 -0
- typio-0.1/SECURITY.md +14 -0
- typio-0.1/dev-requirements.txt +6 -0
- typio-0.1/setup.py +73 -0
- typio-0.1/tests/test_errors.py +60 -0
- typio-0.1/tests/test_functions.py +88 -0
- typio-0.1/typio/__init__.py +7 -0
- typio-0.1/typio/__main__.py +5 -0
- typio-0.1/typio/errors.py +8 -0
- typio-0.1/typio/functions.py +237 -0
- typio-0.1/typio/params.py +24 -0
- typio-0.1/typio.egg-info/PKG-INFO +209 -0
- typio-0.1/typio.egg-info/SOURCES.txt +20 -0
- typio-0.1/typio.egg-info/top_level.txt +1 -0
- typio-0.0.0/PKG-INFO +0 -38
- typio-0.0.0/README.md +0 -4
- typio-0.0.0/__init__.py +0 -2
- typio-0.0.0/setup.py +0 -47
- typio-0.0.0/typio.egg-info/PKG-INFO +0 -38
- typio-0.0.0/typio.egg-info/SOURCES.txt +0 -7
- /typio-0.0.0/typio.egg-info/dependency_links.txt → /typio-0.1/requirements.txt +0 -0
- {typio-0.0.0 → typio-0.1}/setup.cfg +0 -0
- /typio-0.0.0/typio.egg-info/top_level.txt → /typio-0.1/typio.egg-info/dependency_links.txt +0 -0
typio-0.1/AUTHORS.md
ADDED
typio-0.1/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
## [0.1] - 2026-01-31
|
|
9
|
+
### Added
|
|
10
|
+
- `type_print` function
|
|
11
|
+
- `typestyle` decorator
|
|
12
|
+
- `CHAR` mode
|
|
13
|
+
- `WORD` mode
|
|
14
|
+
- `LINE` mode
|
|
15
|
+
- `SENTENCE` mode
|
|
16
|
+
- `TYPEWRITER` mode
|
|
17
|
+
- `ADAPTIVE` mode
|
|
18
|
+
|
|
19
|
+
[Unreleased]: https://github.com/sepandhaghighi/typio/compare/v0.1...dev
|
|
20
|
+
[0.1]: https://github.com/sepandhaghighi/typio/compare/750c00e...v0.1
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
typio-0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sepand Haghighi
|
|
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.
|
typio-0.1/MANIFEST.in
ADDED
typio-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: typio
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Typio: Make Your Terminal Type Like a Human
|
|
5
|
+
Home-page: https://github.com/sepandhaghighi/typio
|
|
6
|
+
Download-URL: https://github.com/sepandhaghighi/typio/tarball/v0.1
|
|
7
|
+
Author: Sepand Haghighi
|
|
8
|
+
Author-email: me@sepand.tech
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Source, https://github.com/sepandhaghighi/typio
|
|
11
|
+
Keywords: terminal cli typing typewriter typing-effect console stdout ux
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Intended Audience :: Developers
|
|
24
|
+
Classifier: Intended Audience :: Education
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
26
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Classifier: Topic :: Utilities
|
|
29
|
+
Classifier: Topic :: Terminals
|
|
30
|
+
Requires-Python: >=3.8
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
License-File: AUTHORS.md
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: author-email
|
|
36
|
+
Dynamic: classifier
|
|
37
|
+
Dynamic: description
|
|
38
|
+
Dynamic: description-content-type
|
|
39
|
+
Dynamic: download-url
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: keywords
|
|
42
|
+
Dynamic: license
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
Dynamic: project-url
|
|
45
|
+
Dynamic: requires-python
|
|
46
|
+
Dynamic: summary
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div align="center">
|
|
50
|
+
<img src="https://github.com/sepandhaghighi/typio/raw/main/otherfiles/logo.png" width="320">
|
|
51
|
+
<h1>Typio: Make Your Terminal Type Like a Human</h1>
|
|
52
|
+
<br/>
|
|
53
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
|
|
54
|
+
<a href="https://github.com/sepandhaghighi/typio"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/sepandhaghighi/typio"></a>
|
|
55
|
+
<a href="https://badge.fury.io/py/typio"><img src="https://badge.fury.io/py/typio.svg" alt="PyPI version"></a>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
## Overview
|
|
59
|
+
|
|
60
|
+
<p align="justify">
|
|
61
|
+
Typio is a lightweight Python library that prints text to the terminal as if it were being typed by a human. It supports multiple typing modes (character, word, line, sentence, typewriter, and adaptive), configurable delays and jitter for natural variation, and seamless integration with existing code via a simple function or a decorator. Typio is designed to be minimal, extensible, and safe, making it ideal for demos, CLIs, tutorials, and storytelling in the terminal.
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
<table>
|
|
65
|
+
<tr>
|
|
66
|
+
<td align="center">PyPI Counter</td>
|
|
67
|
+
<td align="center"><a href="http://pepy.tech/project/typio"><img src="http://pepy.tech/badge/typio"></a></td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td align="center">Github Stars</td>
|
|
71
|
+
<td align="center"><a href="https://github.com/sepandhaghighi/typio"><img src="https://img.shields.io/github/stars/sepandhaghighi/typio.svg?style=social&label=Stars"></a></td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
<table>
|
|
78
|
+
<tr>
|
|
79
|
+
<td align="center">Branch</td>
|
|
80
|
+
<td align="center">main</td>
|
|
81
|
+
<td align="center">dev</td>
|
|
82
|
+
</tr>
|
|
83
|
+
<tr>
|
|
84
|
+
<td align="center">CI</td>
|
|
85
|
+
<td align="center"><img src="https://github.com/sepandhaghighi/typio/actions/workflows/test.yml/badge.svg?branch=main"></td>
|
|
86
|
+
<td align="center"><img src="https://github.com/sepandhaghighi/typio/actions/workflows/test.yml/badge.svg?branch=dev"></td>
|
|
87
|
+
</tr>
|
|
88
|
+
</table>
|
|
89
|
+
|
|
90
|
+
## Installation
|
|
91
|
+
|
|
92
|
+
### Source Code
|
|
93
|
+
- Download [Version 0.1](https://github.com/sepandhaghighi/typio/archive/v0.1.zip) or [Latest Source](https://github.com/sepandhaghighi/typio/archive/dev.zip)
|
|
94
|
+
- `pip install .`
|
|
95
|
+
|
|
96
|
+
### PyPI
|
|
97
|
+
|
|
98
|
+
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
99
|
+
- `pip install typio==0.1`
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
### Function
|
|
105
|
+
|
|
106
|
+
Use `type_print` function to print text with human-like typing effects. You can control the typing speed, randomness, mode, and output stream.
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from typio import type_print
|
|
110
|
+
from typio import TypeMode
|
|
111
|
+
|
|
112
|
+
type_print("Hello, world!")
|
|
113
|
+
|
|
114
|
+
type_print(
|
|
115
|
+
"Typing with style and personality.",
|
|
116
|
+
delay=0.06,
|
|
117
|
+
jitter=0.02,
|
|
118
|
+
mode=TypeMode.ADAPTIVE,
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
You can also redirect the output to any file-like object:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
with open("output.txt", "w") as file:
|
|
126
|
+
type_print("Saved with typing effects.", file=file)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Decorator
|
|
130
|
+
|
|
131
|
+
Use the `@typestyle` decorator to apply typing effects to all `print` calls inside a function, without changing the function's implementation.
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from typio import typestyle
|
|
135
|
+
from typio import TypeMode
|
|
136
|
+
|
|
137
|
+
@typestyle(delay=0.05, mode=TypeMode.TYPEWRITER)
|
|
138
|
+
def intro():
|
|
139
|
+
print("Welcome to Typio.")
|
|
140
|
+
print("Every print is typed.")
|
|
141
|
+
|
|
142
|
+
intro()
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Issues & Bug Reports
|
|
146
|
+
|
|
147
|
+
Just fill an issue and describe it. We'll check it ASAP!
|
|
148
|
+
|
|
149
|
+
- Please complete the issue template
|
|
150
|
+
|
|
151
|
+
## Show Your Support
|
|
152
|
+
|
|
153
|
+
<h3>Star This Repo</h3>
|
|
154
|
+
|
|
155
|
+
Give a ⭐️ if this project helped you!
|
|
156
|
+
|
|
157
|
+
<h3>Donate to Our Project</h3>
|
|
158
|
+
|
|
159
|
+
<h4>Bitcoin</h4>
|
|
160
|
+
1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy
|
|
161
|
+
<h4>Ethereum</h4>
|
|
162
|
+
0xcD4Db18B6664A9662123D4307B074aE968535388
|
|
163
|
+
<h4>Litecoin</h4>
|
|
164
|
+
Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ
|
|
165
|
+
<h4>Doge</h4>
|
|
166
|
+
DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh
|
|
167
|
+
<h4>Tron</h4>
|
|
168
|
+
TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7
|
|
169
|
+
<h4>Ripple</h4>
|
|
170
|
+
rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq
|
|
171
|
+
<h4>Binance Coin</h4>
|
|
172
|
+
bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef
|
|
173
|
+
<h4>Tether</h4>
|
|
174
|
+
0xcD4Db18B6664A9662123D4307B074aE968535388
|
|
175
|
+
<h4>Dash</h4>
|
|
176
|
+
Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s
|
|
177
|
+
<h4>Stellar</h4>
|
|
178
|
+
GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL
|
|
179
|
+
<h4>Zilliqa</h4>
|
|
180
|
+
zil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5
|
|
181
|
+
<h4>Coffeete</h4>
|
|
182
|
+
<a href="http://www.coffeete.ir/opensource">
|
|
183
|
+
<img src="http://www.coffeete.ir/images/buttons/lemonchiffon.png" style="width:260px;" />
|
|
184
|
+
</a>
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# Changelog
|
|
188
|
+
All notable changes to this project will be documented in this file.
|
|
189
|
+
|
|
190
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
191
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
192
|
+
|
|
193
|
+
## [Unreleased]
|
|
194
|
+
## [0.1] - 2026-01-31
|
|
195
|
+
### Added
|
|
196
|
+
- `type_print` function
|
|
197
|
+
- `typestyle` decorator
|
|
198
|
+
- `CHAR` mode
|
|
199
|
+
- `WORD` mode
|
|
200
|
+
- `LINE` mode
|
|
201
|
+
- `SENTENCE` mode
|
|
202
|
+
- `TYPEWRITER` mode
|
|
203
|
+
- `ADAPTIVE` mode
|
|
204
|
+
|
|
205
|
+
[Unreleased]: https://github.com/sepandhaghighi/typio/compare/v0.1...dev
|
|
206
|
+
[0.1]: https://github.com/sepandhaghighi/typio/compare/750c00e...v0.1
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
typio-0.1/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://github.com/sepandhaghighi/typio/raw/main/otherfiles/logo.png" width="320">
|
|
3
|
+
<h1>Typio: Make Your Terminal Type Like a Human</h1>
|
|
4
|
+
<br/>
|
|
5
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
|
|
6
|
+
<a href="https://github.com/sepandhaghighi/typio"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/sepandhaghighi/typio"></a>
|
|
7
|
+
<a href="https://badge.fury.io/py/typio"><img src="https://badge.fury.io/py/typio.svg" alt="PyPI version"></a>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
<p align="justify">
|
|
13
|
+
Typio is a lightweight Python library that prints text to the terminal as if it were being typed by a human. It supports multiple typing modes (character, word, line, sentence, typewriter, and adaptive), configurable delays and jitter for natural variation, and seamless integration with existing code via a simple function or a decorator. Typio is designed to be minimal, extensible, and safe, making it ideal for demos, CLIs, tutorials, and storytelling in the terminal.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<table>
|
|
17
|
+
<tr>
|
|
18
|
+
<td align="center">PyPI Counter</td>
|
|
19
|
+
<td align="center"><a href="http://pepy.tech/project/typio"><img src="http://pepy.tech/badge/typio"></a></td>
|
|
20
|
+
</tr>
|
|
21
|
+
<tr>
|
|
22
|
+
<td align="center">Github Stars</td>
|
|
23
|
+
<td align="center"><a href="https://github.com/sepandhaghighi/typio"><img src="https://img.shields.io/github/stars/sepandhaghighi/typio.svg?style=social&label=Stars"></a></td>
|
|
24
|
+
</tr>
|
|
25
|
+
</table>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<table>
|
|
30
|
+
<tr>
|
|
31
|
+
<td align="center">Branch</td>
|
|
32
|
+
<td align="center">main</td>
|
|
33
|
+
<td align="center">dev</td>
|
|
34
|
+
</tr>
|
|
35
|
+
<tr>
|
|
36
|
+
<td align="center">CI</td>
|
|
37
|
+
<td align="center"><img src="https://github.com/sepandhaghighi/typio/actions/workflows/test.yml/badge.svg?branch=main"></td>
|
|
38
|
+
<td align="center"><img src="https://github.com/sepandhaghighi/typio/actions/workflows/test.yml/badge.svg?branch=dev"></td>
|
|
39
|
+
</tr>
|
|
40
|
+
</table>
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
### Source Code
|
|
45
|
+
- Download [Version 0.1](https://github.com/sepandhaghighi/typio/archive/v0.1.zip) or [Latest Source](https://github.com/sepandhaghighi/typio/archive/dev.zip)
|
|
46
|
+
- `pip install .`
|
|
47
|
+
|
|
48
|
+
### PyPI
|
|
49
|
+
|
|
50
|
+
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
51
|
+
- `pip install typio==0.1`
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
### Function
|
|
57
|
+
|
|
58
|
+
Use `type_print` function to print text with human-like typing effects. You can control the typing speed, randomness, mode, and output stream.
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from typio import type_print
|
|
62
|
+
from typio import TypeMode
|
|
63
|
+
|
|
64
|
+
type_print("Hello, world!")
|
|
65
|
+
|
|
66
|
+
type_print(
|
|
67
|
+
"Typing with style and personality.",
|
|
68
|
+
delay=0.06,
|
|
69
|
+
jitter=0.02,
|
|
70
|
+
mode=TypeMode.ADAPTIVE,
|
|
71
|
+
)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
You can also redirect the output to any file-like object:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
with open("output.txt", "w") as file:
|
|
78
|
+
type_print("Saved with typing effects.", file=file)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Decorator
|
|
82
|
+
|
|
83
|
+
Use the `@typestyle` decorator to apply typing effects to all `print` calls inside a function, without changing the function's implementation.
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from typio import typestyle
|
|
87
|
+
from typio import TypeMode
|
|
88
|
+
|
|
89
|
+
@typestyle(delay=0.05, mode=TypeMode.TYPEWRITER)
|
|
90
|
+
def intro():
|
|
91
|
+
print("Welcome to Typio.")
|
|
92
|
+
print("Every print is typed.")
|
|
93
|
+
|
|
94
|
+
intro()
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Issues & Bug Reports
|
|
98
|
+
|
|
99
|
+
Just fill an issue and describe it. We'll check it ASAP!
|
|
100
|
+
|
|
101
|
+
- Please complete the issue template
|
|
102
|
+
|
|
103
|
+
## Show Your Support
|
|
104
|
+
|
|
105
|
+
<h3>Star This Repo</h3>
|
|
106
|
+
|
|
107
|
+
Give a ⭐️ if this project helped you!
|
|
108
|
+
|
|
109
|
+
<h3>Donate to Our Project</h3>
|
|
110
|
+
|
|
111
|
+
<h4>Bitcoin</h4>
|
|
112
|
+
1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy
|
|
113
|
+
<h4>Ethereum</h4>
|
|
114
|
+
0xcD4Db18B6664A9662123D4307B074aE968535388
|
|
115
|
+
<h4>Litecoin</h4>
|
|
116
|
+
Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ
|
|
117
|
+
<h4>Doge</h4>
|
|
118
|
+
DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh
|
|
119
|
+
<h4>Tron</h4>
|
|
120
|
+
TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7
|
|
121
|
+
<h4>Ripple</h4>
|
|
122
|
+
rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq
|
|
123
|
+
<h4>Binance Coin</h4>
|
|
124
|
+
bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef
|
|
125
|
+
<h4>Tether</h4>
|
|
126
|
+
0xcD4Db18B6664A9662123D4307B074aE968535388
|
|
127
|
+
<h4>Dash</h4>
|
|
128
|
+
Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s
|
|
129
|
+
<h4>Stellar</h4>
|
|
130
|
+
GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL
|
|
131
|
+
<h4>Zilliqa</h4>
|
|
132
|
+
zil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5
|
|
133
|
+
<h4>Coffeete</h4>
|
|
134
|
+
<a href="http://www.coffeete.ir/opensource">
|
|
135
|
+
<img src="http://www.coffeete.ir/images/buttons/lemonchiffon.png" style="width:260px;" />
|
|
136
|
+
</a>
|
|
137
|
+
|
typio-0.1/SECURITY.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------------- | ------------------ |
|
|
7
|
+
| 0.1 | :white_check_mark: |
|
|
8
|
+
| < 0.1 | :x: |
|
|
9
|
+
|
|
10
|
+
## Reporting a Vulnerability
|
|
11
|
+
|
|
12
|
+
Please report security vulnerabilities by email to [me@sepand.tech](mailto:me@sepand.tech "me@sepand.tech").
|
|
13
|
+
|
|
14
|
+
If the security vulnerability is accepted, a dedicated bugfix release will be issued as soon as possible (depending on the complexity of the fix).
|
typio-0.1/setup.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Setup module."""
|
|
3
|
+
from typing import List
|
|
4
|
+
try:
|
|
5
|
+
from setuptools import setup
|
|
6
|
+
except ImportError:
|
|
7
|
+
from distutils.core import setup
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_requires() -> List[str]:
|
|
11
|
+
"""Read requirements.txt."""
|
|
12
|
+
requirements = open("requirements.txt", "r").read()
|
|
13
|
+
return list(filter(lambda x: x != "", requirements.split()))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def read_description() -> str:
|
|
17
|
+
"""Read README.md and CHANGELOG.md."""
|
|
18
|
+
try:
|
|
19
|
+
with open("README.md") as r:
|
|
20
|
+
description = "\n"
|
|
21
|
+
description += r.read()
|
|
22
|
+
with open("CHANGELOG.md") as c:
|
|
23
|
+
description += "\n"
|
|
24
|
+
description += c.read()
|
|
25
|
+
return description
|
|
26
|
+
except Exception:
|
|
27
|
+
return '''Typio is a lightweight Python library that prints text to the terminal as if it were being typed by a human.
|
|
28
|
+
It supports multiple typing modes (character, word, line, sentence, typewriter, and adaptive),
|
|
29
|
+
configurable delays and jitter for natural variation, and seamless integration with existing code
|
|
30
|
+
via a simple function or a decorator. Typio is designed to be minimal, extensible, and safe,
|
|
31
|
+
making it ideal for demos, CLIs, tutorials, and storytelling in the terminal.'''
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
setup(
|
|
35
|
+
name='typio',
|
|
36
|
+
packages=['typio'],
|
|
37
|
+
version='0.1',
|
|
38
|
+
description='Typio: Make Your Terminal Type Like a Human',
|
|
39
|
+
long_description=read_description(),
|
|
40
|
+
long_description_content_type='text/markdown',
|
|
41
|
+
include_package_data=True,
|
|
42
|
+
author='Sepand Haghighi',
|
|
43
|
+
author_email='me@sepand.tech',
|
|
44
|
+
url='https://github.com/sepandhaghighi/typio',
|
|
45
|
+
download_url='https://github.com/sepandhaghighi/typio/tarball/v0.1',
|
|
46
|
+
keywords="terminal cli typing typewriter typing-effect console stdout ux",
|
|
47
|
+
project_urls={
|
|
48
|
+
'Source': 'https://github.com/sepandhaghighi/typio'
|
|
49
|
+
},
|
|
50
|
+
install_requires=get_requires(),
|
|
51
|
+
python_requires='>=3.8',
|
|
52
|
+
classifiers=[
|
|
53
|
+
'Development Status :: 3 - Alpha',
|
|
54
|
+
'Natural Language :: English',
|
|
55
|
+
'License :: OSI Approved :: MIT License',
|
|
56
|
+
'Operating System :: OS Independent',
|
|
57
|
+
'Programming Language :: Python :: 3.8',
|
|
58
|
+
'Programming Language :: Python :: 3.9',
|
|
59
|
+
'Programming Language :: Python :: 3.10',
|
|
60
|
+
'Programming Language :: Python :: 3.11',
|
|
61
|
+
'Programming Language :: Python :: 3.12',
|
|
62
|
+
'Programming Language :: Python :: 3.13',
|
|
63
|
+
'Programming Language :: Python :: 3.14',
|
|
64
|
+
'Intended Audience :: Developers',
|
|
65
|
+
'Intended Audience :: Education',
|
|
66
|
+
'Topic :: Software Development :: Libraries',
|
|
67
|
+
'Topic :: Software Development :: User Interfaces',
|
|
68
|
+
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
69
|
+
'Topic :: Utilities',
|
|
70
|
+
'Topic :: Terminals',
|
|
71
|
+
],
|
|
72
|
+
license='MIT',
|
|
73
|
+
)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import pytest
|
|
3
|
+
|
|
4
|
+
from typio import type_print, typestyle
|
|
5
|
+
from typio import TypioError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_invalid_text_type():
|
|
9
|
+
with pytest.raises(TypioError, match=r"`text` must be str or bytes."):
|
|
10
|
+
type_print(123, delay=0)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_invalid_bytes():
|
|
14
|
+
with pytest.raises(TypioError, match=r"bytes text must be UTF-8 decodable."):
|
|
15
|
+
type_print(b"\xff\xff", delay=0)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_negative_delay():
|
|
19
|
+
with pytest.raises(TypioError, match=r"`delay` must be a non-negative number."):
|
|
20
|
+
type_print("test", delay=-1)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_invalid_delay_type():
|
|
24
|
+
with pytest.raises(TypioError, match=r"`delay` must be a non-negative number."):
|
|
25
|
+
type_print("test", delay="fast")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_negative_jitter():
|
|
29
|
+
with pytest.raises(TypioError, match=r"`jitter` must be a non-negative number."):
|
|
30
|
+
type_print("test", jitter=-0.1)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_invalid_jitter_type():
|
|
34
|
+
with pytest.raises(TypioError, match=r"`jitter` must be a non-negative number."):
|
|
35
|
+
type_print("test", jitter="nope")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_invalid_mode():
|
|
39
|
+
with pytest.raises(TypioError, match=r"`mode` must be a TypeMode enum value."):
|
|
40
|
+
type_print("test", mode="char")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_invalid_file():
|
|
44
|
+
with pytest.raises(TypioError, match=r"`file` must be a file-like object."):
|
|
45
|
+
type_print("test", file=123)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_typestyle_invalid_mode():
|
|
49
|
+
with pytest.raises(TypioError, match=r"`mode` must be a TypeMode enum value."):
|
|
50
|
+
typestyle(mode="char")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_typestyle_invalid_delay():
|
|
54
|
+
with pytest.raises(TypioError, match=r"`delay` must be a non-negative number."):
|
|
55
|
+
typestyle(delay=-1)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_typestyle_invalid_jitter():
|
|
59
|
+
with pytest.raises(TypioError, match=r"`jitter` must be a non-negative number."):
|
|
60
|
+
typestyle(jitter=-0.5)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import io
|
|
3
|
+
import sys
|
|
4
|
+
import unittest
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
from typio import type_print, typestyle
|
|
9
|
+
from typio import TypeMode
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_basic_print():
|
|
13
|
+
buffer = io.StringIO()
|
|
14
|
+
type_print("hello", file=buffer, delay=0)
|
|
15
|
+
unittest.TestCase().assertEqual(buffer.getvalue(), "hello")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_bytes_input():
|
|
19
|
+
buffer = io.StringIO()
|
|
20
|
+
type_print(b"hello", file=buffer, delay=0)
|
|
21
|
+
unittest.TestCase().assertEqual(buffer.getvalue(), "hello")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_word_mode():
|
|
25
|
+
buffer = io.StringIO()
|
|
26
|
+
type_print("hello world", file=buffer, delay=0, mode=TypeMode.WORD)
|
|
27
|
+
unittest.TestCase().assertEqual(buffer.getvalue(), "hello world")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_line_mode():
|
|
31
|
+
buffer = io.StringIO()
|
|
32
|
+
text = "a\nb\nc\n"
|
|
33
|
+
type_print(text, file=buffer, delay=0, mode=TypeMode.LINE)
|
|
34
|
+
unittest.TestCase().assertEqual(buffer.getvalue(), text)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_sentence_mode():
|
|
38
|
+
buffer = io.StringIO()
|
|
39
|
+
text = "Hello! How are you?"
|
|
40
|
+
type_print(text, file=buffer, delay=0, mode=TypeMode.SENTENCE)
|
|
41
|
+
unittest.TestCase().assertEqual(buffer.getvalue(), text)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_typewriter_mode():
|
|
45
|
+
buffer = io.StringIO()
|
|
46
|
+
text = "Hello\nWorld\n"
|
|
47
|
+
type_print(text, file=buffer, delay=0, mode=TypeMode.TYPEWRITER)
|
|
48
|
+
unittest.TestCase().assertEqual(buffer.getvalue(), text)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_adaptive_mode():
|
|
52
|
+
buffer = io.StringIO()
|
|
53
|
+
text = "Hello, world!"
|
|
54
|
+
type_print(text, file=buffer, delay=0, mode=TypeMode.ADAPTIVE)
|
|
55
|
+
unittest.TestCase().assertEqual(buffer.getvalue(), text)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_default_stdout_capture(capsys):
|
|
59
|
+
type_print("hello", delay=0)
|
|
60
|
+
captured = capsys.readouterr()
|
|
61
|
+
assert captured.out == "hello"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_typestyle_decorator():
|
|
65
|
+
buffer = io.StringIO()
|
|
66
|
+
old_stdout = sys.stdout
|
|
67
|
+
sys.stdout = buffer
|
|
68
|
+
|
|
69
|
+
@typestyle(delay=0, mode=TypeMode.CHAR)
|
|
70
|
+
def demo():
|
|
71
|
+
print("hello")
|
|
72
|
+
print("world")
|
|
73
|
+
|
|
74
|
+
try:
|
|
75
|
+
demo()
|
|
76
|
+
finally:
|
|
77
|
+
sys.stdout = old_stdout
|
|
78
|
+
|
|
79
|
+
assert buffer.getvalue() == "hello\nworld\n"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_typestyle_return_value():
|
|
83
|
+
@typestyle(delay=0)
|
|
84
|
+
def func():
|
|
85
|
+
print("x")
|
|
86
|
+
return 42
|
|
87
|
+
|
|
88
|
+
assert func() == 42
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""typio functions."""
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
import time
|
|
6
|
+
import random
|
|
7
|
+
import re
|
|
8
|
+
from functools import wraps
|
|
9
|
+
from io import TextIOBase
|
|
10
|
+
from typing import Any, Callable, Optional
|
|
11
|
+
from .params import TypeMode
|
|
12
|
+
from .params import INVALID_TEXT_ERROR, INVALID_BYTE_ERROR, INVALID_DELAY_ERROR
|
|
13
|
+
from .params import INVALID_JITTER_ERROR, INVALID_MODE_ERROR, INVALID_FILE_ERROR
|
|
14
|
+
from .errors import TypioError
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _validate(
|
|
18
|
+
text: Any,
|
|
19
|
+
delay: Any,
|
|
20
|
+
jitter: Any,
|
|
21
|
+
mode: Any,
|
|
22
|
+
file: Any,
|
|
23
|
+
) -> str:
|
|
24
|
+
"""
|
|
25
|
+
Validate and normalize inputs for typing operations.
|
|
26
|
+
|
|
27
|
+
:param text: text to be printed
|
|
28
|
+
:param delay: base delay (in seconds) between emitted units
|
|
29
|
+
:param jitter: random jitter added/subtracted from delay
|
|
30
|
+
:param mode: typing mode controlling emission granularity
|
|
31
|
+
:param file: output stream supporting a write() method
|
|
32
|
+
"""
|
|
33
|
+
if not isinstance(text, (str, bytes)):
|
|
34
|
+
raise TypioError(INVALID_TEXT_ERROR)
|
|
35
|
+
|
|
36
|
+
if isinstance(text, bytes):
|
|
37
|
+
try:
|
|
38
|
+
text = text.decode()
|
|
39
|
+
except Exception:
|
|
40
|
+
raise TypioError(INVALID_BYTE_ERROR)
|
|
41
|
+
|
|
42
|
+
if not isinstance(delay, (int, float)) or delay < 0:
|
|
43
|
+
raise TypioError(INVALID_DELAY_ERROR)
|
|
44
|
+
|
|
45
|
+
if not isinstance(jitter, (int, float)) or jitter < 0:
|
|
46
|
+
raise TypioError(INVALID_JITTER_ERROR)
|
|
47
|
+
|
|
48
|
+
if not isinstance(mode, TypeMode):
|
|
49
|
+
raise TypioError(INVALID_MODE_ERROR)
|
|
50
|
+
|
|
51
|
+
if file is not None and not hasattr(file, "write"):
|
|
52
|
+
raise TypioError(INVALID_FILE_ERROR)
|
|
53
|
+
|
|
54
|
+
return text
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _sleep(delay: float, jitter: float) -> None:
|
|
58
|
+
"""
|
|
59
|
+
Sleep for a given delay with optional random jitter.
|
|
60
|
+
|
|
61
|
+
:param delay: base delay (in seconds) between emitted units
|
|
62
|
+
:param jitter: random jitter added/subtracted from delay
|
|
63
|
+
"""
|
|
64
|
+
if delay <= 0:
|
|
65
|
+
return
|
|
66
|
+
if jitter:
|
|
67
|
+
delay += random.uniform(-jitter, jitter)
|
|
68
|
+
delay = max(0, delay)
|
|
69
|
+
time.sleep(delay)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class _TypioPrinter:
|
|
73
|
+
"""File-like object that emits text with typing effects."""
|
|
74
|
+
|
|
75
|
+
def __init__(self, *, delay: float, jitter: float, mode: TypeMode, out: TextIOBase) -> None:
|
|
76
|
+
"""
|
|
77
|
+
Initialize the typing printer.
|
|
78
|
+
|
|
79
|
+
:param delay: base delay (in seconds) between emitted units
|
|
80
|
+
:param jitter: random jitter added/subtracted from delay
|
|
81
|
+
:param mode: typing mode controlling emission granularity
|
|
82
|
+
:param out: underlying output stream
|
|
83
|
+
"""
|
|
84
|
+
self.delay = delay
|
|
85
|
+
self.jitter = jitter
|
|
86
|
+
self.mode = mode
|
|
87
|
+
self.out = out
|
|
88
|
+
|
|
89
|
+
def write(self, text: str) -> None:
|
|
90
|
+
"""
|
|
91
|
+
Write text using the configured typing mode.
|
|
92
|
+
|
|
93
|
+
:param text: text to be written
|
|
94
|
+
"""
|
|
95
|
+
handler = getattr(self, "_mode_{mode}".format(mode=self.mode.value))
|
|
96
|
+
handler(text)
|
|
97
|
+
|
|
98
|
+
def flush(self) -> None:
|
|
99
|
+
"""Flush the underlying output stream."""
|
|
100
|
+
self.out.flush()
|
|
101
|
+
|
|
102
|
+
def _emit(self, part: str, delay: Optional[float] = None) -> None:
|
|
103
|
+
"""
|
|
104
|
+
Emit a text fragment and apply delay.
|
|
105
|
+
|
|
106
|
+
:param part: text fragment to write
|
|
107
|
+
:param delay: optional override delay for this fragment
|
|
108
|
+
"""
|
|
109
|
+
self.out.write(part)
|
|
110
|
+
self.out.flush()
|
|
111
|
+
_sleep(delay if delay is not None else self.delay, self.jitter)
|
|
112
|
+
|
|
113
|
+
def _mode_char(self, text: str) -> None:
|
|
114
|
+
"""
|
|
115
|
+
Emit text character by character.
|
|
116
|
+
|
|
117
|
+
:param text: text to emit
|
|
118
|
+
"""
|
|
119
|
+
for c in text:
|
|
120
|
+
self._emit(c)
|
|
121
|
+
|
|
122
|
+
def _mode_word(self, text: str) -> None:
|
|
123
|
+
"""
|
|
124
|
+
Emit text word by word, preserving whitespace.
|
|
125
|
+
|
|
126
|
+
:param text: text to emit
|
|
127
|
+
"""
|
|
128
|
+
for w in re.findall(r"\S+|\s+", text):
|
|
129
|
+
self._emit(w)
|
|
130
|
+
|
|
131
|
+
def _mode_line(self, text: str) -> None:
|
|
132
|
+
"""
|
|
133
|
+
Emit text line by line.
|
|
134
|
+
|
|
135
|
+
:param text: text to emit
|
|
136
|
+
"""
|
|
137
|
+
for line in text.splitlines(True):
|
|
138
|
+
self._emit(line)
|
|
139
|
+
|
|
140
|
+
def _mode_sentence(self, text: str) -> None:
|
|
141
|
+
"""
|
|
142
|
+
Emit text character by character with longer pauses after sentence-ending punctuation.
|
|
143
|
+
|
|
144
|
+
:param text: text to emit
|
|
145
|
+
"""
|
|
146
|
+
for c in text:
|
|
147
|
+
self._emit(c)
|
|
148
|
+
if c in ".!?":
|
|
149
|
+
_sleep(self.delay * 4, self.jitter)
|
|
150
|
+
|
|
151
|
+
def _mode_typewriter(self, text: str) -> None:
|
|
152
|
+
"""
|
|
153
|
+
Emit text character by character with longer pauses after newlines.
|
|
154
|
+
|
|
155
|
+
:param text: text to emit
|
|
156
|
+
"""
|
|
157
|
+
for c in text:
|
|
158
|
+
self._emit(c)
|
|
159
|
+
if c == "\n":
|
|
160
|
+
_sleep(self.delay * 5, self.jitter)
|
|
161
|
+
|
|
162
|
+
def _mode_adaptive(self, text: str) -> None:
|
|
163
|
+
"""
|
|
164
|
+
Emit text with adaptive delays based on character type.
|
|
165
|
+
|
|
166
|
+
:param text: text to emit
|
|
167
|
+
"""
|
|
168
|
+
for c in text:
|
|
169
|
+
d = self.delay * (
|
|
170
|
+
0.3 if c.isspace()
|
|
171
|
+
else 1.5 if not c.isalnum()
|
|
172
|
+
else 1
|
|
173
|
+
)
|
|
174
|
+
self._emit(c, d)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def type_print(
|
|
178
|
+
text: str,
|
|
179
|
+
*,
|
|
180
|
+
delay: float = 0.04,
|
|
181
|
+
jitter: float = 0,
|
|
182
|
+
mode: TypeMode = TypeMode.CHAR,
|
|
183
|
+
file: Optional[TextIOBase] = None):
|
|
184
|
+
"""
|
|
185
|
+
Print text with typing effects.
|
|
186
|
+
|
|
187
|
+
:param text: text to be printed
|
|
188
|
+
:param delay: base delay (in seconds) between emitted units
|
|
189
|
+
:param jitter: random jitter added/subtracted from delay
|
|
190
|
+
:param mode: typing mode controlling emission granularity
|
|
191
|
+
:param file: output stream supporting a write() method
|
|
192
|
+
"""
|
|
193
|
+
text = _validate(text, delay, jitter, mode, file)
|
|
194
|
+
out = file or sys.stdout
|
|
195
|
+
|
|
196
|
+
printer = _TypioPrinter(
|
|
197
|
+
delay=delay,
|
|
198
|
+
jitter=jitter,
|
|
199
|
+
mode=mode,
|
|
200
|
+
out=out,
|
|
201
|
+
)
|
|
202
|
+
printer.write(text)
|
|
203
|
+
printer.flush()
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def typestyle(
|
|
207
|
+
*,
|
|
208
|
+
delay: float = 0.04,
|
|
209
|
+
jitter: float = 0,
|
|
210
|
+
mode: TypeMode = TypeMode.CHAR) -> Callable:
|
|
211
|
+
"""
|
|
212
|
+
Apply typing effects to all print() calls inside the decorated function.
|
|
213
|
+
|
|
214
|
+
:param delay: base delay (in seconds) between emitted units
|
|
215
|
+
:param jitter: random jitter added/subtracted from delay
|
|
216
|
+
:param mode: typing mode controlling emission granularity
|
|
217
|
+
"""
|
|
218
|
+
_validate("", delay, jitter, mode, sys.stdout)
|
|
219
|
+
|
|
220
|
+
def decorator(func: Callable) -> Callable:
|
|
221
|
+
@wraps(func)
|
|
222
|
+
def wrapper(*args: list, **kwargs: dict) -> Any:
|
|
223
|
+
old_stdout = sys.stdout
|
|
224
|
+
try:
|
|
225
|
+
sys.stdout = _TypioPrinter(
|
|
226
|
+
delay=delay,
|
|
227
|
+
jitter=jitter,
|
|
228
|
+
mode=mode,
|
|
229
|
+
out=old_stdout,
|
|
230
|
+
)
|
|
231
|
+
return func(*args, **kwargs)
|
|
232
|
+
finally:
|
|
233
|
+
sys.stdout = old_stdout
|
|
234
|
+
|
|
235
|
+
return wrapper
|
|
236
|
+
|
|
237
|
+
return decorator
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""typio params."""
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
5
|
+
TYPIO_VERSION = "0.1"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TypeMode(Enum):
|
|
9
|
+
"""Type mode enum."""
|
|
10
|
+
|
|
11
|
+
CHAR = "char"
|
|
12
|
+
WORD = "word"
|
|
13
|
+
LINE = "line"
|
|
14
|
+
SENTENCE = "sentence"
|
|
15
|
+
TYPEWRITER = "typewriter"
|
|
16
|
+
ADAPTIVE = "adaptive"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
INVALID_TEXT_ERROR = "`text` must be str or bytes."
|
|
20
|
+
INVALID_BYTE_ERROR = "bytes text must be UTF-8 decodable."
|
|
21
|
+
INVALID_DELAY_ERROR = "`delay` must be a non-negative number."
|
|
22
|
+
INVALID_JITTER_ERROR = "`jitter` must be a non-negative number."
|
|
23
|
+
INVALID_MODE_ERROR = "`mode` must be a TypeMode enum value."
|
|
24
|
+
INVALID_FILE_ERROR = "`file` must be a file-like object."
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: typio
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Typio: Make Your Terminal Type Like a Human
|
|
5
|
+
Home-page: https://github.com/sepandhaghighi/typio
|
|
6
|
+
Download-URL: https://github.com/sepandhaghighi/typio/tarball/v0.1
|
|
7
|
+
Author: Sepand Haghighi
|
|
8
|
+
Author-email: me@sepand.tech
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Source, https://github.com/sepandhaghighi/typio
|
|
11
|
+
Keywords: terminal cli typing typewriter typing-effect console stdout ux
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Intended Audience :: Developers
|
|
24
|
+
Classifier: Intended Audience :: Education
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
26
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Classifier: Topic :: Utilities
|
|
29
|
+
Classifier: Topic :: Terminals
|
|
30
|
+
Requires-Python: >=3.8
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
License-File: AUTHORS.md
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: author-email
|
|
36
|
+
Dynamic: classifier
|
|
37
|
+
Dynamic: description
|
|
38
|
+
Dynamic: description-content-type
|
|
39
|
+
Dynamic: download-url
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: keywords
|
|
42
|
+
Dynamic: license
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
Dynamic: project-url
|
|
45
|
+
Dynamic: requires-python
|
|
46
|
+
Dynamic: summary
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div align="center">
|
|
50
|
+
<img src="https://github.com/sepandhaghighi/typio/raw/main/otherfiles/logo.png" width="320">
|
|
51
|
+
<h1>Typio: Make Your Terminal Type Like a Human</h1>
|
|
52
|
+
<br/>
|
|
53
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
|
|
54
|
+
<a href="https://github.com/sepandhaghighi/typio"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/sepandhaghighi/typio"></a>
|
|
55
|
+
<a href="https://badge.fury.io/py/typio"><img src="https://badge.fury.io/py/typio.svg" alt="PyPI version"></a>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
## Overview
|
|
59
|
+
|
|
60
|
+
<p align="justify">
|
|
61
|
+
Typio is a lightweight Python library that prints text to the terminal as if it were being typed by a human. It supports multiple typing modes (character, word, line, sentence, typewriter, and adaptive), configurable delays and jitter for natural variation, and seamless integration with existing code via a simple function or a decorator. Typio is designed to be minimal, extensible, and safe, making it ideal for demos, CLIs, tutorials, and storytelling in the terminal.
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
<table>
|
|
65
|
+
<tr>
|
|
66
|
+
<td align="center">PyPI Counter</td>
|
|
67
|
+
<td align="center"><a href="http://pepy.tech/project/typio"><img src="http://pepy.tech/badge/typio"></a></td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td align="center">Github Stars</td>
|
|
71
|
+
<td align="center"><a href="https://github.com/sepandhaghighi/typio"><img src="https://img.shields.io/github/stars/sepandhaghighi/typio.svg?style=social&label=Stars"></a></td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
<table>
|
|
78
|
+
<tr>
|
|
79
|
+
<td align="center">Branch</td>
|
|
80
|
+
<td align="center">main</td>
|
|
81
|
+
<td align="center">dev</td>
|
|
82
|
+
</tr>
|
|
83
|
+
<tr>
|
|
84
|
+
<td align="center">CI</td>
|
|
85
|
+
<td align="center"><img src="https://github.com/sepandhaghighi/typio/actions/workflows/test.yml/badge.svg?branch=main"></td>
|
|
86
|
+
<td align="center"><img src="https://github.com/sepandhaghighi/typio/actions/workflows/test.yml/badge.svg?branch=dev"></td>
|
|
87
|
+
</tr>
|
|
88
|
+
</table>
|
|
89
|
+
|
|
90
|
+
## Installation
|
|
91
|
+
|
|
92
|
+
### Source Code
|
|
93
|
+
- Download [Version 0.1](https://github.com/sepandhaghighi/typio/archive/v0.1.zip) or [Latest Source](https://github.com/sepandhaghighi/typio/archive/dev.zip)
|
|
94
|
+
- `pip install .`
|
|
95
|
+
|
|
96
|
+
### PyPI
|
|
97
|
+
|
|
98
|
+
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
99
|
+
- `pip install typio==0.1`
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
### Function
|
|
105
|
+
|
|
106
|
+
Use `type_print` function to print text with human-like typing effects. You can control the typing speed, randomness, mode, and output stream.
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from typio import type_print
|
|
110
|
+
from typio import TypeMode
|
|
111
|
+
|
|
112
|
+
type_print("Hello, world!")
|
|
113
|
+
|
|
114
|
+
type_print(
|
|
115
|
+
"Typing with style and personality.",
|
|
116
|
+
delay=0.06,
|
|
117
|
+
jitter=0.02,
|
|
118
|
+
mode=TypeMode.ADAPTIVE,
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
You can also redirect the output to any file-like object:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
with open("output.txt", "w") as file:
|
|
126
|
+
type_print("Saved with typing effects.", file=file)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Decorator
|
|
130
|
+
|
|
131
|
+
Use the `@typestyle` decorator to apply typing effects to all `print` calls inside a function, without changing the function's implementation.
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from typio import typestyle
|
|
135
|
+
from typio import TypeMode
|
|
136
|
+
|
|
137
|
+
@typestyle(delay=0.05, mode=TypeMode.TYPEWRITER)
|
|
138
|
+
def intro():
|
|
139
|
+
print("Welcome to Typio.")
|
|
140
|
+
print("Every print is typed.")
|
|
141
|
+
|
|
142
|
+
intro()
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Issues & Bug Reports
|
|
146
|
+
|
|
147
|
+
Just fill an issue and describe it. We'll check it ASAP!
|
|
148
|
+
|
|
149
|
+
- Please complete the issue template
|
|
150
|
+
|
|
151
|
+
## Show Your Support
|
|
152
|
+
|
|
153
|
+
<h3>Star This Repo</h3>
|
|
154
|
+
|
|
155
|
+
Give a ⭐️ if this project helped you!
|
|
156
|
+
|
|
157
|
+
<h3>Donate to Our Project</h3>
|
|
158
|
+
|
|
159
|
+
<h4>Bitcoin</h4>
|
|
160
|
+
1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy
|
|
161
|
+
<h4>Ethereum</h4>
|
|
162
|
+
0xcD4Db18B6664A9662123D4307B074aE968535388
|
|
163
|
+
<h4>Litecoin</h4>
|
|
164
|
+
Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ
|
|
165
|
+
<h4>Doge</h4>
|
|
166
|
+
DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh
|
|
167
|
+
<h4>Tron</h4>
|
|
168
|
+
TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7
|
|
169
|
+
<h4>Ripple</h4>
|
|
170
|
+
rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq
|
|
171
|
+
<h4>Binance Coin</h4>
|
|
172
|
+
bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef
|
|
173
|
+
<h4>Tether</h4>
|
|
174
|
+
0xcD4Db18B6664A9662123D4307B074aE968535388
|
|
175
|
+
<h4>Dash</h4>
|
|
176
|
+
Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s
|
|
177
|
+
<h4>Stellar</h4>
|
|
178
|
+
GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL
|
|
179
|
+
<h4>Zilliqa</h4>
|
|
180
|
+
zil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5
|
|
181
|
+
<h4>Coffeete</h4>
|
|
182
|
+
<a href="http://www.coffeete.ir/opensource">
|
|
183
|
+
<img src="http://www.coffeete.ir/images/buttons/lemonchiffon.png" style="width:260px;" />
|
|
184
|
+
</a>
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# Changelog
|
|
188
|
+
All notable changes to this project will be documented in this file.
|
|
189
|
+
|
|
190
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
191
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
192
|
+
|
|
193
|
+
## [Unreleased]
|
|
194
|
+
## [0.1] - 2026-01-31
|
|
195
|
+
### Added
|
|
196
|
+
- `type_print` function
|
|
197
|
+
- `typestyle` decorator
|
|
198
|
+
- `CHAR` mode
|
|
199
|
+
- `WORD` mode
|
|
200
|
+
- `LINE` mode
|
|
201
|
+
- `SENTENCE` mode
|
|
202
|
+
- `TYPEWRITER` mode
|
|
203
|
+
- `ADAPTIVE` mode
|
|
204
|
+
|
|
205
|
+
[Unreleased]: https://github.com/sepandhaghighi/typio/compare/v0.1...dev
|
|
206
|
+
[0.1]: https://github.com/sepandhaghighi/typio/compare/750c00e...v0.1
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
AUTHORS.md
|
|
2
|
+
CHANGELOG.md
|
|
3
|
+
LICENSE
|
|
4
|
+
MANIFEST.in
|
|
5
|
+
README.md
|
|
6
|
+
SECURITY.md
|
|
7
|
+
dev-requirements.txt
|
|
8
|
+
requirements.txt
|
|
9
|
+
setup.py
|
|
10
|
+
tests/test_errors.py
|
|
11
|
+
tests/test_functions.py
|
|
12
|
+
typio/__init__.py
|
|
13
|
+
typio/__main__.py
|
|
14
|
+
typio/errors.py
|
|
15
|
+
typio/functions.py
|
|
16
|
+
typio/params.py
|
|
17
|
+
typio.egg-info/PKG-INFO
|
|
18
|
+
typio.egg-info/SOURCES.txt
|
|
19
|
+
typio.egg-info/dependency_links.txt
|
|
20
|
+
typio.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
typio
|
typio-0.0.0/PKG-INFO
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: typio
|
|
3
|
-
Version: 0.0.0
|
|
4
|
-
Summary: This name has been reserved using Reserver
|
|
5
|
-
Home-page: https://url.com
|
|
6
|
-
Download-URL: https://download_url.com
|
|
7
|
-
Author: Development Team
|
|
8
|
-
Author-email: test@test.com
|
|
9
|
-
License: MIT
|
|
10
|
-
Project-URL: Source, https://github.com/source
|
|
11
|
-
Keywords: python3 python reserve reserver reserved
|
|
12
|
-
Classifier: Development Status :: 1 - Planning
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Requires-Python: >=3.6
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Dynamic: author
|
|
23
|
-
Dynamic: author-email
|
|
24
|
-
Dynamic: classifier
|
|
25
|
-
Dynamic: description
|
|
26
|
-
Dynamic: description-content-type
|
|
27
|
-
Dynamic: download-url
|
|
28
|
-
Dynamic: home-page
|
|
29
|
-
Dynamic: keywords
|
|
30
|
-
Dynamic: license
|
|
31
|
-
Dynamic: project-url
|
|
32
|
-
Dynamic: requires-python
|
|
33
|
-
Dynamic: summary
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Overview
|
|
37
|
-
typio is a Python library for doing awesome things.
|
|
38
|
-
This name has been reserved using [Reserver](https://github.com/openscilab/reserver).
|
typio-0.0.0/README.md
DELETED
typio-0.0.0/__init__.py
DELETED
typio-0.0.0/setup.py
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import sys
|
|
3
|
-
|
|
4
|
-
try:
|
|
5
|
-
from setuptools import setup
|
|
6
|
-
except ImportError:
|
|
7
|
-
from distutils.core import setup
|
|
8
|
-
|
|
9
|
-
# invalid email
|
|
10
|
-
# download url
|
|
11
|
-
# url
|
|
12
|
-
# project urls
|
|
13
|
-
|
|
14
|
-
setup(
|
|
15
|
-
name ="typio",
|
|
16
|
-
packages=[".",],
|
|
17
|
-
version='0.0.0',
|
|
18
|
-
description="This name has been reserved using Reserver",
|
|
19
|
-
long_description="""
|
|
20
|
-
## Overview
|
|
21
|
-
typio is a Python library for doing awesome things.
|
|
22
|
-
This name has been reserved using [Reserver](https://github.com/openscilab/reserver).
|
|
23
|
-
""",
|
|
24
|
-
long_description_content_type='text/markdown',
|
|
25
|
-
author="Development Team",
|
|
26
|
-
author_email="test@test.com",
|
|
27
|
-
url="https://url.com",
|
|
28
|
-
download_url="https://download_url.com",
|
|
29
|
-
keywords="python3 python reserve reserver reserved",
|
|
30
|
-
project_urls={
|
|
31
|
-
'Source':"https://github.com/source",
|
|
32
|
-
},
|
|
33
|
-
install_requires="",
|
|
34
|
-
python_requires='>=3.6',
|
|
35
|
-
classifiers=[
|
|
36
|
-
'Development Status :: 1 - Planning',
|
|
37
|
-
'Programming Language :: Python :: 3.6',
|
|
38
|
-
'Programming Language :: Python :: 3.7',
|
|
39
|
-
'Programming Language :: Python :: 3.8',
|
|
40
|
-
'Programming Language :: Python :: 3.9',
|
|
41
|
-
'Programming Language :: Python :: 3.10',
|
|
42
|
-
'Programming Language :: Python :: 3.11',
|
|
43
|
-
'Programming Language :: Python :: 3.12',
|
|
44
|
-
],
|
|
45
|
-
license="MIT",
|
|
46
|
-
)
|
|
47
|
-
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: typio
|
|
3
|
-
Version: 0.0.0
|
|
4
|
-
Summary: This name has been reserved using Reserver
|
|
5
|
-
Home-page: https://url.com
|
|
6
|
-
Download-URL: https://download_url.com
|
|
7
|
-
Author: Development Team
|
|
8
|
-
Author-email: test@test.com
|
|
9
|
-
License: MIT
|
|
10
|
-
Project-URL: Source, https://github.com/source
|
|
11
|
-
Keywords: python3 python reserve reserver reserved
|
|
12
|
-
Classifier: Development Status :: 1 - Planning
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Requires-Python: >=3.6
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Dynamic: author
|
|
23
|
-
Dynamic: author-email
|
|
24
|
-
Dynamic: classifier
|
|
25
|
-
Dynamic: description
|
|
26
|
-
Dynamic: description-content-type
|
|
27
|
-
Dynamic: download-url
|
|
28
|
-
Dynamic: home-page
|
|
29
|
-
Dynamic: keywords
|
|
30
|
-
Dynamic: license
|
|
31
|
-
Dynamic: project-url
|
|
32
|
-
Dynamic: requires-python
|
|
33
|
-
Dynamic: summary
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Overview
|
|
37
|
-
typio is a Python library for doing awesome things.
|
|
38
|
-
This name has been reserved using [Reserver](https://github.com/openscilab/reserver).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|