Skip to content

Commit e4e5a3d

Browse files
committed
chore: better attempt at migrating to modern tooling
1 parent ed795cc commit e4e5a3d

File tree

6 files changed

+185
-816
lines changed

6 files changed

+185
-816
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
name: Build pipeline
22
on:
33
push:
4-
branches:
5-
- master
6-
- devel
4+
pull_request:
75
release:
86
types: [released]
7+
workflow_dispatch:
98

109
jobs:
1110
build:
@@ -14,7 +13,7 @@ jobs:
1413
steps:
1514
- uses: actions/checkout@v4
1615
- name: 🏗 Set up Python 3.10
17-
uses: actions/setup-python@v4
16+
uses: actions/setup-python@v5
1817
with:
1918
python-version: "3.10"
2019
- name: 🏗 Install build dependencies
@@ -35,7 +34,7 @@ jobs:
3534
steps:
3635
- uses: actions/checkout@v4
3736
- name: 🏗 Set up Python 3.10
38-
uses: actions/setup-python@v4
37+
uses: actions/setup-python@v5
3938
with:
4039
python-version: "3.10"
4140
- name: 🏗 Set up pre-commit
@@ -45,18 +44,57 @@ jobs:
4544
run: |
4645
pre-commit run --all-files --show-diff-on-failure
4746
47+
test-install:
48+
name: 🧪 Installation test
49+
strategy:
50+
matrix:
51+
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
52+
runs-on: ubuntu-22.04 # change back to ubuntu-latest once we drop Python 3.7
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: 🏗 Set up Python ${{ matrix.python }}
56+
uses: actions/setup-python@v4
57+
with:
58+
python-version: ${{ matrix.python }}
59+
- name: 🚀 Set up test dependencies & run test install
60+
run: |
61+
pip install octoprint
62+
pip install -e .[develop]
63+
64+
e2e:
65+
name: 🧪 E2E tests
66+
needs: build
67+
runs-on: ubuntu-22.04 # change back to ubuntu-latest once we drop Python 3.7 & upgrade playwright
68+
strategy:
69+
matrix:
70+
octoprint: ["master", "maintenance"]
71+
steps:
72+
- name: ⬇ Download build result
73+
uses: actions/download-artifact@v4
74+
with:
75+
name: dist
76+
path: dist
77+
78+
- name: 🎭 Run OctoPrint's E2E Tests
79+
uses: OctoPrint/actions/e2e@main
80+
with:
81+
ref: ${{ matrix.octoprint }}
82+
deps: ${{ github.workspace }}/dist/*.whl
83+
suffix: "-${{ matrix.octoprint }}"
84+
4885
publish-on-testpypi:
4986
name: 📦 Publish on TestPyPI
5087
if: github.event_name == 'release'
5188
needs:
5289
- build
5390
- pre-commit
91+
- e2e
5492
runs-on: ubuntu-latest
93+
permissions:
94+
id-token: write
5595
environment:
5696
name: testpypi
5797
url: https://test.pypi.org/p/OctoPrint-FirmwareCheck
58-
permissions:
59-
id-token: write
6098
steps:
6199
- name: ⬇ Download build result
62100
uses: actions/download-artifact@v4
@@ -73,11 +111,11 @@ jobs:
73111
if: github.event_name == 'release'
74112
needs: publish-on-testpypi
75113
runs-on: ubuntu-latest
114+
permissions:
115+
id-token: write
76116
environment:
77117
name: pypi
78118
url: https://pypi.org/p/OctoPrint-FirmwareCheck
79-
permissions:
80-
id-token: write
81119
steps:
82120
- name: ⬇ Download build result
83121
uses: actions/download-artifact@v4

Taskfile.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# https://taskfile.dev
2+
3+
version: "3"
4+
5+
env:
6+
LOCALES: ["de"] # list your included locales here, e.g. ["de", "fr"]
7+
TRANSLATIONS: "octoprint_firmware_check/translations" # translations folder, do not touch
8+
9+
tasks:
10+
install:
11+
desc: Installs the plugin into the current venv
12+
cmds:
13+
- "python -m pip install -e .[develop]"
14+
15+
### Build related
16+
17+
build:
18+
desc: Builds sdist & wheel
19+
cmds:
20+
- python -m build --sdist --wheel
21+
22+
build-sdist:
23+
desc: Builds sdist
24+
cmds:
25+
- python -m build --sdist
26+
27+
build-wheel:
28+
desc: Builds wheel
29+
cmds:
30+
- python -m build --wheel
31+
32+
### Translation related
33+
34+
babel-new:
35+
desc: Create a new translation for a locale
36+
cmds:
37+
- task: babel-extract
38+
- |
39+
pybabel init --input-file=translations/messages.pot --output-dir=translations --locale="{{ .CLI_ARGS }}"
40+
41+
babel-extract:
42+
desc: Update pot file from source
43+
cmds:
44+
- pybabel extract --mapping-file=babel.cfg --output-file=translations/messages.pot [email protected] --copyright-holder="The OctoPrint Project" .
45+
46+
babel-update:
47+
desc: Update translation files from pot file
48+
cmds:
49+
- for:
50+
var: LOCALES
51+
cmd: pybabel update --input-file=translations/messages.pot --output-dir=translations --locale={{ .ITEM }}
52+
53+
babel-refresh:
54+
desc: Update translation files from source
55+
cmds:
56+
- task: babel-extract
57+
- task: babel-update
58+
59+
babel-compile:
60+
desc: Compile translation files
61+
cmds:
62+
- pybabel compile --directory=translations
63+
64+
babel-bundle:
65+
desc: Bundle translations
66+
preconditions:
67+
- test -d {{ .TRANSLATIONS }}
68+
cmds:
69+
- for:
70+
var: LOCALES
71+
cmd: |
72+
locale="{{ .ITEM }}"
73+
source="translations/${locale}"
74+
target="{{ .TRANSLATIONS }}/${locale}"
75+
76+
[ ! -d "${target}" ] || rm -r "${target}"
77+
78+
echo "Copying translations for locale ${locale} from ${source} to ${target}..."
79+
cp -r "${source}" "${target}"

pyproject.toml

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,50 @@
11
[build-system]
2-
requires = ["setuptools>=40.8.0", "wheel"]
2+
requires = [
3+
"setuptools>=40.8.0",
4+
"wheel",
5+
]
36
build-backend = "setuptools.build_meta"
47

8+
[project]
9+
name = "OctoPrint-FirmwareCheck"
10+
version = "2025.05.14"
11+
description = "Checks for unsafe or broken printer firmwares"
12+
authors = [
13+
{ name = "Gina Häußge", email = "[email protected]" },
14+
]
15+
requires-python = ">=3.7,<4"
16+
dependencies = []
17+
dynamic = [
18+
"license",
19+
]
20+
21+
[project.entry-points."octoprint.plugin"]
22+
firmware_check = "octoprint_firmware_check"
23+
24+
[project.urls]
25+
Homepage = "https://github.com/OctoPrint/OctoPrint-FirmwareCheck"
26+
27+
[project.optional-dependencies]
28+
develop = [
29+
"pre-commit",
30+
"go-task-bin",
31+
]
32+
33+
[project.readme]
34+
file = "README.md"
35+
content-type = "markdown"
36+
37+
[tool.setuptools]
38+
include-package-data = true
39+
40+
[tool.setuptools.packages.find]
41+
include = [
42+
"octoprint_firmware_check",
43+
"octoprint_firmware_check.*",
44+
]
45+
546
[tool.ruff]
647
exclude = [
7-
# standard stuff
848
".bzr",
949
".direnv",
1050
".eggs",
@@ -32,15 +72,20 @@ exclude = [
3272
"site-packages",
3373
"venv",
3474
]
35-
3675
line-length = 90
3776
indent-width = 4
38-
39-
# Assume Python 3.7
4077
target-version = "py37"
4178

4279
[tool.ruff.lint]
43-
select = ["B", "C", "E", "F", "I", "W", "B9"]
80+
select = [
81+
"B",
82+
"C",
83+
"E",
84+
"F",
85+
"I",
86+
"W",
87+
"B9",
88+
]
4489
ignore = [
4590
"E203",
4691
"E231",
@@ -53,9 +98,11 @@ ignore = [
5398
"W605",
5499
"C901",
55100
]
56-
fixable = ["I", "C4", "E"]
57-
58-
# Allow unused variables when underscore-prefixed.
101+
fixable = [
102+
"I",
103+
"C4",
104+
"E",
105+
]
59106
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
60107

61108
[tool.ruff.lint.isort]
@@ -68,17 +115,5 @@ quote-style = "double"
68115
indent-style = "space"
69116
skip-magic-trailing-comma = false
70117
line-ending = "lf"
71-
72-
# Enable auto-formatting of code examples in docstrings. Markdown,
73-
# reStructuredText code/literal blocks and doctests are all supported.
74-
#
75-
# This is currently disabled by default, but it is planned for this
76-
# to be opt-out in the future.
77118
docstring-code-format = false
78-
79-
# Set the line length limit used when formatting code snippets in
80-
# docstrings.
81-
#
82-
# This only has an effect when the `docstring-code-format` setting is
83-
# enabled.
84119
docstring-code-line-length = "dynamic"

requirements.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)