chore: adopt the NAPALM driver standard #33

Merged
christianmanivong merged 4 commits from chore/driver-standard into main 2026-10-23 12:17:27 +00:00
Owner

Summary

napalm-proxmox adopts the NAPALM driver standard (https://git.netork.io/NAPALM/driver-standard).
Epic: NAPALM/driver-standard#2.

Changes

  • style: ruff format and ruff check --fix with the standard's rule set (E, F, I, UP, B, line length 100, Python 3.10). Mechanical.
  • fix: logger after the imports (E402); the lazy paramiko client annotated Any like _node_ssh (F821); unused locals removed; long command lines split into adjacent literals (unchanged on the wire); get_vm_status re-raises from e; the two except Exception: pass (closing the SSH session, the is_alive probe) log at debug level (bandit B110); justified nosec B105 for the empty password field of NAPALM's get_users shape and the ssh_password_auth flag; tests: unused loop variables.
  • chore: CI moves to .gitea/workflows/ci.yml (shared driver workflow) with pre-install of napalm-device-types from git until 4.22.0 is on PyPI (the floor stays at 4.22.0), .github/ removed; requires-python >=3.10, SPDX license, py.typed, dev extra, git.netork.io links, CHANGELOG entry; strict mypy with eleven modules exempt for now (204 errors), quality baseline, coverage floor 68 %.

Related Issue

Closes #32

Testing

Locally: 343 tests, coverage 68.94 %, ruff, mypy, bandit clean; napalm-standard check and ratchet clean; build + twine check --strict pass. Fixtures only; napalm-device-types 4.22.0 from git.

## Summary napalm-proxmox adopts the NAPALM driver standard (https://git.netork.io/NAPALM/driver-standard). Epic: NAPALM/driver-standard#2. ## Changes - **style**: ruff format and `ruff check --fix` with the standard's rule set (E, F, I, UP, B, line length 100, Python 3.10). Mechanical. - **fix**: logger after the imports (E402); the lazy paramiko client annotated `Any` like `_node_ssh` (F821); unused locals removed; long command lines split into adjacent literals (unchanged on the wire); `get_vm_status` re-raises `from e`; the two `except Exception: pass` (closing the SSH session, the `is_alive` probe) log at debug level (bandit B110); justified `nosec B105` for the empty `password` field of NAPALM's `get_users` shape and the `ssh_password_auth` flag; tests: unused loop variables. - **chore**: CI moves to `.gitea/workflows/ci.yml` (shared driver workflow) with `pre-install` of napalm-device-types from git until 4.22.0 is on PyPI (the floor stays at 4.22.0), `.github/` removed; `requires-python >=3.10`, SPDX license, `py.typed`, dev extra, git.netork.io links, CHANGELOG entry; strict mypy with eleven modules exempt for now (204 errors), quality baseline, coverage floor 68 %. ## Related Issue Closes #32 ## Testing Locally: 343 tests, coverage 68.94 %, ruff, mypy, bandit clean; `napalm-standard check` and `ratchet` clean; build + `twine check --strict` pass. Fixtures only; napalm-device-types 4.22.0 from git.
christianmanivong added 3 commits 2026-10-23 06:40:52 +00:00
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM
driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff
cannot fix comes in the next commit.
- driver.py: the logger is defined after the imports (E402). The lazy
  paramiko client is annotated Any, as _node_ssh already is; the quoted
  paramiko.SSHClient named a module that is never imported there (F821).
- Unused locals are gone: get_facts' hostname, get_users' groups (both
  read a value nobody used), the ARP flags column is _flags; the output is
  unchanged.
- Long lines are wrapped: the apt-get and snmpd.conf commands are split
  into adjacent string literals, the power-action error message and the
  system mixin's docstring are wrapped; the text is unchanged.
- get_vm_status re-raises with raise ... from e (B904).
- The two except Exception: pass (closing the SSH session, the is_alive
  probe) now log at debug level (B110), so a swallowed failure leaves a
  trace.
- nosec for the empty "password" field of NAPALM's get_users shape and
  the ssh_password_auth flag (B105); all three are false positives.
- tests: unused loop variables.
chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Failing after 53s
driver / test (3.10) (pull_request) Failing after 44s
driver / test (3.11) (pull_request) Failing after 1m6s
driver / test (3.12) (pull_request) Failing after 47s
driver / test (3.13) (pull_request) Failing after 36s
driver / lowest (pull_request) Failing after 19s
driver / security (pull_request) Failing after 46s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Failing after 6m3s
driver / publish (pull_request) Skipped
457c1ca7ed
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow
  of NAPALM/driver-standard; .github/ is gone. napalm-device-types comes
  from git until 4.22.0 (AptProxyMixin) is on PyPI; the floor stays at
  4.22.0.
- requires-python >=3.10 (napalm-device-types needs it), py.typed, SPDX
  license string, a dev extra with floors (pytest-mock and responses are
  dropped: no test uses them), links to git.netork.io (README included).
  pytest no longer adds --cov by itself; CI passes it.
- mypy strict for the package; exempt for now, with 204 errors between
  them: napalm_proxmox.config_mixin, .driver, .interfaces_mixin,
  .lldp_mixin, .routing_mixin, .sdn_mixin, .system_mixin, .utils,
  .vm_contract_mixin, .vm_mixin and .vm_provision_mixin. They are recorded
  in the quality baseline with the long and complex functions and the two
  unannotated public methods.
- Coverage floor 68 % (measured 68.94 %).
christianmanivong added 1 commit 2026-10-23 10:02:12 +00:00
chore(release): 0.8.0
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 59s
driver / test (3.10) (pull_request) Successful in 1m13s
driver / test (3.11) (pull_request) Successful in 1m18s
driver / test (3.12) (pull_request) Successful in 1m6s
driver / test (3.13) (pull_request) Successful in 59s
driver / lowest (pull_request) Successful in 45s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m9s
CI / driver (pull_request) Successful in 3m29s
driver / publish (pull_request) Skipped
711d5f2705
christianmanivong merged commit f3639d9990 into main 2026-10-23 12:17:27 +00:00
christianmanivong deleted branch chore/driver-standard 2026-10-23 12:17:27 +00:00
Sign in to join this conversation.