ttyping 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ publish:
10
+ name: Build and Publish
11
+ runs-on: ubuntu-latest
12
+ # Recommended for Trusted Publishing
13
+ permissions:
14
+ id-token: write # Mandatory for Trusted Publishing
15
+ contents: read # Standard for checkout
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: '3.12'
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v5
27
+ with:
28
+ enable-cache: true
29
+
30
+ - name: Build
31
+ run: uv build
32
+
33
+ - name: Publish to PyPI
34
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,458 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+
209
+ # Created by https://www.toptal.com/developers/gitignore/api/python,windows,macos,linux
210
+ # Edit at https://www.toptal.com/developers/gitignore?templates=python,windows,macos,linux
211
+
212
+ ### Linux ###
213
+ *~
214
+
215
+ # temporary files which can be created if a process still has a handle open of a deleted file
216
+ .fuse_hidden*
217
+
218
+ # KDE directory preferences
219
+ .directory
220
+
221
+ # Linux trash folder which might appear on any partition or disk
222
+ .Trash-*
223
+
224
+ # .nfs files are created when an open file is removed but is still being accessed
225
+ .nfs*
226
+
227
+ ### macOS ###
228
+ # General
229
+ .DS_Store
230
+ .AppleDouble
231
+ .LSOverride
232
+
233
+ # Icon must end with two \r
234
+ Icon
235
+
236
+
237
+ # Thumbnails
238
+ ._*
239
+
240
+ # Files that might appear in the root of a volume
241
+ .DocumentRevisions-V100
242
+ .fseventsd
243
+ .Spotlight-V100
244
+ .TemporaryItems
245
+ .Trashes
246
+ .VolumeIcon.icns
247
+ .com.apple.timemachine.donotpresent
248
+
249
+ # Directories potentially created on remote AFP share
250
+ .AppleDB
251
+ .AppleDesktop
252
+ Network Trash Folder
253
+ Temporary Items
254
+ .apdisk
255
+
256
+ ### macOS Patch ###
257
+ # iCloud generated files
258
+ *.icloud
259
+
260
+ ### Python ###
261
+ # Byte-compiled / optimized / DLL files
262
+ __pycache__/
263
+ *.py[cod]
264
+ *$py.class
265
+
266
+ # C extensions
267
+ *.so
268
+
269
+ # Distribution / packaging
270
+ .Python
271
+ build/
272
+ develop-eggs/
273
+ dist/
274
+ downloads/
275
+ eggs/
276
+ .eggs/
277
+ lib/
278
+ lib64/
279
+ parts/
280
+ sdist/
281
+ var/
282
+ wheels/
283
+ share/python-wheels/
284
+ *.egg-info/
285
+ .installed.cfg
286
+ *.egg
287
+ MANIFEST
288
+
289
+ # PyInstaller
290
+ # Usually these files are written by a python script from a template
291
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
292
+ *.manifest
293
+ *.spec
294
+
295
+ # Installer logs
296
+ pip-log.txt
297
+ pip-delete-this-directory.txt
298
+
299
+ # Unit test / coverage reports
300
+ htmlcov/
301
+ .tox/
302
+ .nox/
303
+ .coverage
304
+ .coverage.*
305
+ .cache
306
+ nosetests.xml
307
+ coverage.xml
308
+ *.cover
309
+ *.py,cover
310
+ .hypothesis/
311
+ .pytest_cache/
312
+ cover/
313
+
314
+ # Translations
315
+ *.mo
316
+ *.pot
317
+
318
+ # Django stuff:
319
+ *.log
320
+ local_settings.py
321
+ db.sqlite3
322
+ db.sqlite3-journal
323
+
324
+ # Flask stuff:
325
+ instance/
326
+ .webassets-cache
327
+
328
+ # Scrapy stuff:
329
+ .scrapy
330
+
331
+ # Sphinx documentation
332
+ docs/_build/
333
+
334
+ # PyBuilder
335
+ .pybuilder/
336
+ target/
337
+
338
+ # Jupyter Notebook
339
+ .ipynb_checkpoints
340
+
341
+ # IPython
342
+ profile_default/
343
+ ipython_config.py
344
+
345
+ # pyenv
346
+ # For a library or package, you might want to ignore these files since the code is
347
+ # intended to run in multiple environments; otherwise, check them in:
348
+ # .python-version
349
+
350
+ # pipenv
351
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
352
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
353
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
354
+ # install all needed dependencies.
355
+ #Pipfile.lock
356
+
357
+ # poetry
358
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
359
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
360
+ # commonly ignored for libraries.
361
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
362
+ #poetry.lock
363
+
364
+ # pdm
365
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
366
+ #pdm.lock
367
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
368
+ # in version control.
369
+ # https://pdm.fming.dev/#use-with-ide
370
+ .pdm.toml
371
+
372
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
373
+ __pypackages__/
374
+
375
+ # Celery stuff
376
+ celerybeat-schedule
377
+ celerybeat.pid
378
+
379
+ # SageMath parsed files
380
+ *.sage.py
381
+
382
+ # Environments
383
+ .env
384
+ .venv
385
+ env/
386
+ venv/
387
+ ENV/
388
+ env.bak/
389
+ venv.bak/
390
+
391
+ # Spyder project settings
392
+ .spyderproject
393
+ .spyproject
394
+
395
+ # Rope project settings
396
+ .ropeproject
397
+
398
+ # mkdocs documentation
399
+ /site
400
+
401
+ # mypy
402
+ .mypy_cache/
403
+ .dmypy.json
404
+ dmypy.json
405
+
406
+ # Pyre type checker
407
+ .pyre/
408
+
409
+ # pytype static type analyzer
410
+ .pytype/
411
+
412
+ # Cython debug symbols
413
+ cython_debug/
414
+
415
+ # PyCharm
416
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
417
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
418
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
419
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
420
+ #.idea/
421
+
422
+ ### Python Patch ###
423
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
424
+ poetry.toml
425
+
426
+ # ruff
427
+ .ruff_cache/
428
+
429
+ # LSP config files
430
+ pyrightconfig.json
431
+
432
+ ### Windows ###
433
+ # Windows thumbnail cache files
434
+ Thumbs.db
435
+ Thumbs.db:encryptable
436
+ ehthumbs.db
437
+ ehthumbs_vista.db
438
+
439
+ # Dump file
440
+ *.stackdump
441
+
442
+ # Folder config file
443
+ [Dd]esktop.ini
444
+
445
+ # Recycle Bin used on file shares
446
+ $RECYCLE.BIN/
447
+
448
+ # Windows Installer files
449
+ *.cab
450
+ *.msi
451
+ *.msix
452
+ *.msm
453
+ *.msp
454
+
455
+ # Windows shortcuts
456
+ *.lnk
457
+
458
+ # End of https://www.toptal.com/developers/gitignore/api/python,windows,macos,linux
@@ -0,0 +1,55 @@
1
+ # ttyping
2
+
3
+ A minimal, monkeytype-inspired terminal typing test for English and Korean, built with Python and Textual.
4
+
5
+ ## Project Overview
6
+
7
+ `ttyping` provides a clean and focused typing practice environment directly in the terminal. It tracks speed (WPM) and accuracy, saving results locally for history viewing.
8
+
9
+ ### Tech Stack
10
+ - **Language:** Python 3.10+
11
+ - **TUI Framework:** [Textual](https://github.com/Textualize/textual)
12
+ - **Styling/Formatting:** [Rich](https://github.com/Textualize/rich)
13
+ - **Dependency Management:** [uv](https://github.com/astral-sh/uv) (recommended) or pip
14
+ - **Build System:** Hatchling
15
+
16
+ ### Core Architecture
17
+ - **`src/ttyping/__main__.py`**: CLI entry point. Handles argument parsing (`argparse`).
18
+ - **`src/ttyping/app.py`**: The main `TypingApp` class. Manages the screen stack and application-level state.
19
+ - **`src/ttyping/screens.py`**: Contains the UI logic:
20
+ - `TypingScreen`: The interactive typing test.
21
+ - `ResultScreen`: Summary shown after a test completes.
22
+ - `HistoryScreen`: A table view of past results.
23
+ - **`src/ttyping/storage.py`**: Handles persistent storage of results in `~/.ttyping/results.json`.
24
+ - **`src/ttyping/words.py`**: Provides internal word lists (English/Korean) and file reading capabilities.
25
+
26
+ ## Building and Running
27
+
28
+ ### Development Commands
29
+ - **Run the app:** `uv run ttyping`
30
+ - **Run with specific options:**
31
+ - Korean: `uv run ttyping --lang ko`
32
+ - Custom word count: `uv run ttyping --words 50`
33
+ - Practice from file: `uv run ttyping --file path/to/text.txt`
34
+ - View history: `uv run ttyping history`
35
+
36
+ ### Installation
37
+ - **Local editable install:** `pip install -e .` or `uv pip install -e .`
38
+ - **Install as a tool:** `uv tool install .`
39
+
40
+ ## Development Conventions
41
+
42
+ ### Coding Style
43
+ - Uses modern Python features (type hints, `from __future__ import annotations`).
44
+ - UI styling is defined via Textual's CSS-like `DEFAULT_CSS` in screen classes or `TypingApp.CSS`.
45
+ - Monkeytype-inspired color palette is defined as constants in `screens.py`.
46
+
47
+ ### UI/UX Rules
48
+ - **Tab**: Restart the test.
49
+ - **Esc**: Quit the application.
50
+ - **Space**: Proceed to the next word.
51
+ - Results are calculated based on characters per minute (CPM / 5) for WPM and character-level accuracy.
52
+
53
+ ### Data Storage
54
+ - Data is stored in JSON format at `~/.ttyping/results.json`.
55
+ - Each result entry includes `wpm`, `accuracy`, `lang`, `word_count`, and an ISO-formatted `date`.