Skip to content

Commit 642a5e2

Browse files
authored
Merge pull request #104 from tobiasge/prepare-nb-4.1
Prepare for Netbox 4.1
2 parents b3fb7c7 + 501c9ab commit 642a5e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+511
-299
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: "CodeQL"
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
66
pull_request:
77
# The branches below must be a subset of the branches above
8-
branches: [ "main" ]
8+
branches: ["main"]
99
schedule:
10-
- cron: '38 4 * * 2'
10+
- cron: "38 4 * * 2"
1111

1212
jobs:
1313
analyze:
@@ -20,15 +20,15 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
language: [ 'python' ]
23+
language: ["python"]
2424
steps:
25-
- name: Checkout repository
26-
uses: actions/checkout@v4
27-
- name: Initialize CodeQL
28-
uses: github/codeql-action/init@v3
29-
with:
30-
languages: ${{ matrix.language }}
31-
- name: Perform CodeQL Analysis
32-
uses: github/codeql-action/analyze@v3
33-
with:
34-
category: "/language:${{matrix.language}}"
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
- name: Initialize CodeQL
28+
uses: github/codeql-action/init@v3
29+
with:
30+
languages: ${{ matrix.language }}
31+
- name: Perform CodeQL Analysis
32+
uses: github/codeql-action/analyze@v3
33+
with:
34+
category: "/language:${{matrix.language}}"

.github/workflows/linter.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,20 @@ jobs:
1717
# list of changed files within `super-linter`
1818
fetch-depth: 0
1919
- name: Lint Code Base
20-
uses: github/super-linter@v5
20+
uses: github/super-linter@v7
2121
env:
2222
DEFAULT_BRANCH: main
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2424
SUPPRESS_POSSUM: true
2525
VALIDATE_ALL_CODEBASE: false
26+
VALIDATE_CHECKOV: false
27+
VALIDATE_JSCPD: false
28+
VALIDATE_PYTHON_BLACK: false
29+
VALIDATE_PYTHON_ISORT: false
2630
VALIDATE_PYTHON_MYPY: false
31+
VALIDATE_PYTHON_PYINK: false
32+
VALIDATE_PYTHON_PYLINT: false
2733
LINTER_RULES_PATH: /
28-
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
2934
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE)
3035
YAML_CONFIG_FILE: .yamllint.yaml
3136
PYTHON_FLAKE8_CONFIG_FILE: .flake8
32-
PYTHON_ISORT_CONFIG_FILE: pyproject.toml

