Skip to content

Commit 3b7f03b

Browse files
committed
chore: better attempt at migrating to modern tooling
1 parent dee0ed1 commit 3b7f03b

File tree

6 files changed

+159
-816
lines changed

6 files changed

+159
-816
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
python-version: "3.10"
1919
- name: 🏗 Install build dependencies
2020
run: >-
21-
python -m pip install wheel --user
21+
python -m pip install build --user
2222
- name: 🔨 Build a binary wheel and a source tarball
2323
run: >-
24-
python setup.py sdist bdist_wheel
24+
python -m build
2525
- name: ⬆ Upload build result
2626
uses: actions/upload-artifact@v4
2727
with:
@@ -44,6 +44,23 @@ jobs:
4444
run: |
4545
pre-commit run --all-files --show-diff-on-failure
4646
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+
4764
e2e:
4865
name: 🧪 E2E tests
4966
needs: build

Taskfile.yml

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

pyproject.toml

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,49 @@
11
[build-system]
2-
requires = ["setuptools>=40.8.0", "wheel"]
2+
requires = [
3+
"setuptools>=68",
4+
]
35
build-backend = "setuptools.build_meta"
46

7+
[project]
8+
name = "OctoPrint-FileCheck"
9+
version = "2024.11.12"
10+
description = "Checks for common issues in uploaded files"
11+
authors = [
12+
{ name = "Gina Häußge", email = "[email protected]" },
13+
]
14+
requires-python = ">=3.7,<4"
15+
dependencies = []
16+
dynamic = [
17+
"license",
18+
]
19+
20+
[project.entry-points."octoprint.plugin"]
21+
file_check = "octoprint_file_check"
22+
23+
[project.urls]
24+
Homepage = "https://github.com/OctoPrint/OctoPrint-FileCheck"
25+
26+
[project.optional-dependencies]
27+
develop = [
28+
"pre-commit",
29+
"go-task-bin",
30+
]
31+
32+
[project.readme]
33+
file = "README.md"
34+
content-type = "markdown"
35+
36+
[tool.setuptools]
37+
include-package-data = true
38+
39+
[tool.setuptools.packages.find]
40+
include = [
41+
"octoprint_file_check",
42+
"octoprint_file_check.*",
43+
]
44+
545
[tool.ruff]
646
exclude = [
7-
# standard stuff
847
".bzr",
948
".direnv",
1049
".eggs",
@@ -32,15 +71,20 @@ exclude = [
3271
"site-packages",
3372
"venv",
3473
]
35-
3674
line-length = 90
3775
indent-width = 4
38-
39-
# Assume Python 3.7
4076
target-version = "py37"
4177

4278
[tool.ruff.lint]
43-
select = ["B", "C", "E", "F", "I", "W", "B9"]
79+
select = [
80+
"B",
81+
"C",
82+
"E",
83+
"F",
84+
"I",
85+
"W",
86+
"B9",
87+
]
4488
ignore = [
4589
"E203",
4690
"E231",
@@ -53,9 +97,11 @@ ignore = [
5397
"W605",
5498
"C901",
5599
]
56-
fixable = ["I", "C4", "E"]
57-
58-
# Allow unused variables when underscore-prefixed.
100+
fixable = [
101+
"I",
102+
"C4",
103+
"E",
104+
]
59105
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
60106

61107
[tool.ruff.lint.isort]
@@ -68,17 +114,5 @@ quote-style = "double"
68114
indent-style = "space"
69115
skip-magic-trailing-comma = false
70116
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.
77117
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.
84118
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)