Skip to content

Commit 7cd1336

Browse files
author
Thomas N
committed
chore: switch to mise and uv
1 parent 47c0146 commit 7cd1336

10 files changed

Lines changed: 1187 additions & 1757 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,19 @@ repos:
88
- id: check-added-large-files
99
- id: check-json
1010

11-
- repo: https://github.com/pycqa/isort
12-
rev: 5.9.3
13-
hooks:
14-
- id: isort
15-
name: isort (python)
16-
1711
- repo: local
1812
hooks:
1913
- id: mypy
2014
name: mypy
21-
entry: mypy
15+
entry: uv run mypy
2216
language: system
2317
types: [ python ]
2418

2519
- repo: local
2620
hooks:
2721
- id: pylint
2822
name: pylint
29-
entry: pylint
30-
language: system
31-
types: [ python ]
32-
33-
- repo: local
34-
hooks:
35-
- id: pycodestyle
36-
name: pycodestyle
37-
entry: pycodestyle
38-
args: ["--config=setup.cfg"]
23+
entry: uv run pylint
3924
language: system
4025
types: [ python ]
4126

Makefile

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

gcode_documentation_parser/updater.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def update_documentation(
2828
codes_list = []
2929
ids_to_update = set()
3030
if not self.PARSER_REGISTRY.PARSERS:
31-
raise Exception(f"No parsers have been registered")
31+
raise ValueError(f"No parsers have been registered")
3232
for _id, parser in self.PARSER_REGISTRY.PARSERS.items():
3333
if directories is None:
3434
directory = None
@@ -41,7 +41,7 @@ def update_documentation(
4141
codes_list.append(gcodes)
4242
ids_to_update.add(parser.ID)
4343
if not codes_list:
44-
raise Exception("No sources set to be updated")
44+
raise ValueError("No sources set to be updated")
4545
if set(self.PARSER_REGISTRY.PARSERS) - ids_to_update:
4646
all_codes = self.load_existing_codes(
4747
ids_to_update, output_directory,
@@ -85,7 +85,7 @@ def load_existing_codes(self, ids_to_update, output_directory):
8585
with open(path) as f:
8686
prefix = f.read(len(expected_prefix))
8787
if prefix != expected_prefix:
88-
raise Exception(
88+
raise ValueError(
8989
f"Prefix in JS file ('{prefix}') didn't match expected "
9090
f"prefix ('{expected_prefix}')")
9191
all_codes = json.load(f)

mise.toml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[tools]
2+
pre-commit = "latest"
3+
python = "3.10"
4+
uv = "latest"
5+
6+
[tasks.test]
7+
description = "Run tests"
8+
run = "uv run pytest"
9+
10+
[tasks.clean]
11+
description = "Clean python caches"
12+
run = """
13+
#!/usr/bin/env bash
14+
rm -rf .tox .mypy_cache .pytest_cache
15+
find -name __pycache__ -prune | xargs rm -rf
16+
find -name '*.py[co]' -delete
17+
"""
18+
19+
[tasks.setup]
20+
description = "Install dependencies"
21+
run = "uv sync"
22+
23+
[tasks.lint]
24+
description = "Lint all files"
25+
run = "pre-commit run --all-files"
26+
27+
[tasks.publish-output]
28+
description = "publish output documentation"
29+
run = """
30+
#!/usr/bin/env bash
31+
32+
set -eox pipefail
33+
34+
uv run ./update_documentation.py
35+
rm -rf /tmp/output/
36+
cp -r output/ /tmp/
37+
git fetch --depth=1
38+
git switch output
39+
git clean -f -d
40+
rm -rf output/
41+
mv /tmp/output .
42+
git add -f output/
43+
if git diff --cached --exit-code >/dev/null ; then
44+
echo "No changes to commit"
45+
exit 0
46+
fi
47+
git commit -m "Update documentation output"
48+
git push
49+
"""

0 commit comments

Comments
 (0)