PackageDict: add source_package, source_version and upgrade_version #85

Open
opened 2026-11-02 21:26:53 +00:00 by christianmanivong · 0 comments
Owner

Priority: P3 (important, not urgent): a typing gap, not a runtime fault.

PackageDict (napalm_device_types/models.py) declares name, version, installed, description, size, source. The Proxmox drivers (and napalm-linux) report three more fields for every installed Debian package, and the application relies on them:

  • source_package: the Debian source package (openssh-server → openssh), needed for OSV/NVD matching.
  • source_version: its version, a different number from the binary's (OSV states Debian ranges in source versions).
  • upgrade_version: the candidate version, "" when none.

Because the contract lacks them, a driver under mypy --strict has to cast its list to list[PackageDict] (napalm-proxmox, host_mixin.get_packages, NAPALM/napalm-proxmox#52), and a reader of the contract cannot tell the fields exist.

Proposal: add the three as NotRequired[str], with the comment on why the source version matters (it is in napalm_proxmox/host_mixin.parse_dpkg_line). Not breaking.

Test-First:

  • get_type_hints(PackageDict) has the three keys; none is required.
Priority: P3 (important, not urgent): a typing gap, not a runtime fault. `PackageDict` (`napalm_device_types/models.py`) declares `name, version, installed, description, size, source`. The Proxmox drivers (and napalm-linux) report three more fields for every installed Debian package, and the application relies on them: - `source_package`: the Debian source package (`openssh-server` → `openssh`), needed for OSV/NVD matching. - `source_version`: its version, a different number from the binary's (OSV states Debian ranges in source versions). - `upgrade_version`: the candidate version, `""` when none. Because the contract lacks them, a driver under `mypy --strict` has to `cast` its list to `list[PackageDict]` (`napalm-proxmox`, `host_mixin.get_packages`, NAPALM/napalm-proxmox#52), and a reader of the contract cannot tell the fields exist. Proposal: add the three as `NotRequired[str]`, with the comment on why the source version matters (it is in `napalm_proxmox/host_mixin.parse_dpkg_line`). Not breaking. Test-First: - [ ] `get_type_hints(PackageDict)` has the three keys; none is required.
christianmanivong added the
prio
P3
tech-debt
labels 2026-11-02 21:26:53 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-device-types#85