Fixes #21407: Enable Ruff isort rules for consistent import ordering #333

Closed
opened 2026-04-05 16:26:21 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @pheus on 2/17/2026

Fixes: #21407

This PR enables Ruff’s I (isort) rules to standardize import ordering across the codebase.

  • Adopt Ruff I (isort) rules for consistent import sorting
  • Update a few imports to use relative imports within their Django apps to avoid circular-import issues exposed by sorting
  • Add two # isort: split boundaries to keep required imports pinned in order-dependent __init__.py modules

For easier review, the only manual edits are in:

  • ruff.toml
  • netbox/netbox/api/serializers/__init__.py
  • netbox/core/models/__init__.py

Thanks for reviewing! The changes should be purely stylistic/organizational with no intended runtime behavior changes beyond stabilizing import initialization order.

*Originally created by @pheus on 2/17/2026* ### Fixes: #21407 This PR enables Ruff’s `I` (isort) rules to standardize import ordering across the codebase. - Adopt Ruff `I` (isort) rules for consistent import sorting - Update a few imports to use relative imports within their Django apps to avoid circular-import issues exposed by sorting - Add two `# isort: split` boundaries to keep required imports pinned in order-dependent `__init__.py` modules For easier review, the only manual edits are in: - `ruff.toml` - `netbox/netbox/api/serializers/__init__.py` - `netbox/core/models/__init__.py` Thanks for reviewing! The changes should be purely stylistic/organizational with no intended runtime behavior changes beyond stabilizing import initialization order.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#333