Two parts of tally, one move at a time
This walk takes two parts of tally alone. The first part is the test of an empty text and the fix of case. The second part is the function for the most common words. Each part begins with the code as it was just before it.
The walk leaves out the rest of tally:
- Before the first part, it leaves out the project, the function
countand the command that reads a file. It also leaves out the first file of tests,tests/test_count.py. The first part begins with all of them in place. - Between the two parts, it leaves out ruff, the corpus, the types and the docstring. The second part begins with their code.
- After the second part, it leaves out the option
--top, the report, and the section of the README that says how to run tally.
There are two ways to read this tutorial. Both have the same parts, in the same order.
Each part ends with a section called What changed. It lists every file that the part changes, with a link to the file, and then the whole diff of each file, folded. A lockfile and a binary file have a link alone. The text above it explains the change. In Build it yourself, What changed is what you check your files against.
In Build it yourself, a file that a command makes says which command. A diff that is open is a patch. Apply it with the command in the text, or make the same change in your editor.
Read the tutorial
Each change explained, with the code to look at.
Build it yourself
Every command to run and every change to make by hand, to make the project yourself.
Get the project
You build the project in a clone of your own, on a branch mine that starts where this walk starts. Run the commands of these pages in its top folder.
git clone https://github.com/rahuldave/tally
cd tally
git switch -c mine 6a4b1a0e5003Then add the command git check, which compares your files with the project's after each move, and leaves what git add has staged as it was.
git config alias.check '!f() { i="$(git rev-parse --git-path check-index)" && { cp -p "$(git rev-parse --git-path index)" "$i" 2>/dev/null || rm -f "$i"; } && export GIT_INDEX_FILE="$i" && git add -A && git diff --cached --stat "$1"; }; f'