mithil467 / mitype Goto Github PK
View Code? Open in Web Editor NEWTyping speed test in terminal
Home Page: http://mithil467.github.io/mitype
License: GNU General Public License v3.0
Typing speed test in terminal
Home Page: http://mithil467.github.io/mitype
License: GNU General Public License v3.0
mitype
in a fresh virtualenvmitype
script should be generated in <venv-path>/bin
python -m mitype
to launch the appNice app by the way :)
One of my CPU cores gets maxed out at a 100% the moment I start mitype
mitype
.mitype
Normal CPU usage
100% CPU usage on one core
When inside replay mode, sometimes exit would take a long time. Applicable to all environments.
Run any Mitype session, wait for at least about 5-6 seconds in between any 2 keys so that the delay is noticeable. Then during replay press Esc
key as soon as that particular key-press is being replayed.
Mitype should exit as soon as Esc
key is pressed
The exit is delayed till the next key is displayed.
When I start mitype with mitype
in cmd on windows I get the error ModuleNotFoundError: No module named '_curses'
In some research I found out, that curses
is not really supported on windows. To fix this problem I had to runpip install windows-curses
. I think that should be documentated.
after a fresh installation of mitype
run mitype
on windows
It should be able to start.
PS C:\Users\user> mitype
Traceback (most recent call last):
File "c:\users\user\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\user\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\Scripts\mitype.exe\__main__.py", line 4, in <module>
File "c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\mitype\app.py", line 3, in <module>
import curses
File "c:\users\user\appdata\local\programs\python\python38-32\lib\curses\__init__.py", line 13, in <module>
from _curses import *
ModuleNotFoundError: No module named '_curses'
run pip install windows-curses
I clicked the replit link out of curiosity, but It's missing a main.sh, so it won't run
Windows 10 - Edge
replit environment:
python 3.8.10 (at the time of writing)
GNU bash 4.4.20
The program should launch automatically when the environment loads, or be a few steps from launching
We get an error saying unable to run, main file "main.sh" not found
.
I tried installing mitype with pip install . --user
and then launching with python mitype/__main__.py
but I got ModuleNotFoundError: no module named mitype
Got the project running on windows with your instructions , pressing the windows key during the typing test causes it to crash.
Platform: Windows 10
Version: Clone from master @ commit d14b810
Stacktrace:
Traceback (most recent call last):
File "local_test.py", line 5, in <module>
obj.start()
File "F:\PythonProjects\mitype\mitype\app.py", line 192, in start
curses.wrapper(self.main)
File "C:\Users\Kriticalflare\AppData\Local\Programs\Python\Python38-32\lib\curses\__init__.py", line 105, in wrapper
return func(stdscr, *args, **kwds)
File "F:\PythonProjects\mitype\mitype\app.py", line 169, in main
self.KeyPrinter(win, key)
File "F:\PythonProjects\mitype\mitype\app.py", line 107, in KeyPrinter
win.addstr(self.LineCount, 0, self.CurrentWord)
ValueError: embedded null character
The app is not quitting in test or replay mode using ctrl+c. It only quits in test mode pressing esc.
Windows 10
0.2.0
3.7.3
Windows cmd
Or
The app should exit
In test mode, "^C" appears in the lower area where the current word usually appears. On the other hand, nothing happens in replay mode. In fact, the app can only be closed by closing the cmd window from that point on.
I believe the app is registering ctrl+c as a keystroke for the typing test and not as the usual "exit program" command. I would like to fix this for this year's Hacktoberfest.
Originally posted by Mithil467 September 3, 2021
Python 2 support was added initially because it was really easy to do so. But it is not really necessary. The advantages are minimal, and the development overhead is far greater with testing code on both Python versions and ensuring that code is compatible with Python 2.
So moving on, all the code supporting Python 2 will be removed and further features will be developed by keeping Python 3 in mind.
Any contributions towards achieving this is really appreciated! 😄
These are some of the changes required to achieve this -
__future__
importsCurrently we are only displaying the typing speed. We can add other attributes like Accuracy
and Time taken
nearby.
After completing the test, we see the stats -
The cursor is placed at the end.
Let's hide the visibility of the cursor when displaying stats after test. But the cursor must be visible for the rest of the time.
Refer to the python curses documentation here.
Hi, I think it would be nice if mitype could also support other languages like Italian, French, Spanish and so on.
Solution i'd go with
Add other tables to database. Something like data_it
, data_es
, data_fr
... with the same columns as data
Add a commandline feature -l
or --lang
that let you specify which language you want to write in.
Add a function in database.py that select the text given the id from a given table.
Add a function load_based_on_language
to commandline.py
I'd like to work on this. I can also populate the italian db with some phrase.
When I try use text larger that the screen the code broke.
Problem may be in wrap_text method.
This situation doesn't exist by itself without creating manually.
If the ~/.mitype_history.csv
exists without header, only as empty file, mitype crash with a StopIteration
exception.
It can be reproduced easily :
$ mv ~/.mitype_history.csv .mitype_history_save.csv # Save your record logs
$ touch ~/.mv .mitype_history.csv # Create an empty file without header
$ mitype --history # Try to print records history
Traceback (most recent call last):
File "/home/romain/.local/bin/mitype", line 8, in <module>
sys.exit(App())
File "/home/romain/.local/pipx/venvs/mitype/lib/python3.9/site-packages/mitype/app.py", line 42, in __init__
self.text = resolve_commandline_arguments()[0]
File "/home/romain/.local/pipx/venvs/mitype/lib/python3.9/site-packages/mitype/commandline.py", line 29, in resolve_commandline_arguments
show_history(opt.history)
File "/home/romain/.local/pipx/venvs/mitype/lib/python3.9/site-packages/mitype/history.py", line 39, in show_history
next(history_reader)
StopIteration
Pressing ESC key while the test has already started should reset the text. Note: Currently replay mode cannot detect ESC key. So this issue applied to test mode only and not replay mode.
Pin the red color on the mispelled letter
Steps to reproduce
Expected behaviour
Actual behaviour
Your proposed fix (if any)
I would like to work on this enhancement, if possible. I believe that it is a good enhancement because the actual behaviour for new users can be quite confusing. At first I did not understand that I mispelled a word and I continued to type.
Also, I am having some troubles to run the code locally. My changes does not have any effect on the application. I read the build.md file, can you explain with more details how to run in development mode?
Unfortunately if I try to take the test with a German text with the -f
flag I am not able to input characters needed for some words (like ä, ö, ü).
Grab yourself a German text like this:
Zu meiner Familie gehören vier Personen. Die Mutter bin ich und dann gehört natürlich mein Mann dazu. Wir haben zwei Kinder, einen Sohn, der sechs Jahre alt ist und eine dreijährige Tochter.
Save it to an file and run
$ python3 -m mitype -f <file-name>
And try to get pass the gehören
word.
We should expect Mitype to handle special characters.
Sadly you can not press the special char keys, they will just be ignored.
It would be nice to be able to hit a key to restart the program instead of closing out and calling mitype
after every run.
Pressing arrow keys at the beginning of the test changes the text to the new text. But resizing the window afterwards would reset the text to the initial text.
Text should stay as the latest value.
Text resets to the previous text.
Text is reset with the help of original_text_formatted
here -
Line 453 in 661ec4c
switch_text
function.The backspace key instead of deleting the previous character , it acts as invalid input.
Press the backspace key
Delete the previous character
It doesnt delete the previous character but rather acts as invalid input ( as it doesnt match any of the characters)
It is a good idea to use with open(filename) as f:
instead of using a combination of open
and close
.
Python ensures the resources are closed with the context.
The files to be changed are -
Whenever i finish typing on a dataset in mitype it will show only two of the following option.
Enter to see replay, Tab to retry
So, to type on new dataset i have to restart it.
Their should be a third option to type on a new dataset.
The formatting is messed up for the return
section with multi-line description.
For example https://mithil467.github.io/mitype/api.html#mitype.keycheck.is_escape.
Formatting should be the same for all lines.
With reference to the solution mentioned in issue sphinx-contrib/napoleon#4, all the docstrings with multi-line return section need to be indented accordingly as -
Returns:
bool: Returns `True` if pressed key is ESC key.
Returns `False` otherwise.
I just installed oh-my-zsh to my zsh and i reinstall mitype but when i run mitype
on my iTerm2 it says zsh: permission denied: mitype
I already re-install and un-install mitype but it still doesn't work
I'd love to be able to visualize the error I made during the run, as in the screenshot.
Also, the same app (here) displays a "fluidity" score, which is higher the more stable you are while typing.
I believe it can be calculated from something like the variance of the time interval between two keystrokes.
Typing window doesnt adapt to resizing cmd window
clone the repo.
Open cmd , it should open unminimized by default
Run local_test.py
Maximize cmd window
The typing window to resize to properly utilize the full width of cmd screen
The typing window doesnt adapt to the change in cmd window size.
Currently there is no way to view history
It would be great if I could see how much I'm improving using this typing test if we stored all the previous WPM, Accuracy scores in a local file.
Solution
At the end of a typing run, pressing a button should show the entire history as a list
Something like this:
| date | time | wpm | Accuracy |
---------------------------------------
| 01/10/20 | 21:00 | 40.86 | 94% |
| 01/10/20 | 21:05 | 45.34 | 95% |
And also maybe color-code each entry in the history based on 'below average', 'average', 'above-average', 'master'
Is your feature request related to a problem? Please describe.
Not a problem but an enhancement to the application.
Describe the solution you'd like
It will show up on the top left corner of the screen and as the user types, it will update the value automatically in real-time.
If it is not related to any problem
It is not a problem but an enhancement to show realtime WPM speed to users.
While using mitype with Plover for stenography, Plover will add a space before each word you type, which makes mitype say the word is invalid.
Install Plover and try to do a typing test in mitype with it enabled.
Mitype should accept the input as valid.
Mitype says the word is invalid.
Is your feature request related to a problem? Please describe.
It's not much of a problem but a way to bring more traction to this project, you must have seen websites where you can do some things and share your results on social media which brings more people into the project from there following and so on.....
Describe the solution you'd like
When the user completes the test we can provide a key combination which will open Twitter with pre-typed results like number of words, time taken, Words per minute, and a tag to your Twitter handle as a creator or you can create a Twitter handle of this project itself :p
If it is not related to any problem
I already did :)
Additional context
Not sure about this, but if there is any way to capture the window the user typed into and use this captured image in the tweet will be more awesome and no one can tampure with that kind of result compared to some pre-typed text
Mistyped characters are highlighted during the test. Similarly, all the mistyped characters should be highlighted at once at the end of the test.
Please refer to #81 for the proposed solution mentioned here.
Thanks to @CorentinGaillard for suggesting this issue and for their contributions to it!
Input text is being repeated on resizing window
clone the repo.
Open cmd , it should open unminimized by default
Run local_test.py
Maximize cmd window
The typing window to resize to properly utilize the full width of cmd screen
On typing the text from second line is being moved to the first line
Mitype crashes upon typing more characters than text length.
Load any text of length 'n'. Type any character except spacebar, n times or more. Then hit spacebar.
The app should continue working fine.
Crashes with traceback:
mitype/calculations.py", line 73, in get_space_count_after_ith_word
while text[index] == " ":
IndexError: string index out of range
The traceback is very clear. We could use a simple check to see if index isn't out of range.
Replay should reflect moderately similar speed.
Replay is slower and takes longer to finish. There's much more time difference between 2 key presses.
A better way to catch the ESC
key without timeout would really be helpful. Although, the timeout was introduced to fix #12.
Is there a way to register a signal for the ESC
key, just like we have for ctrl-c
in signals.py?
Lines 519 to 525 in 63cf858
Is your feature request related to a problem? Please describe.
It's a one-step simple problem that is people need to install two pip packages separately to run mitype on windows
Describe the solution you'd like
There are a lot of examples of how to deal with dependencies that are OS-dependent. Check out some on stackoverflow, another stackoverflow and the docs on PEP 508
If it is not related to any problem
It's more of a convenience thing more than a problem
Start mitype, preferably with a relatively lesser width terminal window.
Spam any wrong keys so that the text overflows to next line as shown below.
Try to clear those keys by pressing backspace.
Backspace should clear all the keys consistently.
The logic works as expected and does indeed clear text but doesn't update the screen visually for the lines below, but works fine for top line.
Maybe we need to clear the entire screen if that is feasible.
A limit for length of characters for current_word
was imposed in PR #66.
But pressing spaces once the limit is reached still adds up in current_word
.
Spaces should not be added once the length limit is reached.
Spaces are still added.
Start mitype. Reduce the size of the terminal vertically. It will crash after a certain point where screen becomes smaller than what is required to print the text.
Mitype should:
Crashes with traceback -
File "/home/mithil/p/mitype/mitype/app.py", line 354, in resize
self.setup_print(win)
File "/home/mithil/p/mitype/mitype/app.py", line 173, in setup_print
win.addstr(2, 0, self.text, curses.A_BOLD)
_curses.error: addwstr() returned ERR
We have implemented a size check in the initialize
method in app.py already which warns the user that the terminal is smaller than the amount of lines required. We can use a similar check in resize
method.
The keyboard and star struck emojis dont render properly
clone and run local_test.py
The emojis to render
For example, if currently I am on text with ID=450
.
Pressing right arrow key should load text with ID=451
.
Similarly, now pressing the left arrow key twice should load text with ID=449
.
Following the contributors guide, running tox -e 2.7
on mitype gives error.
line 5, in <module>
with open("README.md", encoding="utf-8") as f:
TypeError: 'encoding' is an invalid keyword argument for this function
Should work fine.
Command errors out with exit status 1
We gotta modify that line under setup.py. But please be careful, because this file decides how mitype appears on pypi.
I am very happy to see all the love this project has been receiving! 💟
This thread is dedicated for discussions related to improvement of mitype and a place to share your ideas.
We would love to have your sugestions, so feel free to comment them below 😄
Currently, you can see the stats only when the test or replay has finished.
But during the replay there is no way of knowing what the stats were.
When user hits enter to replay, we should display the stats at the bottom of the screen on the last line.
It feels like some other position like top right would have worked as well, but that is because we only have 1 stat currently.
But very soon we will be having a few more (see #16 ) , so last line seems feasible.
This issue is concerning the desire to fix some inconsistent docstrings as well as to fix a minor typo or two.
For docstrings, the desire is to more consistently format them in accordance to pydocstyle, and as requested, I'll also try and add some additional ones on existing functions/methods.
For typos, I have found one or two spelling errors that I would like to tackle at the same time.
App crashes when certain keys are pressed.
Run mitype. Press any of these keys:
These key presses should be ignored.
Traceback:
File "/home/mithil/p/mitype/mitype/app.py", line 84, in main
self.typing_mode(win, key)
File "/home/mithil/p/mitype/mitype/app.py", line 108, in typing_mode
self.key_printer(win, key)
File "/home/mithil/p/mitype/mitype/app.py", line 198, in key_printer
self.appendkey(key)
File "/home/mithil/p/mitype/mitype/app.py", line 239, in appendkey
self.current_word += key
TypeError: can only concatenate str (not "int") to str
Add functions to keycheck.py to check for such keys for their string value or integer value.
I would go look at it now, but I am busy, but here is the traceback of the error I've come across.
Ubuntu 16.04.7 LTS
Mitype version 0.2.3
Python 3.8.11
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
I finished almost all of the typing test, but then when I missed the period around the end and hit and then tried backspacing and correcting my mistake, it crashed with the following:
Traceback (most recent call last):
File "/home/user1/.pyenv/versions/3.8.11/bin/mitype", line 33, in
sys.exit(load_entry_point('mitype==0.2.3', 'console_scripts', 'mitype')())
File "/home/user1/.pyenv/versions/3.8.11/lib/python3.8/site-packages/mitype/app.py", line 85, in init
curses.wrapper(self.main)
File "/home/user1/.pyenv/versions/3.8.11/lib/python3.8/curses/init.py", line 105, in wrapper
return func(stdscr, *args, **kwds)
File "/home/user1/.pyenv/versions/3.8.11/lib/python3.8/site-packages/mitype/app.py", line 117, in main
self.typing_mode(win, key)
File "/home/user1/.pyenv/versions/3.8.11/lib/python3.8/site-packages/mitype/app.py", line 176, in typing_mode
self.key_printer(win, key)
File "/home/user1/.pyenv/versions/3.8.11/lib/python3.8/site-packages/mitype/app.py", line 276, in key_printer
self.update_state(win)
File "/home/user1/.pyenv/versions/3.8.11/lib/python3.8/site-packages/mitype/app.py", line 372, in update_state
self.text[i],
IndexError: string index out of range
Not error.
Error.
If I am able to get to it soon, I'll edit this section later.
Sometimes user might not realize he's typing incorrectly and continue typing multiple words. In such a scenario, one may prefer erasing the entire word with the help of the ctrl + backspace
combo.
For example -
Current string is "quqick brown"
Pressing the key combo should erase the latest word -
Current string becomes "quqick "
And hitting a second time should erase the other word too
Current string becomes ""
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.