Skip to content

Commit cb526ca

Browse files
authored
fix: added pyproject updates / ruff updates (#28)
* fix: added pyproject updates / ruff updates
1 parent 386a38d commit cb526ca

15 files changed

Lines changed: 102 additions & 15 deletions

File tree

.devcontainer/scripts/load-sample-data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def skip(label, reason):
5757
def load_interface_name_rules_file(filename):
5858
"""Load InterfaceNameRules from a single YAML file."""
5959
from dcim.models import DeviceType, ModuleType, Platform
60+
6061
from netbox_interface_name_rules.models import InterfaceNameRule
6162

6263
rows = load_yaml(filename)
@@ -604,6 +605,7 @@ def load_interface_name_rules_file(filename):
604605
print("🔄 Re-applying device-level interface rules for all VC members…")
605606
try:
606607
from dcim.models import Device
608+
607609
from netbox_interface_name_rules.engine import apply_device_interface_rules
608610

609611
_vc_devices = Device.objects.filter(virtual_chassis__isnull=False).select_related(

.devcontainer/scripts/test-e2e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ def fail(name: str, err: Exception) -> None:
181181

182182
# ── Pre-clean: remove stale modules from test bays (idempotent) ─────
183183
try:
184-
import urllib.request as _ureq_pre
185184
import json as _json_pre
185+
import urllib.request as _ureq_pre
186186

187187
_pre_opener = _ureq_pre.build_opener(_ureq_pre.ProxyHandler({}))
188188
_pre_cookies = ctx.cookies()

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 4
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.{yaml,yml,toml}]
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[Makefile]
18+
indent_style = tab

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# CHANGELOG
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
26

37
<!-- version list -->
48

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# NetBox Interface Name Rules Plugin
22

3+
<p align="center">
4+
<img src="https://raw.githubusercontent.com/marcinpsk/netbox-InterfaceNameRules-plugin/main/docs/icon.svg" alt="NetBox Interface Name Rules" width="80"/>
5+
</p>
6+
37
[![PyPI](https://img.shields.io/pypi/v/netbox-interface-name-rules)](https://pypi.org/project/netbox-interface-name-rules/)
48
[![PyPI - Downloads](https://img.shields.io/pypi/dm/netbox-interface-name-rules)](https://pypi.org/project/netbox-interface-name-rules/)
59
[![CI](https://img.shields.io/github/actions/workflow/status/marcinpsk/netbox-InterfaceNameRules-plugin/test.yaml?branch=main&label=tests)](https://github.com/marcinpsk/netbox-InterfaceNameRules-plugin/actions/workflows/test.yaml)
@@ -49,6 +53,21 @@ Add to `configuration.py`:
4953
PLUGINS = ['netbox_interface_name_rules']
5054
```
5155

56+
## Configuration
57+
58+
Rules are managed through the NetBox UI under **Plugins → Interface Name Rules**, or via the REST API at `/api/plugins/interface-name-rules/rules/`.
59+
60+
See the [full configuration guide](https://marcinpsk.github.io/netbox-InterfaceNameRules-plugin/configuration/) for all rule fields, priority scoring, and template variable reference.
61+
62+
## Screenshots
63+
64+
<p align="center">
65+
<img src="https://raw.githubusercontent.com/marcinpsk/netbox-InterfaceNameRules-plugin/main/docs/screenshots/01-rule-list.png" alt="Rule list" width="700"/>
66+
</p>
67+
<p align="center">
68+
<img src="https://raw.githubusercontent.com/marcinpsk/netbox-InterfaceNameRules-plugin/main/docs/screenshots/11-apply-rule-preview.png" alt="Apply-rules preview" width="700"/>
69+
</p>
70+
5271
## Compatibility
5372

5473
- NetBox ≥ 4.2.0
@@ -67,4 +86,4 @@ Apache 2.0
6786

6887
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to submit code or interface name rules.
6988

70-
Community-contributed rules for various vendors are in the [`contrib/`](contrib/) directory.
89+
Community-contributed rules for various vendors are in the [`contrib/`](contrib/) directory.

REUSE.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ path = [
1212
"netbox_interface_name_rules/migrations/**",
1313
".gitignore",
1414
".envrc",
15+
".editorconfig",
1516
".devcontainer/devcontainer.json",
1617
".devcontainer/.env.example",
1718
".github/copilot-instructions.md",

docs/icon.svg

Lines changed: 23 additions & 0 deletions
Loading

netbox_interface_name_rules/api/serializers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# Copyright (C) 2025 Marcin Zieba <marcinpsk@gmail.com>
3-
from rest_framework import serializers
4-
53
from netbox.api.serializers import NetBoxModelSerializer
4+
from rest_framework import serializers
65

76
from netbox_interface_name_rules.models import InterfaceNameRule
87

netbox_interface_name_rules/engine.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,5 +831,4 @@ def _eval_expr(match):
831831
except (SyntaxError, TypeError) as e:
832832
raise ValueError(f"Invalid arithmetic expression '{expr}': {e}") from e
833833

834-
result = re.sub(r"\{([^}]+)\}", _eval_expr, result)
835-
return result
834+
return re.sub(r"\{([^}]+)\}", _eval_expr, result)

netbox_interface_name_rules/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Copyright (C) 2025 Marcin Zieba <marcinpsk@gmail.com>
33
import re
44

5-
from django import forms
65
from dcim.models import DeviceType, ModuleType, Platform
6+
from django import forms
77
from netbox.forms import NetBoxModelFilterSetForm, NetBoxModelForm, NetBoxModelImportForm
88
from utilities.forms.fields import CSVModelChoiceField
99

0 commit comments

Comments
 (0)