Checkpoint

Checkpoint: The Release Desk

The Guild's release desk ships new versions of lantern-tools. Each change is labelled as a "fix", a "feature" or a "breaking" change, and the clerk must pick the next version number.

Change Bump 1.9.4 becomes
"fix" PATCH 1.9.5
"feature" MINOR 1.10.0
"breaking" MAJOR 2.0.0

The clerk also gets lists of old release tags and must find the newest one. Some tags are junk, like "banana".

This checkpoint mixes the chapter's skills: reading TOML with tomllib, parsing versions into tuples, and bumping them. parse_version from the lesson is ready for you.

Assignment

  1. next_version(text, change): parse the TOML text, read version from the [project] table, and return the next version string for change (see the table). Raise ValueError for any other change, and also if there's no [project] table.
  2. newest(tags): return the newest tag from the list, as it was written (keep a leading "v"). Skip tags that parse_version rejects. Return None if no tag is valid.