Skip to content

Commit aea34d1

Browse files
committed
tox: fix lint target on python 3.13
Update all packages used in the lint target to their latest release. Explicitly bump the ubuntu image version in all GitHub action jobs. Fix errors reported by new pylint/black versions. Signed-off-by: Robin Jarry <[email protected]>
1 parent 727927b commit aea34d1

File tree

7 files changed

+31
-25
lines changed

7 files changed

+31
-25
lines changed

.github/workflows/ci.yml

+15-9
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
---
44
name: CI
55

6-
on: [push, pull_request]
6+
on:
7+
pull_request:
8+
branches:
9+
- master
10+
push:
11+
branches:
12+
- master
713

814
jobs:
915
lint:
10-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-24.04
1117
steps:
1218
- uses: actions/checkout@v3
1319
- uses: actions/setup-python@v4
@@ -23,24 +29,24 @@ jobs:
2329
- run: python -m tox -e lint
2430

2531
check-commits:
26-
if: github.event_name == 'pull_request'
32+
if: ${{ github.event.pull_request.commits }}
2733
runs-on: ubuntu-latest
2834
env:
29-
LYPY_START_COMMIT: "${{ github.event.pull_request.base.sha }}"
30-
LYPY_END_COMMIT: "${{ github.event.pull_request.head.sha }}"
35+
LYPY_COMMIT_RANGE: "HEAD~${{ github.event.pull_request.commits }}.."
3136
steps:
3237
- run: sudo apt-get install git make
3338
- uses: actions/checkout@v4
3439
with:
3540
fetch-depth: 0
41+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
3642
- run: make check-commits
3743

3844
test:
39-
runs-on: ubuntu-20.04
45+
runs-on: ubuntu-24.04
4046
strategy:
4147
matrix:
4248
include:
43-
- python: 3.9
49+
- python: "3.9"
4450
toxenv: py39
4551
- python: "3.10"
4652
toxenv: py310
@@ -56,7 +62,7 @@ jobs:
5662
- uses: actions/checkout@v3
5763
- uses: actions/setup-python@v4
5864
with:
59-
python-version: ${{ matrix.python }}
65+
python-version: "${{ matrix.python }}"
6066
- uses: actions/cache@v3
6167
with:
6268
path: ~/.cache/pip
@@ -86,7 +92,7 @@ jobs:
8692
deploy:
8793
needs: [lint, test]
8894
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
89-
runs-on: ubuntu-latest
95+
runs-on: ubuntu-24.03
9096
steps:
9197
- uses: actions/checkout@v3
9298
- uses: actions/setup-python@v4

Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ tests:
1212
format:
1313
tox -e format
1414

15-
LYPY_START_COMMIT ?= origin/master
16-
LYPY_END_COMMIT ?= HEAD
15+
LYPY_COMMIT_RANGE ?= origin/master..
1716

1817
check-commits:
19-
./check-commits.sh $(LYPY_START_COMMIT)..$(LYPY_END_COMMIT)
18+
./check-commits.sh $(LYPY_COMMIT_RANGE)
2019

2120
.PHONY: lint tests format check-commits

libyang/schema.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1542,9 +1542,7 @@ def defaults(self) -> Iterator[Union[None, bool, int, str, float]]:
15421542

15431543
def max_elements(self) -> Optional[int]:
15441544
return (
1545-
self.cdata_leaflist.max
1546-
if self.cdata_leaflist.max != (2**32 - 1)
1547-
else None
1545+
self.cdata_leaflist.max if self.cdata_leaflist.max != (2**32 - 1) else None
15481546
)
15491547

15501548
def min_elements(self) -> int:

libyang/util.py

+2
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,6 @@ def data_load(in_type, in_data, data, data_keepalive, encode=True):
121121
c_str = str2c(in_data, encode=encode)
122122
data_keepalive.append(c_str)
123123
ret = lib.ly_in_new_memory(c_str, data)
124+
else:
125+
raise ValueError("invalid input")
124126
return ret

libyang/xpath.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def xpath_split(xpath: str) -> Iterator[Tuple[str, str, List[Tuple[str, str]]]]:
8585

8686
# -------------------------------------------------------------------------------------
8787
def _xpath_keys_to_key_name(
88-
keys: List[Tuple[str, str]]
88+
keys: List[Tuple[str, str]],
8989
) -> Optional[Union[str, Tuple[str, ...]]]:
9090
"""
9191
Extract key name from parsed xpath keys returned by xpath_split. The return value

pylintrc

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ disable=
7474
too-many-branches,
7575
too-many-lines,
7676
too-many-locals,
77+
too-many-positional-arguments,
7778
too-many-return-statements,
7879
too-many-statements,
7980
unused-argument,

tox.ini

+9-9
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ basepython = python3
3636
description = Format python code using isort and black.
3737
changedir = .
3838
deps =
39-
black~=23.12.1
40-
isort~=5.13.2
39+
black~=25.1.0
40+
isort~=6.0.0
4141
skip_install = true
4242
install_command = python3 -m pip install {opts} {packages}
4343
allowlist_externals =
@@ -52,14 +52,14 @@ basepython = python3
5252
description = Run coding style checks.
5353
changedir = .
5454
deps =
55-
astroid~=3.0.2
56-
black~=23.12.1
57-
flake8~=7.0.0
58-
isort~=5.13.2
59-
pycodestyle~=2.11.1
55+
astroid~=3.3.8
56+
black~=25.1.0
57+
flake8~=7.1.1
58+
isort~=6.0.0
59+
pycodestyle~=2.12.1
6060
pyflakes~=3.2.0
61-
pylint~=3.0.3
62-
setuptools~=69.0.3
61+
pylint~=3.3.4
62+
setuptools~=75.8.0
6363
allowlist_externals =
6464
/bin/sh
6565
/usr/bin/sh

0 commit comments

Comments
 (0)