.github/workflows/release.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@ jobs:
2020
- id: git-checkout
2121
name: Checkout
2222
uses: actions/checkout@v4
23+
- uses: actions/setup-python@v4
24+
with:
25+
python-version: "3.12"
26+
- name: Install uv
27+
run: pip install uv
2328
- id: build-and-publish
2429
name: Build and publish to pypi
25-
uses: JRubics/[email protected]
26-
with:
27-
pypi_token: ${{ secrets.PYPI_TOKEN }}
30+
env:
31+
TWINE_USERNAME: __token__
32+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
33+
TWINE_NON_INTERACTIVE: "true"
34+
run: |
35+
uvx --from build pyproject-build
36+
uvx twine upload dist/*

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ Load data from YAML files into Netbox
55
## Installation
66

77
First activate your virtual environment where Netbox is installed, the install the plugin version correspondig to your Netbox version.
8+
89
```bash
9-
pip install "netbox-initializers==4.0.*"
10+
pip install "netbox-initializers==4.1.*"
1011
```
12+
1113
Then you need to add the plugin to the `PLUGINS` array in the Netbox configuration.
14+
1215
```python
1316
PLUGINS = [
1417
'netbox_initializers',
@@ -29,13 +32,12 @@ After you filled in the data you want to import, the import can be started with
2932
./manage.py load_initializer_data --path /path/for/example/files
3033
```
3134

32-
3335
## Netbox Docker image
3436

3537
The initializers where a part of the Docker image and where then extracted into a Netbox plugin. This was done to split the release cycle of the initializers and the image.
3638
To use the new plugin in a the Netbox Docker image, it musst be installad into the image. To this, the following example can be used as a starting point:
3739

3840
```dockerfile
39-
FROM netboxcommunity/netbox:v4.0
40-
RUN /opt/netbox/venv/bin/pip install "netbox-initializers==4.0.*"
41+
FROM netboxcommunity/netbox:v4.1
42+
RUN /opt/netbox/venv/bin/pip install "netbox-initializers==4.1.*"
4143
```

docs/dev/Release.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Checkout the branch for which the release is to be build. If no branch exists fo
1212

1313
### Set version number
1414

15-
For patch releases the version number in `pyproject.toml` and the `NetBoxInitializersConfig` needs to be updated. If the release is for a new Netbox version additional changes need to be made in `README.md` and `Dockerfile` (for tests).
15+
For patch releases the version number in `src/netbox_initializers/version.py` needs to be updated. If the release is for a new Netbox version additional changes need to be made in `README.md` and `Dockerfile` (for tests).
1616

1717
### Build the release automatically
1818

@@ -25,17 +25,17 @@ After changing the version numbers and committing them create a new release with
2525
Install the needed Python packages for the build:
2626

2727
```bash
28-
pip install --upgrade poetry
28+
pip install --upgrade uv
2929
```
3030

3131
Then run the build for the wheel and source distributions:
3232

3333
```bash
34-
poetry build
34+
uvx --from build pyproject-build --installer uv
3535
```
3636

3737
#### Upload packages to PyPi
3838

3939
```bash
40-
poetry publish
40+
uvx twine upload dist/*
4141
```

pyproject.toml

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,49 @@
1-
[tool.poetry]
2-
authors = ["Tobias Genannt <[email protected]>"]
1+
[project]
2+
name = "netbox-initializers"
3+
authors = [{ name = "Tobias Genannt", email = "[email protected]" }]
34
classifiers = [
45
"Framework :: Django",
56
"Environment :: Plugins",
67
"Topic :: System :: Networking",
7-
"Topic :: System :: Systems Administration"
8+
"Topic :: System :: Systems Administration",
89
]
910
description = "Load initial data into Netbox"
10-
license = "Apache-2.0"
11-
name = "netbox-initializers"
1211
readme = "README.md"
1312
repository = "https://github.com/tobiasge/netbox-initializers"
14-
version = "4.0.0"
13+
license = "Apache-2.0"
14+
dynamic = ["version"]
1515

16-
[tool.poetry.dependencies]
17-
python = "^3.8"
18-
"ruamel.yaml" = "0.18.6"
16+
requires-python = ">=3.10"
17+
dependencies = ["ruamel-yaml>=0.18.6"]
1918

2019
[build-system]
21-
build-backend = "poetry.core.masonry.api"
22-
requires = ["poetry-core"]
20+
requires = ["hatchling"]
21+
build-backend = "hatchling.build"
22+
2323

24-
[tool.black]
25-
line_length = 100
26-
target-version = ['py310']
24+
[tool.hatch.version]
25+
path = "src/netbox_initializers/version.py"
2726

28-
[tool.isort]
29-
line_length = 100
30-
multi_line_output = 3
31-
profile = "black"
27+
[tool.uv]
28+
dev-dependencies = ["ruff==0.6.3"]
29+
30+
[tool.ruff]
31+
line-length = 100
32+
target-version = "py311"
33+
34+
[tool.ruff.lint]
35+
extend-select = ["I", "PL", "W191", "W291", "W292", "W293"]
36+
ignore = ["PLR0912", "PLR0915"]
37+
38+
[tool.ruff.lint.isort]
39+
section-order = [
40+
"future",
41+
"standard-library",
42+
"third-party",
43+
"first-party",
44+
"local-folder",
45+
]
3246

33-
[tool.pylint.format]
34-
max-line-length = "100"
47+
[tool.ruff.format]
48+
docstring-code-format = true
49+
docstring-code-line-length = "dynamic"
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
from netbox.plugins import PluginConfig
22

3+
from netbox_initializers.version import VERSION
4+
35

46
class NetBoxInitializersConfig(PluginConfig):
57
name = "netbox_initializers"
68
verbose_name = "NetBox Initializers"
79
description = "Load initial data into Netbox"
8-
version = "4.0.0"
10+
version = VERSION
911
base_url = "initializers"
10-
min_version = "4.0-beta1"
11-
max_version = "4.0.99"
12+
min_version = "4.1-beta1"
13+
max_version = "4.1.99"
1214

1315

1416
config = NetBoxInitializersConfig

0 commit comments

Comments
 (0)