Skip to content

Commit c54a675

Browse files
committed
fix: updated hooks and ci
1 parent f323692 commit c54a675

5 files changed

Lines changed: 21 additions & 20 deletions

File tree

.github/workflows/python-lint.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ on:
1111
- 'packages/python/**'
1212
- '.github/workflows/python-lint.yml'
1313

14-
defaults:
15-
run:
16-
working-directory: packages/python
17-
1814
jobs:
1915
lint:
2016
name: Lint
@@ -29,10 +25,7 @@ jobs:
2925
run: uv python install 3.11
3026

3127
- name: Install dependencies
32-
run: uv sync --extra dev
33-
34-
- name: Run ruff
35-
run: uv run ruff check .
28+
run: uv --project packages/python sync --all-extras
3629

37-
- name: Run mypy
38-
run: uv run mypy src/epaper_dithering
30+
- name: Run prek
31+
run: uv --project packages/python run prek run --all-files --config packages/python/.pre-commit-config.yaml

packages/python/.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ repos:
44
- id: ruff
55
name: ruff
66
language: system
7-
entry: uv --project packages/python run ruff check --fix --config=packages/python/pyproject.toml
8-
types: [python]
7+
entry: uv --project packages/python run ruff check --fix --config=packages/python/pyproject.toml packages/python
8+
pass_filenames: false
99
- id: ruff-format
1010
name: ruff-format
1111
language: system
12-
entry: uv --project packages/python run ruff format --config=packages/python/pyproject.toml
13-
types: [python]
12+
entry: uv --project packages/python run ruff format --config=packages/python/pyproject.toml packages/python
13+
pass_filenames: false
1414
- id: mypy
1515
name: mypy
1616
language: system

packages/python/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# epaper-dithering
22

33
[![PyPI](https://img.shields.io/pypi/v/epaper-dithering?style=flat-square)](https://pypi.org/project/epaper-dithering/)
4-
[![Python Tests](https://img.shields.io/github/actions/workflow/status/OpenDisplay-org/epaper-dithering/python-test.yml?style=flat-square&label=tests)](https://github.com/OpenDisplay-org/epaper-dithering/actions/workflows/python-test.yml)
5-
[![Python Lint](https://img.shields.io/github/actions/workflow/status/OpenDisplay-org/epaper-dithering/python-lint.yml?style=flat-square&label=lint)](https://github.com/OpenDisplay-org/epaper-dithering/actions/workflows/python-lint.yml)
4+
[![Python](https://img.shields.io/pypi/pyversions/epaper-dithering?style=flat-square)](https://pypi.org/project/epaper-dithering/)
5+
[![License](https://img.shields.io/github/license/OpenDisplay-org/epaper-dithering?style=flat-square)](LICENSE)
6+
[![Tests](https://img.shields.io/github/actions/workflow/status/OpenDisplay-org/epaper-dithering/python-test.yml?style=flat-square&label=tests)](https://github.com/OpenDisplay-org/epaper-dithering/actions/workflows/python-test.yml)
7+
[![Lint](https://img.shields.io/github/actions/workflow/status/OpenDisplay-org/epaper-dithering/python-lint.yml?style=flat-square&label=lint)](https://github.com/OpenDisplay-org/epaper-dithering/actions/workflows/python-lint.yml)
8+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square)](https://github.com/astral-sh/ruff)
9+
[![mypy](https://img.shields.io/badge/mypy-strict-blue?style=flat-square)](https://mypy.readthedocs.io/)
610

711
Dithering algorithms optimized for e-ink/e-paper displays with limited color palettes.
812

packages/python/pyproject.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ strict = true
6262
warn_return_any = true
6363
warn_unused_configs = true
6464

65+
6566
[tool.pylint.format]
6667
max-line-length = 120
6768

@@ -80,10 +81,13 @@ max-branches = 15
8081

8182
[tool.pylint.messages_control]
8283
disable = [
83-
"fixme", # TODO comments are fine
84-
"duplicate-code", # algorithmic variants share structure by design
85-
"consider-using-enumerate", # numpy indexing patterns don't benefit from enumerate
84+
"fixme", # TODO comments are fine
85+
"duplicate-code", # algorithmic variants share structure by design
86+
"consider-using-enumerate", # numpy indexing patterns don't benefit from enumerate
8687
"consider-using-max-builtin", # explicit comparison is clearer for float edge cases
88+
"import-outside-toplevel", # pytest lazy imports in test methods
89+
"too-few-public-methods", # single-test test classes are fine
90+
"too-many-function-args", # false positives from pylint path resolution in monorepo
8791
]
8892

8993
[tool.pytest.ini_options]

packages/python/tests/test_kernels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_offsets_are_forward_only(self, kernel):
5959
For left-to-right scanning: dx > 0 on same row (dy=0),
6060
or any dx on future rows (dy > 0).
6161
"""
62-
for dx, dy, weight in kernel.offsets:
62+
for dx, dy, _weight in kernel.offsets:
6363
assert dy >= 0, f"{kernel.name}: offset ({dx},{dy}) points backwards"
6464
if dy == 0:
6565
assert dx > 0, f"{kernel.name}: offset ({dx},{dy}) on current row must be forward"

0 commit comments

Comments
 (0)