1 Release 0.2.0

Read the tutorial. Build it yourself is the other way to read this part.

just setup

A release gives users a new version. Before it, we tidy the tests, and after it, the lockfile must name the new version too.

The code before this part. The code after it.

1.1 Tests of edge cases

The file tests/test_empty.py tests one edge case, an empty text. A text of spaces alone is another edge case. One file can test both, so it gets a name that fits both, tests/test_edge.py, and a second test.

A patch to tests/test_edge.py, which renames tests/test_empty.py.

The file tests/test_empty.py is now tests/test_edge.py. Its class is Edge, and its new test test_spaces expects no words in a text of spaces, tabs and a newline.

uv run python -m unittest discover -s tests -q

All four tests pass.

What changed

  • tests/test_edge.py: a new name, and a second test. Renamed from tests/test_empty.py, 4 lines added, 1 removed. The file.
    • look at def test_spaces(self):
The diff of tests/test_edge.py
@@ -3,6 +3,9 @@ import unittest
 from tally import count
 
 
-class Empty(unittest.TestCase):
+class Edge(unittest.TestCase):
     def test_empty(self):
         self.assertEqual(count(""), {})
+
+    def test_spaces(self):
+        self.assertEqual(count("  \n\t "), {})

This change on GitHub. The code after it.

1.2 Version 0.2.0

Users tell one release from another by its version. The version is a line of pyproject.toml.

A patch to pyproject.toml.

In pyproject.toml, the line version now says 0.2.0.

grep -n '^version' pyproject.toml

It prints 3:version = "0.2.0". The lockfile, uv.lock, still names version 0.1.0 of tally, so it is out of date. The next move brings it up to date.

What changed

  • pyproject.toml: the new version. 1 line added, 1 removed. The file.
    • look at version = "0.2.0"
The diff of pyproject.toml
@@ -1,6 +1,6 @@
 [project]
 name = "tally"
-version = "0.1.0"
+version = "0.2.0"
 description = "Count the words in a text"
 readme = "README.md"
 requires-python = ">=3.12"

This change on GitHub. The code after it.

1.3 The lock, and the list of changes

uv.lock records the exact version of each package of the project, tally too. uv lock writes it again from pyproject.toml.

This change came from running uv lock.

A user of a release wants to know what changed. A new file, CHANGES.md, says it for 0.2.0.

A patch to CHANGES.md.

The new file CHANGES.md has a heading for 0.2.0, and says what changed in the tests.

uv lock --check && grep -A1 '^name = "tally"' uv.lock

uv lock --check prints Resolved 1 package and the time it took, and stops with no error, because the lockfile is up to date. Then grep prints the entry of tally, with version = "0.2.0".

What changed

  • CHANGES.md: the changes of 0.2.0. New, 5 lines. The file.
  • uv.lock: the version of tally. 1 line added, 1 removed. It comes from uv lock. The file.
    • look at version = "0.2.0"
The diff of CHANGES.md
@@ -0,0 +1,5 @@
+# Changes
+
+## 0.2.0
+
+The tests of an empty text are now the tests of edge cases, with a test of a text of spaces.

This change on GitHub. The code after it.