Audit & clean up import statements application-wide #10348

Closed
opened 2025-12-29 21:30:22 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Oct 10, 2024).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Audit the code base with ruff to clean up import statements:

  • Remove unused imports (F401)
  • Replace wildcard (*) imports with explicit lists (F403, F405)

Justification

General housekeeping and improvements to code quality

Originally created by @jeremystretch on GitHub (Oct 10, 2024). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Audit the code base with [ruff](https://docs.astral.sh/ruff/) to clean up import statements: * Remove unused imports ([F401](https://docs.astral.sh/ruff/rules/unused-import/)) * ~Replace wildcard (`*`) imports with explicit lists ([F403](https://docs.astral.sh/ruff/rules/undefined-local-with-import-star/), [F405](https://docs.astral.sh/ruff/rules/undefined-local-with-import-star-usage/))~ ### Justification General housekeeping and improvements to code quality
adam added the status: acceptedtype: housekeeping labels 2025-12-29 21:30:22 +01:00
adam closed this issue 2025-12-29 21:30:22 +01:00
Author
Owner

@jeremystretch commented on GitHub (Oct 10, 2024):

It doesn't seem that there's sufficient tangible benefit of removing wildcard imports to justify the effort involved. Instead, we could simply ensure that any module which is imported using a wildcard declares __all__, to ensure only expected resources are imported. (This is already true for most relevant modules.)

@jeremystretch commented on GitHub (Oct 10, 2024): It doesn't seem that there's sufficient tangible benefit of removing wildcard imports to justify the effort involved. Instead, we could simply ensure that any module which is imported using a wildcard declares `__all__`, to ensure only expected resources are imported. (This is already true for most relevant modules.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10348