Skip to content

Commit 806829c

Browse files
committed
PPPSYS-56851 Run Ruff in CI and add pyproject lint config
1 parent c4ea03c commit 806829c

5 files changed

Lines changed: 74 additions & 6 deletions

File tree

.github/workflows/lint.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@ jobs:
99
timeout-minutes: 10
1010
steps:
1111
- name: Check out repository code
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v4
1313

14-
- name: Run linters
15-
uses: PiwikPRO/actions/python/lint@master
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@eb1897b8dc4b5d5bfe39a428a8f2304605e0983c
1616
with:
17-
use-black: true
18-
use-flake: true
19-
use-isort: true
17+
version: "latest"
18+
enable-cache: true
19+
cache-dependency-glob: |
20+
pyproject.toml
21+
uv.lock
22+
23+
- name: Sync dev dependencies
24+
run: uv sync --frozen --group dev-local
25+
26+
- name: Run ruff linting
27+
run: uv run ruff check . --config pyproject.toml
28+
29+
- name: Check ruff formatting
30+
run: uv run ruff format --check . --config pyproject.toml

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- PPPSYS-56851 Require Python 3.10 or newer (3.9 and older are end-of-life); CI tests 3.10 through 3.14
66
- PPPSYS-56851 Migrated packaging and CI from Poetry to uv (PEP 621, setuptools, committed `uv.lock`); PyPI releases use `uv publish`.
77
- PPPSYS-56851 Added local multi-version testing with tox (`tox.ini`, environments `py310``py314` aligned with CI); optional `dev-local` uv dependency group installs tox and tox-uv (see README).
8+
- PPPSYS-56851 Replaced legacy Black/Flake8/isort GitHub Action with **Ruff** (`ruff check` / `ruff format --check` in CI; configuration in `pyproject.toml`).
89

910
## [5.2.1] - 2023-11-09
1011

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Use `uv run tox -e py312` for one version, or `uv run tox -- test_main.py -q` to
2020

2121
If you skip `dev-local`, use `uvx tox` or a globally installed `tox` against this `tox.ini` (install **tox-uv** alongside tox if your default interpreter comes from uv and tox envs fail to start).
2222

23+
Lint and format with [Ruff](https://docs.astral.sh/ruff/) (same style as the Piwik PRO MCP repo): `uv run ruff check .` and `uv run ruff format .` (CI runs `ruff format --check`).
24+
2325
## Getting started
2426

2527
1. Download this git repository `git clone git@github.com:PiwikPRO/log-analytics.git`. The script uses only python standard library, so no external packages are required. Alternatively you can download our PyPi package - `pip install piwik-pro-log-analytics`.

pyproject.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,36 @@ packages = ["piwik_pro_log_analytics"]
2121
[tool.uv]
2222
package = true
2323

24+
[tool.ruff]
25+
line-length = 120
26+
target-version = "py310"
27+
src = ["piwik_pro_log_analytics", "tests"]
28+
29+
[tool.ruff.lint]
30+
select = [
31+
"E",
32+
"F",
33+
"W",
34+
"I",
35+
"A",
36+
"ERA",
37+
"PL",
38+
"UP",
39+
]
40+
ignore = [
41+
"PLR2004",
42+
"PLR0913",
43+
]
44+
45+
# Legacy importer and tests predate stricter pylint-style and pyupgrade rules.
46+
[tool.ruff.lint.per-file-ignores]
47+
"piwik_pro_log_analytics/import_logs.py" = ["A", "ERA", "PL", "UP"]
48+
"tests/**" = ["A", "ERA", "PL", "UP"]
49+
2450
[dependency-groups]
2551
dev-local = [
2652
"tox>=4.21",
2753
"pytest>=7",
2854
"tox-uv>=1.33.4",
55+
"ruff>=0.12.7",
2956
]

uv.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)