Skip to content

Commit 1ee5cc5

Browse files
committed
Add fomat action and run format.
1 parent f77d4e3 commit 1ee5cc5

File tree

24 files changed

+194
-74
lines changed

24 files changed

+194
-74
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
python-version: ["3.11", "3.12"]
13+
python-version: ["3.10", "3.11", "3.12"]
1414

1515
steps:
1616

@@ -26,8 +26,7 @@ jobs:
2626
- name: 📁 Collect dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install -r requirements.txt
30-
pip install -r requirements-dev.txt
29+
pip install -r requirements.txt -r requirements-dev.txt
3130
3231
#---------------------------------------------lint----------------------------------------------
3332
- name: 🛠️ Run lint

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ __pycache__/
88
*.so
99

1010
# Distribution / packaging
11+
rubisco-**
1112
.Python
1213
build/
1314
develop-eggs/
@@ -98,6 +99,7 @@ venv.bak/
9899
.vscode
99100
.cache
100101
.idea
102+
.ruff_cache
101103

102104
# Spyder project settings
103105
.spyderproject
@@ -117,6 +119,9 @@ dmypy.json
117119
# Pyre type checker
118120
.pyre/
119121

122+
# Pytype type checker
123+
.pytype/
124+
120125
# Patterns for all subdirectories: all kinds of automatic backup files.
121126
*.orig
122127
*.rej
@@ -125,6 +130,3 @@ dmypy.json
125130
*.swp
126131
.#*
127132
\#*#
128-
129-
# Dist directory
130-
rubisco-**

.rubisco/lint.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,26 @@ steps:
66
- popen: git ls-files \*.py
77
id: files
88

9+
- name: 🛠️ Analysing the code with ruff
10+
run:
11+
[
12+
python,
13+
-m,
14+
ruff,
15+
check,
16+
rubisco,
17+
--config,
18+
ruff.toml,
19+
--select,
20+
ALL,
21+
--ignore,
22+
D203,
23+
--ignore,
24+
D213,
25+
]
26+
927
- name: 🛠️ Analysing the code with pylint
1028
run: python -m pylint -j ${{ nproc }} $(git ls-files \*.py)
1129

12-
- name: 🛠️ Analysing the code with flake8
13-
run: python -m flake8 rubisco
30+
- name: 🛠️ Running type check
31+
run: python -m pytype --keep-going rubisco -j ${{ nproc }}

repo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"run": ".rubisco/build.yaml"
1616
},
1717
"format": {
18-
"exec": "python -m isort rubisco"
18+
"exec": "python -m ruff format rubisco"
1919
},
2020
"clean": {
2121
"workflow": [

requirements-dev.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
pylint
2-
isort
3-
flake8
4-
Nuitka
51
build
62
hatchling
3+
isort
4+
Nuitka
5+
pylint
6+
urllib3[socks] # Avoid urllib3's warning in pytype's check
77
pytest
8+
pytype
9+
ruff

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
aiohttp >= 3.5.4
22
colorama >= 0.3.9
33
json-five >= 0.5.1
4+
py7zr >= 0.16.1
5+
pyyaml >= 5.4.1
46
requests >= 2.18.4
57
rich >= 6.2.0
68
rich-argparse >= 1.0.0
7-
pyyaml >= 5.4.1
8-
py7zr >= 0.16.1
9-
typing_extensions
9+
typing_extensions >= 4.0.0

rubisco/cli/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import os
2727
import sys
2828
from pathlib import Path
29-
from typing import TYPE_CHECKING, Any, Iterable, Sequence
29+
from typing import TYPE_CHECKING, Any
3030

3131
import colorama
3232
import rich
@@ -69,6 +69,8 @@
6969
)
7070

7171
if TYPE_CHECKING:
72+
from collections.abc import Iterable, Sequence
73+
7274
from rubisco.kernel.workflow import Step, Workflow
7375
from rubisco.lib.process import Process
7476

@@ -120,7 +122,7 @@ def __call__(
120122
self,
121123
parser: argparse.ArgumentParser,
122124
namespace: argparse.Namespace, # noqa: ARG002
123-
values: list, # noqa: ARG002
125+
values: str | Sequence[Any] | None, # noqa: ARG002
124126
option_string: str | None = None, # noqa: ARG002
125127
) -> None:
126128
show_version()

rubisco/envutils/packages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from rubisco.lib.version import Version
2828

2929

30-
class ExtensionPackage:
30+
class ExtensionPackage: # pylint: disable=too-few-public-methods
3131
"""A package."""
3232

3333
name: str
@@ -54,4 +54,4 @@ def __init__(
5454

5555

5656
if __name__ == "__main__":
57-
pass # TODO
57+
pass

rubisco/kernel/git.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ def git_branch_set_upstream(
234234
colorama.init()
235235

236236
class _GitTestKTrigger(IKernelTrigger):
237-
238237
def on_update_git_repo(
239238
self,
240239
path: Path,

rubisco/kernel/mirrorlist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ def get_url(
224224
)
225225

226226
class _TestKTrigger(IKernelTrigger):
227-
228227
def pre_speedtest(self, host: str) -> None:
229228
rich.print(f"[blue]=>[/blue] Testing {host} ...", end="\n")
230229

0 commit comments

Comments
 (0)