
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
next_version(text, change): parse the TOMLtext, readversionfrom the[project]table, and return the next version string forchange(see the table). RaiseValueErrorfor any other change, and also if there's no[project]table.newest(tags): return the newest tag from the list, as it was written (keep a leading"v"). Skip tags thatparse_versionrejects. ReturnNoneif no tag is valid.
next_version(text, change): parse the TOMLtext, readversionfrom the[project]table, and return the next version string forchange(see the table). RaiseValueErrorfor any other change, and also if there's no[project]table.newest(tags): return the newest tag from the list, as it was written (keep a leading"v"). Skip tags thatparse_versionrejects. ReturnNoneif no tag is valid.
main.py Python sleeping
Press Run to try your code, then Check to test it.