Skip to main content

Minimalistic typing exercise

Project description

fasttyper

About

Fasttyper is minimalistic typing test based on user provided exercising text. It supports both reading from text files and stdin supporting wide range of usecases. The goal was to create it as simple as it can be, without any additional bloatware functionalities. That means that Fasttyper doesn't come with build in test generator and you have to provide your own scripts generating tests. Some examples of such scrips are providen in Usage section.

Installation

Fasttyper is currently maintained on PyPi Python Package Index. To install package simpply use:

python3 -m pip install fasttyper

Usage

With installation of fasttyper you should have new executable - fasttyper. It takes two optional positional arguments, amount of words and language (like in Monkeytype's: english, english_1k etc). Default amount of words is 25 and language is english. To run fasttyper simply call:

fasttyper

from command line. There are some avalibe options:

usage: fasttyper [-h] [--config FILE] [--unclutter-backspace] [--no-cursor] [amount] [language]

positional arguments:
  amount                Amount of words
  language              Language

options:
  -h, --help            show this help message and exit
  --config FILE, -c FILE
                        configuration file
  --unclutter-backspace, -b
                        unclutter backspace, when it raises ctrl+backspace instead
  --no-cursor, -n       disable cursos

I personally use alias:

alias ff='fasttyper -n`

because i don't like having cursor and i am too lazy to type fasttyper so i just type ff :)

Running next test and stopping application

To abandon test and start brand new one, press TAB.

To kill application (exit) press CTRL+C.

Configuring

Fasttyper by default looks for config file in: $HOME/.config/fasttyper/config.json. You can provide different location for config file with --config argument, for example: --config=~/.fasttyper.json. Config has to be a json dict. Avalibe keys:

  • user_input_valid_color - integer, terminal color for valid text, by default it is 3
  • user_input_invalid_color - integer, terminal color for invalid text, by default it is 2
  • reference_text_color - integer, terminal color for reference text, by default it is 8
  • stats_color - integer, terminal color for stats text, by default it is 5
  • summary_datafile - datafile storing all stats, by default it is ~/.cache/fasttyper/datafile.csv
  • top_margin_percentage - integer, percentage of screen used for top margin, by default 30
  • left_margin_percentage - integer, percentage of screen used for left (and right) margin, by default 10
  • lines_on_screen - integer, number of lines to display on screen, by default 3

Example config file with all default values in avalibe here.

Other example config files:

{"top_margin_percentage": 40, "left_margin_percentage": 25}
{"user_input_valid_color": 5}

Usage as module, piping stuff, custom scripts etc

Fasttyper is ran as an python module, so to execute it simply type:

python3 -m fasttyper

from cloned github repository, if you didn't install package from TestPyPi.

Fasttyper can open text files, which path should be provided as first and only argument to the module execution, for example:

python3 -m fasttyper example_text.txt

Program also allows user to pipe text into it. Keep in mind, it only supports spaces and new line characters, so you won't be able to table tabs. For example, you can run Fasttyper on fortune generated quote changing tabulators to spaces with sed:

furtune | python3 -m fasttyper

or if you want to randomize words from given file with shuf on for example all disctionaries in system:

shuf -n5 /usr/share/dict/* | python -m fasttyper

You can use another similar projects set of words as well, for example to create test with 20 random words from Monkeytype's english 100 dictionary use:

curl -s https://raw.githubusercontent.com/Miodec/monkeytype/master/static/languages/english.json | python3 -c "import sys, json; print('\n'.join(json.load(sys.stdin)['words']))" | shuf -n20 | python3 -m fasttyper

To exit you can either finish test, use KeyboardInterrupt (CTRL+C) or tap tab. After you finish test, there will be summary printed, use enter to exit from it.

When backspace does wierd shiet

Some terminal emulators send different values for key presses of backspace and ctrl+backspace. To fix it, simply add b flag like that: python3 -m fasttyper -b.

Hiding cursor

To hide the cursor, simply add n flag like that: python3 -m fasttyper -n.

Example scripts

function ff() {
	mkdir -p ~/.cache/fasttyper
	local amount="${1:-50}"
	local language="${2:-english}"
	local sfile=~/.cache/fasttyper/$language
	local source_path=https://raw.githubusercontent.com/Miodec/monkeytype/master/static/languages/$language.json
	[[ ! -f $sfile ]] && curl -s $source_path | python3 -c "import sys, json; print('\n'.join(json.load(sys.stdin)['words']))" > $sfile
	while true
	do
		shuf -n $amount $sfile | python3 -m fasttyper || break
	done
}

ff 50 english_1k

This shell function shuffles N words from cached word list, and if given word list doesnt exist it download's it. It runs in loop, but does exit from it if you exit fasttyper with CTRL+C.

The above script is avalible for download from doc folder.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fasttyper-2.0.6.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

fasttyper-2.0.6-py2.py3-none-any.whl (25.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fasttyper-2.0.6.tar.gz.

File metadata

  • Download URL: fasttyper-2.0.6.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for fasttyper-2.0.6.tar.gz
Algorithm Hash digest
SHA256 6836a132b3f7d58dc0b983bf03d08b3f65659f3204992b5dadb365b8157d9935
MD5 f51150690cccce2076711e7eb531f14b
BLAKE2b-256 538f6e9b8eda3a71ebaee1de9f2a64f40b8b07e4a7a0981e7e2d636523cfe6f0

See more details on using hashes here.

File details

Details for the file fasttyper-2.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: fasttyper-2.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for fasttyper-2.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 50067e823302faa2887205661c7a86c6444388e6dbbfb0421558218e5905f39c
MD5 c07c0c24744bbb94f084fc3263c3a112
BLAKE2b-256 b87fef17b2aca5bd2178281f884a27c193648ac2ad95040c909ca633f5c7f0cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page