WindowsPackageDict redeclares architecture, which napalm-device-types 4.59.0 makes an inherited NotRequired key #14

Closed
opened 2026-12-05 00:32:11 +00:00 by christianmanivong · 0 comments
Owner

napalm-device-types 4.59.0 (NAPALM/napalm-device-types#149, for NetOrk/netork#2907) adds architecture: NotRequired[str] to PackageDict. WindowsPackageDict in napalm_windows/packages.py (0.3.0, 61bbf91) redeclares architecture: str, and strict mypy refuses to narrow an inherited key:

napalm_windows/packages.py:73: error: Field "architecture" can be deleted in base class "PackageDict"  [misc]
napalm_windows/packages.py:107: error: Argument 1 to "list" has incompatible type "list[WindowsPackageDict]"; expected "Iterable[PackageDict]"  [arg-type]

Checked against that branch: mypy on 61bbf91 fails with the two errors above; the 637 tests pass, so nothing breaks at runtime. Because the floor is napalm-device-types>=4.56.0, CI on main goes red at mypy as soon as 4.59.0 reaches PyPI.

Fix: once 4.59.0 is out, drop the redeclaration from WindowsPackageDict, since the key is now inherited from PackageDict, and raise the floor to napalm-device-types>=4.59.0. Also leave architecture out when the Uninstall key names none, where _package currently writes "". The contract says a driver that cannot tell leaves the key out. The sort in parse_packages then reads p.get("architecture", "").

Priority: P3: no runtime effect, but CI on main stays red until this lands.

napalm-device-types 4.59.0 (NAPALM/napalm-device-types#149, for NetOrk/netork#2907) adds `architecture: NotRequired[str]` to `PackageDict`. `WindowsPackageDict` in `napalm_windows/packages.py` (0.3.0, 61bbf91) redeclares `architecture: str`, and strict mypy refuses to narrow an inherited key: ``` napalm_windows/packages.py:73: error: Field "architecture" can be deleted in base class "PackageDict" [misc] napalm_windows/packages.py:107: error: Argument 1 to "list" has incompatible type "list[WindowsPackageDict]"; expected "Iterable[PackageDict]" [arg-type] ``` Checked against that branch: mypy on 61bbf91 fails with the two errors above; the 637 tests pass, so nothing breaks at runtime. Because the floor is `napalm-device-types>=4.56.0`, CI on `main` goes red at mypy as soon as 4.59.0 reaches PyPI. **Fix:** once 4.59.0 is out, drop the redeclaration from `WindowsPackageDict`, since the key is now inherited from `PackageDict`, and raise the floor to `napalm-device-types>=4.59.0`. Also leave `architecture` out when the Uninstall key names none, where `_package` currently writes `""`. The contract says a driver that cannot tell leaves the key out. The sort in `parse_packages` then reads `p.get("architecture", "")`. **Priority:** P3: no runtime effect, but CI on `main` stays red until this lands.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-windows#14