Skip to content

Draft: Type hinting and Chroot's

Caleb Connolly requested to merge caleb/typed-suffix into master

Introduce a new module: pmb.core to contain explicitly typed pmbootstrap API. The first component being Suffix and SuffixType. This explicitly defines what suffixes are possible, future changes should aim to further constrain this API (e.g. by validating against available device codenames or architectures for buildroot suffixes).

This patch also converts the codebase to use the new Suffix type, and introduces the pathlib Path type for all path handling, to replace the common string building patterns. This is less error prone and can be integrated nicely with the Chroot type to make the code more readable and easier to refactor in the future.

The general idea here is to encapsulate common patterns into type hinted code, and gradually reduce the amount of assumptions made around the codebase so that future changes are easier to implement.

Subtasks

  • convert over codebase and get things running again
  • convert over existing tests
  • validate additional codepaths
Edited by Caleb Connolly

Merge request reports