Skip to content

Commit f8f0345

Browse files
committed
chore: migrate to modern tooling
1 parent 8aaa8e6 commit f8f0345

6 files changed

Lines changed: 131 additions & 810 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
python-version: "3.10"
2020
- name: 🏗 Install build dependencies
2121
run: >-
22-
python -m pip install wheel --user
22+
python -m pip install wheel build --user
2323
- name: 🔨 Build a binary wheel and a source tarball
2424
run: >-
25-
python setup.py sdist bdist_wheel
25+
python -m build
2626
- name: ⬆ Upload build result
2727
uses: actions/upload-artifact@v4
2828
with:

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 --msgid-bugs-address=i18n@octoprint.org --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: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,44 @@
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 = "gina@octoprint.org" },
14+
]
15+
license = "AGPL-3.0-or-later"
16+
requires-python = ">=3.7,<4"
17+
dependencies = []
18+
19+
[project.entry-points."octoprint.plugin"]
20+
firmware_check = "octoprint_firmware_check"
21+
22+
[project.urls]
23+
Homepage = "https://github.com/OctoPrint/OctoPrint-FirmwareCheck"
24+
25+
[project.optional-dependencies]
26+
develop = [
27+
"go-task-bin",
28+
]
29+
30+
[project.readme]
31+
file = "README.md"
32+
content-type = "markdown"
33+
34+
[tool.setuptools]
35+
include-package-data = true
36+
packages = [
37+
"octoprint_firmware_check",
38+
]
39+
540
[tool.ruff]
641
exclude = [
7-
# standard stuff
842
".bzr",
943
".direnv",
1044
".eggs",
@@ -32,15 +66,20 @@ exclude = [
3266
"site-packages",
3367
"venv",
3468
]
35-
3669
line-length = 90
3770
indent-width = 4
38-
39-
# Assume Python 3.7
4071
target-version = "py37"
4172

4273
[tool.ruff.lint]
43-
select = ["B", "C", "E", "F", "I", "W", "B9"]
74+
select = [
75+
"B",
76+
"C",
77+
"E",
78+
"F",
79+
"I",
80+
"W",
81+
"B9",
82+
]
4483
ignore = [
4584
"E203",
4685
"E231",
@@ -53,9 +92,11 @@ ignore = [
5392
"W605",
5493
"C901",
5594
]
56-
fixable = ["I", "C4", "E"]
57-
58-
# Allow unused variables when underscore-prefixed.
95+
fixable = [
96+
"I",
97+
"C4",
98+
"E",
99+
]
59100
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
60101

61102
[tool.ruff.lint.isort]
@@ -68,17 +109,5 @@ quote-style = "double"
68109
indent-style = "space"
69110
skip-magic-trailing-comma = false
70111
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.
77112
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.
84113
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)