-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
Description
Proposed Changes
- Adopt Ruff as the single linter+formatter (
ruff check+ruff format). - Remove legacy tools and their configs:
flake8(and delete the.flake8file)blackisortpyupgradeadd-trailing-commapylintconfig (if present)
- Pre-commit:
- Replace the above hooks with Ruff hooks only:
ruff format(autofix on local)ruff check(with--fixlocally;--diff/no-fix in CI)
- Replace the above hooks with Ruff hooks only:
- pyproject.toml:
- Remove any
[tool.black],[tool.isort],[tool.ruff],[tool.pylint]sections sopyproject.tomlcontains only project/build metadata. - Make
ruff.tomlthe single source of truth for Ruff settings.
- Remove any
- Ruff configuration:
- Copy and adapt the Ruff configuration from the ACI plugin:
- Source:
pheus/netbox-aci-plugin→ruff.toml
https://github.com/pheus/netbox-aci-plugin/blob/main/ruff.toml - Adjust paths/module names for this repo (e.g.,
src = ["netbox_acls", "tests"], excludes likeenv/,docs/, etc. as appropriate).
- Source:
- Copy and adapt the Ruff configuration from the ACI plugin:
- CI:
- Update GitHub Actions (and any Makefile targets) to run only Ruff:
ruff format --check .ruff check .
- Remove any steps invoking removed tools.
- Update GitHub Actions (and any Makefile targets) to run only Ruff:
- Docs:
- Update
CONTRIBUTING.md/ README references to mention Ruff + pre-commit and drop mentions of Black/Flake8/Isort/PyUpgrade. - Example contributor setup:
python -m pip install ruff pre-commit pre-commit install
- Update
Justification
- Single, fast toolchain: Ruff replaces the combined roles of Flake8/Isort/PyUpgrade and can format code à la Black, reducing maintenance and speeding up local dev and CI.
- Consistency with other NetBox plugins: Aligns the style with
netbox-aci-pluginand simplifies cross-repo contributions. - Matches current NetBox dev guidance: NetBox docs demonstrate using Ruff + pre-commit as the standard developer workflow.
- Lower config complexity: One
ruff.tomlat the root avoids conflicting settings spread across multiple tools andpyproject.toml.
Tasks / Checklist
- Delete
.flake8. - Remove
black,flake8,isort,pyupgrade,add-trailing-commahooks from.pre-commit-config.yaml. - Keep only Ruff hooks:
-
ruff format(local autofix) -
ruff check(local--fix; CI--diff)
-
- Remove
[tool.black],[tool.isort],[tool.ruff],[tool.pylint]frompyproject.toml(if present). - Add/align
ruff.tomlusing the config fromnetbox-aci-plugin, adjusted fornetbox_acls. - Ensure
make lint(or equivalent) uses Ruff only. - Update GitHub Actions to run Ruff only.
- Update contributor docs to Ruff + pre-commit.
- Run repository‑wide
ruff format+ruff check --fixand commit style‑only changes.
References
- ACI plugin Ruff config (example to copy):
https://github.com/pheus/netbox-aci-plugin/blob/main/ruff.toml - NetBox developer docs (Ruff + pre‑commit in the workflow):
https://netboxlabs.com/docs/netbox/development/getting-started/ - Ruff configuration reference:
https://docs.astral.sh/ruff/configuration/