Skip to content

Commit 4367c7c

Browse files
authored
Merge pull request #704 from willcl-ark/update-ruff
ci: bump actions, and ruff version. Use action
2 parents e4bd52d + c6d3985 commit 4367c7c

File tree

9 files changed

+47
-48
lines changed

9 files changed

+47
-48
lines changed

Diff for: .github/workflows/test.yml

+16-18
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,22 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19-
- name: Install a specific version of uv
20-
uses: astral-sh/setup-uv@v3
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
2121
with:
22-
version: "0.4.4"
22+
version: "0.6.11"
2323
enable-cache: true
24-
- run: uvx [email protected] check .
25-
26-
ruff-format:
27-
runs-on: ubuntu-latest
28-
steps:
29-
- uses: actions/checkout@v4
30-
- name: Install a specific version of uv
31-
uses: astral-sh/setup-uv@v3
24+
- name: Lint
25+
uses: astral-sh/ruff-action@v3
3226
with:
33-
version: "0.4.4"
34-
enable-cache: true
35-
- run: uvx [email protected] format . --check
27+
args: "check --fix"
28+
- name: Format
29+
uses: astral-sh/ruff-action@v3
30+
with:
31+
args: "format --check --diff"
3632

3733
test:
38-
needs: [ruff, ruff-format]
34+
needs: [ruff]
3935
runs-on: ubuntu-latest
4036
strategy:
4137
matrix:
@@ -65,12 +61,14 @@ jobs:
6561
- name: Start minikube's loadbalancer tunnel
6662
run: minikube tunnel &> /dev/null &
6763
- name: Install the latest version of uv
68-
uses: astral-sh/setup-uv@v2
64+
uses: astral-sh/setup-uv@v5
6965
with:
7066
version: "latest"
7167
enable-cache: true
72-
- name: Install Python
73-
run: uv python install $PYTHON_VERSION
68+
- name: "Set up Python"
69+
uses: actions/setup-python@v5
70+
with:
71+
python-version-file: "pyproject.toml"
7472
- name: Install project
7573
run: uv sync --all-extras --dev
7674
- name: Run tests

Diff for: docs/developer-notes.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ Refer to the `uv` documentation for installation methods: https://docs.astral.sh
3030
With `uv` installed you can add/remove dependencies using `uv add <dep>` or `uv remove <dep>.
3131
This will update the [`uv.lock`](https://docs.astral.sh/uv/guides/projects/#uvlock) file automatically.
3232

33-
We use ruff version 0.6.8 in this project currently. This can be installed as a stand-alone binary (see documentation), or via `uv` using:
33+
We use ruff version 0.11.0 in this project currently. This can be installed as a stand-alone binary (see documentation), or via `uv` using:
3434

3535
```bash
3636
# install
37-
$ uv tool install ruff@0.6.8
37+
$ uv tool install ruff@0.11.0
3838

3939
# lint
40-
$ uvx ruff@0.6.8 check .
40+
$ uvx ruff@0.11.0 check .
4141

