chore: adopt the NAPALM driver standard #31

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

Summary

napalm-opnsense 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: the module logger and refresh constants of opnsense.py move below the imports (E402); two long messages wrapped (E501); nosec B104 with a reason for two wildcard addresses that are data (sockstat's * and a route gateway compared with 0.0.0.0), not binds.
  • chore: CI in .gitea/workflows/ci.yml calling the shared driver workflow, .github/ removed; setuptools>=77, SPDX license string, napalm-device-types>=4.21.1, dev extra, git.netork.io URLs; LICENSE, CHANGELOG.md, py.typed; strict mypy with seven modules exempt for now (ha, listening, opnsense, ospf_mixin, ping_mixin, port_forwards, resolver_mixin; 52 errors); quality baseline written; coverage floor 79 %.

Related Issue

Closes #30

Testing

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

## Summary napalm-opnsense 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**: the module logger and refresh constants of `opnsense.py` move below the imports (E402); two long messages wrapped (E501); `nosec B104` with a reason for two wildcard addresses that are data (sockstat's `*` and a route gateway compared with `0.0.0.0`), not binds. - **chore**: CI in `.gitea/workflows/ci.yml` calling the shared driver workflow, `.github/` removed; `setuptools>=77`, SPDX license string, `napalm-device-types>=4.21.1`, dev extra, git.netork.io URLs; LICENSE, CHANGELOG.md, `py.typed`; strict mypy with seven modules exempt for now (`ha`, `listening`, `opnsense`, `ospf_mixin`, `ping_mixin`, `port_forwards`, `resolver_mixin`; 52 errors); quality baseline written; coverage floor 79 %. ## Related Issue Closes #30 ## Testing Locally: 447 tests, coverage 79.20 %, ruff, mypy, bandit clean; `napalm-standard check` and `ratchet` clean; build + `twine check --strict` pass.
christianmanivong added 3 commits 2026-10-23 06:35:27 +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.
- The module logger and the refresh constants of opnsense.py move below
  the imports (E402).
- Two long result messages are wrapped in parentheses (E501).
- nosec for the two wildcard addresses (B104): one is the address
  sockstat reports for "*", the other a route's gateway compared with
  0.0.0.0. Neither binds a socket; both are false positives.
chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 1m38s
driver / test (3.10) (pull_request) Successful in 1m1s
driver / test (3.11) (pull_request) Successful in 52s
driver / test (3.12) (pull_request) Successful in 49s
driver / test (3.13) (pull_request) Successful in 45s
driver / lowest (pull_request) Successful in 29s
driver / security (pull_request) Successful in 47s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Successful in 7m11s
driver / publish (pull_request) Skipped
6e0e206e06
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow
  of NAPALM/driver-standard; .github/ is gone.
- setuptools>=77 with the SPDX license string, no License classifier,
  Python 3.10-3.13 classifiers, napalm-device-types>=4.21.1, a dev extra
  with floors, links to git.netork.io, LICENSE file, py.typed.
- CHANGELOG.md in Keep-a-Changelog form; README names Python 3.10, the
  Gitea clone URL and the new CI.
- mypy strict for the package; exempt for now (52 errors): ha, listening,
  opnsense, ospf_mixin, ping_mixin, port_forwards, resolver_mixin.
  Recorded in the quality baseline with the long and complex functions,
  the 3100-line opnsense.py and one unannotated public method.
- Coverage floor 79 % (measured 79.20 %).
christianmanivong added 1 commit 2026-10-23 08:29:09 +00:00
chore(release): 0.5.0
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 59s
driver / test (3.10) (pull_request) Successful in 1m50s
driver / test (3.11) (pull_request) Successful in 1m9s
driver / test (3.12) (pull_request) Successful in 50s
driver / test (3.13) (pull_request) Successful in 45s
driver / lowest (pull_request) Successful in 29s
driver / security (pull_request) Successful in 45s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Successful in 7m45s
driver / publish (pull_request) Skipped
ae732fd7c8
christianmanivong merged commit 63ce6e78bd into main 2026-10-23 10:37:38 +00:00
christianmanivong deleted branch chore/driver-standard 2026-10-23 10:37:39 +00:00
Sign in to join this conversation.