chore: adopt the NAPALM driver standard (pilot) #52

Merged
christianmanivong merged 4 commits from chore/driver-standard into main 2026-10-22 22:08:14 +00:00
Owner

Summary

napalm-device-types is the first repository to adopt the NAPALM driver standard
(https://git.netork.io/NAPALM/driver-standard, STANDARDS.md). It is the pilot: its
CI is the first run of the shared driver workflow.

Changes

Three commits, to keep the mechanical part apart:

  • style: ruff format and ruff check --fix with the standard's rule set
    (E, F, I, UP, B at 100). 77 files, no behaviour change; two tests that read the
    source text follow the new spelling (list[...]).
  • fix: the rest by hand. Long docstring/command lines wrapped; _NEGATION
    constant in host_firewall (bandit B105 false positive); _known_hosts_file
    takes the key instead of asserting it (B101); nosec B108 for a path on the device.
  • chore: .github/ -> .gitea/workflows/ci.yml calling the shared workflow;
    quality baseline; coverage floor 95 %; CHANGELOG.md; links to git.netork.io;
    SPDX license string (the table form fails setuptools from 2027-02-18).

No version bump: the release (4.22.0, first upload to PyPI) is a separate step.

Related Issue

NetOrk/netork#734

Testing

Locally: 785 tests, coverage 95.15 %, ruff, mypy --strict, bandit clean;
napalm-standard check and ratchet clean; build + twine check --strict pass.

## Summary napalm-device-types is the first repository to adopt the NAPALM driver standard (https://git.netork.io/NAPALM/driver-standard, STANDARDS.md). It is the pilot: its CI is the first run of the shared driver workflow. ## Changes Three commits, to keep the mechanical part apart: - **style**: ruff format and ruff check --fix with the standard's rule set (E, F, I, UP, B at 100). 77 files, no behaviour change; two tests that read the source text follow the new spelling (`list[...]`). - **fix**: the rest by hand. Long docstring/command lines wrapped; `_NEGATION` constant in host_firewall (bandit B105 false positive); `_known_hosts_file` takes the key instead of asserting it (B101); nosec B108 for a path on the device. - **chore**: `.github/` -> `.gitea/workflows/ci.yml` calling the shared workflow; quality baseline; coverage floor 95 %; CHANGELOG.md; links to git.netork.io; SPDX license string (the table form fails setuptools from 2027-02-18). No version bump: the release (4.22.0, first upload to PyPI) is a separate step. ## Related Issue NetOrk/netork#734 ## Testing Locally: 785 tests, coverage 95.15 %, ruff, mypy --strict, bandit clean; `napalm-standard check` and `ratchet` clean; build + `twine check --strict` pass.
christianmanivong added 3 commits 2026-10-22 17:06:40 +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). typing.List/Dict/Optional
become builtin generics and X | None, imports are sorted, the coding cookies
are gone. Two tests that read the source text follow the new spelling.

What ruff cannot fix comes in the next commit.
- Long docstring and command lines are wrapped; recorded device output in
  tests/ keeps its lines (E501 is off there).
- host_firewall: the negation token is the named constant _NEGATION. bandit
  read token == "!" as a hardcoded password.
- ssh_host_keys: _known_hosts_file takes the expected key as an argument
  instead of asserting it; both callers had already returned when it is None.
- ssh_server: the staged path is on the device, not a local temp file
  (nosec B108).
- tests: raise ... from exc, zip(strict=True).
chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 54s
driver / lint (pull_request) Successful in 50s
driver / types (pull_request) Failing after 1m17s
driver / test (3.10) (pull_request) Successful in 1m43s
driver / test (3.11) (pull_request) Failing after 9m18s
driver / test (3.12) (pull_request) Failing after 1m20s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Failing after 1m38s
driver / security (pull_request) Failing after 4m33s
driver / build (pull_request) Failing after 1m29s
CI / driver (pull_request) Failing after 24m6s
driver / publish (pull_request) Skipped
0475184684
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow
  of NAPALM/driver-standard: conformance, ruff, strict mypy, tests on
  3.10-3.13 and at the lowest declared versions, bandit, pip-audit, build,
  and on a release tag the upload to PyPI.
- tests/quality_baseline.json records today's long and complex functions
  and the one file over 1000 lines; they may shrink, not grow.
- Coverage floor 95 % (measured 95.15 %).
- CHANGELOG.md starts here; project links point at git.netork.io; the
  license is the SPDX string PEP 639 wants.
christianmanivong added 1 commit 2026-10-22 19:12:28 +00:00
chore(release): 4.21.1
driver / standard (pull_request) Successful in 36s
driver / lint (pull_request) Successful in 1m12s
driver / types (pull_request) Successful in 1m12s
driver / test (3.10) (pull_request) Successful in 3m3s
driver / test (3.11) (pull_request) Successful in 49s
driver / test (3.12) (pull_request) Successful in 1m53s
driver / test (3.13) (pull_request) Successful in 4m52s
driver / lowest (pull_request) Successful in 26s
driver / security (pull_request) Successful in 3m10s
driver / build (pull_request) Successful in 4m38s
CI / driver (pull_request) Successful in 21m52s
driver / publish (pull_request) Skipped
49830671c9
christianmanivong merged commit 22e4377c2b into main 2026-10-22 22:08:14 +00:00
christianmanivong deleted branch chore/driver-standard 2026-10-22 22:08:14 +00:00
Sign in to join this conversation.