4242
# format
43-
$ uvx ruff@0.6.8 format .
43+
$ uvx ruff@0.11.0 format .
4444
```
4545

4646
## Release process

Diff for: resources/plugins/hello/plugin.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ def entrypoint(ctx, plugin_content: str, warnet_content: str):
7272

7373
hook_value = warnet_content.get(WarnetContent.HOOK_VALUE.value)
7474

75-
assert hook_value in {
76-
item.value for item in HookValue
77-
}, f"{hook_value} is not a valid HookValue"
75+
assert hook_value in {item.value for item in HookValue}, (
76+
f"{hook_value} is not a valid HookValue"
77+
)
7878

7979
if warnet_content.get(PLUGIN_ANNEX):
8080
for annex_member in [annex_item for annex_item in warnet_content.get(PLUGIN_ANNEX)]:
81-
assert annex_member in {
82-
item.value for item in AnnexMember
83-
}, f"{annex_member} is not a valid AnnexMember"
81+
assert annex_member in {item.value for item in AnnexMember}, (
82+
f"{annex_member} is not a valid AnnexMember"
83+
)
8484

8585
warnet_content[WarnetContent.HOOK_VALUE.value] = HookValue(hook_value)
8686

Diff for: resources/plugins/simln/plugin.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ def entrypoint(ctx, plugin_content: str, warnet_content: str):
6363

6464
hook_value = warnet_content.get(WarnetContent.HOOK_VALUE.value)
6565

66-
assert hook_value in {
67-
item.value for item in HookValue
68-
}, f"{hook_value} is not a valid HookValue"
66+
assert hook_value in {item.value for item in HookValue}, (
67+
f"{hook_value} is not a valid HookValue"
68+
)
6969

7070
if warnet_content.get(PLUGIN_ANNEX):
7171
for annex_member in [annex_item for annex_item in warnet_content.get(PLUGIN_ANNEX)]:
72-
assert annex_member in {
73-
item.value for item in AnnexMember
74-
}, f"{annex_member} is not a valid AnnexMember"
72+
assert annex_member in {item.value for item in AnnexMember}, (
73+
f"{annex_member} is not a valid AnnexMember"
74+
)
7575

7676
warnet_content[WarnetContent.HOOK_VALUE.value] = HookValue(hook_value)
7777

Diff for: resources/scenarios/commander.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import tempfile
1212
import threading
1313
from time import sleep
14-
from typing import Dict
1514

1615
from kubernetes import client, config
1716
from ln_framework.ln import LND
17+
1818
from test_framework.authproxy import AuthServiceProxy
1919
from test_framework.p2p import NetworkThread
2020
from test_framework.test_framework import (
@@ -169,8 +169,8 @@ def setup(self):
169169
self.log.addHandler(ch)
170170

171171
# Keep a separate index of tanks by pod name
172-
self.tanks: Dict[str, TestNode] = {}
173-
self.lns: Dict[str, LND] = {}
172+
self.tanks: dict[str, TestNode] = {}
173+
self.lns: dict[str, LND] = {}
174174
self.channels = WARNET["channels"]
175175

176176
for i, tank in enumerate(WARNET["tanks"]):

Diff for: resources/scenarios/ln_init.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ def open_channel(self, ch, fee_rate):
261261
block_height = block["height"]
262262
for ch in channels:
263263
assert ch["id"]["block"] == block_height, f"Actual block:{block_height}\n{ch}"
264-
assert (
265-
block_txs[ch["id"]["index"]] == ch["txid"]
266-
), f"Actual txid:{block_txs[ch["id"]["index"]]}\n{ch}"
264+
assert block_txs[ch["id"]["index"]] == ch["txid"], (
265+
f"Actual txid:{block_txs[ch['id']['index']]}\n{ch}"
266+
)
267267
self.log.info("👍")
268268

269269
gen(5)
@@ -294,9 +294,9 @@ def ln_all_chs(self, ln):
294294
def update_policy(self, ln, txid_hex, policy, capacity):
295295
self.log.info(f"Sending update from {ln.name} for channel with outpoint: {txid_hex}:0")
296296
res = ln.update(txid_hex, policy, capacity)
297-
assert (
298-
len(res["failed_updates"]) == 0
299-
), f" Failed updates: {res["failed_updates"]}\n txid: {txid_hex}\n policy:{policy}"
297+
assert len(res["failed_updates"]) == 0, (
298+
f" Failed updates: {res['failed_updates']}\n txid: {txid_hex}\n policy:{policy}"
299+
)
300300

301301
update_threads = []
302302
for ch in self.channels:

Diff for: ruff.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
required-version = "==0.6.8"
1+
required-version = ">=0.11"
22
extend-exclude = [
33
"resources/scenarios/test_framework",
44
"resources/images/exporter/authproxy.py",

Diff for: src/warnet/bitcoin.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
from typing import Optional
77

88
import click
9+
from urllib3.exceptions import MaxRetryError
10+
911
from test_framework.messages import ser_uint256
1012
from test_framework.p2p import MESSAGEMAP
11-
from urllib3.exceptions import MaxRetryError
1213

1314
from .constants import BITCOINCORE_CONTAINER
1415
from .k8s import get_default_namespace_or, get_mission, pod_log

Diff for: test/test_base.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def _print_and_assert_msgs(self, message):
6060
self.log_msg_assertions_passed = True
6161

6262
def assert_log_msgs(self):
63-
assert (
64-
self.log_msg_assertions_passed
65-
), f"Log assertion failed. Expected message not found: {self.log_expected_msgs}"
63+
assert self.log_msg_assertions_passed, (
64+
f"Log assertion failed. Expected message not found: {self.log_expected_msgs}"
65+
)
6666
self.log_msg_assertions_passed = False
6767

6868
def warnet(self, cmd):

0 commit comments

Comments
 (0)