Description
NetBox version
v4.3.1
Feature type
Change to existing functionality
Proposed functionality
I'm proposing ignoring the "No type or annotation" warnings from griffe
(mkdocs build
) outputs in upgrade.sh
.
It can be done by replacing the current
COMMAND="mkdocs build"
with
COMMAND="mkdocs build 2> >(grep -v 'No type or annotation for parameter')"
Output of that section after the change:
Building documentation (mkdocs build 2> >(grep -v 'No type or annotation for parameter'))...
INFO - Cleaning site directory
INFO - Building documentation to directory: /opt/netbox/netbox/project-static/docs
INFO - Documentation built in 10.11 seconds
(= there are no type/annotation warnings anymore)
AFAIK, there is no way to suppress those natively in griffe while still keeping the INFO level outputs. (In mkdocs build
there is a "-q, --quiet: Silence warnings" option but it silences everything, not just warnings. Since the run takes that long, I believe the full mute is not feasible here.)
Alternatively, types or annotations could be added in the NetBox source files+parameters shown in the griffe warnings. This solution above could still be implemented as a fast solution while the type/annotation addition is in the works.
Use case
When running upgrade.sh
, in the "Building documentation (mkdocs build)..." phase, there are 60+ lines of this kind of output:
WARNING - griffe: netbox/netbox/jobs.py:50: No type or annotation for parameter 'job'
WARNING - griffe: netbox/netbox/jobs.py:143: No type or annotation for parameter 'instance'
WARNING - griffe: netbox/netbox/jobs.py:144: No type or annotation for parameter 'schedule_at'
WARNING - griffe: netbox/netbox/jobs.py:145: No type or annotation for parameter 'interval'
...
It distracts the NetBox administrator running the upgrade.sh
task when upgrading NetBox, and does not provide any meaningful or actionable outputs for the administrator.
Database changes
None
External dependencies
None (upgrade.sh
already requires bash and grep, and the redirection syntax is working with bash)