Skip to content

Commit 05b729a

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 <robin@jarry.cc>
1 parent 727927b commit 05b729a

File tree

7 files changed

+30
-25
lines changed

7 files changed

+30
-25
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 9 deletions
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,11 +29,10 @@ 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
@@ -36,11 +41,11 @@ jobs:
3641
- run: make check-commits
3742

3843
test:
39-
runs-on: ubuntu-20.04
44+
runs-on: ubuntu-24.04
4045
strategy:
4146
matrix:
4247
include:
43-
- python: 3.9
48+
- python: "3.9"
4449
toxenv: py39
4550
- python: "3.10"
4651
toxenv: py310
@@ -56,7 +61,7 @@ jobs:
5661
- uses: actions/checkout@v3
5762
- uses: actions/setup-python@v4
5863
with:
59-
python-version: ${{ matrix.python }}
64+
python-version: "${{ matrix.python }}"
6065
- uses: actions/cache@v3
6166
with:
6267
path: ~/.cache/pip
@@ -86,7 +91,7 @@ jobs:
8691
deploy:
8792
needs: [lint, test]
8893
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
89-
runs-on: ubuntu-latest
94+
runs-on: ubuntu-24.03
9095
steps:
9196
- uses: actions/checkout@v3
9297
- uses: actions/setup-python@v4

Makefile

Lines changed: 2 additions & 3 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 9 additions & 9 deletions
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)