Skip to main content

Practice ยท 1 of 2

Versions are data

Implement parse_version(v), bump(version, part), compare(a, b): - versions are strict MAJOR.MINOR.PATCH digit strings; anything else raises ValueError('invalid semver: <v>') - bump returns the next version as a string; bumping a part resets everything below it (bump('1.2.3', 'minor') == '1.3.0'); unknown part raises ValueError('unknown part: <p>') - compare returns -1/0/1 with numeric (not lexicographic) ordering โ€” '1.10.0' > '1.9.0' This is the versioning contract of the packaging lesson as an executable spec.

Difficulty: advanced

Back to lesson: Practice: Packaging Drills