Skip to content

Commit 2f11154

Browse files
committed
format: move to ruff (closes #86)
1 parent 8d2633d commit 2f11154

File tree

9 files changed

+24
-20
lines changed

9 files changed

+24
-20
lines changed

.github/workflows/lint.yml renamed to .github/workflows/formatting.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: lint
1+
name: formatting
22

33
on:
44
push:
@@ -8,7 +8,7 @@ on:
88
- '.github/workflows/lint.yml'
99

1010
jobs:
11-
lint:
11+
formatting:
1212
runs-on: ubuntu-latest
1313

1414
steps:
@@ -19,4 +19,4 @@ jobs:
1919
python-version: 3.9
2020

2121
- name: checks
22-
run: make venv lint
22+
run: make venv format-check

.github/workflows/typing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- '.github/workflows/typing.yml'
99

1010
jobs:
11-
mypy:
11+
typing:
1212
runs-on: ubuntu-latest
1313

1414
steps:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
make venv
66
make test
77
make type-check
8-
make lint
8+
make format
99
```
1010

1111
Run a specific test:

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
VENV_DIR := .venv
22

3-
all: venv test type-check lint
3+
all: venv test type-check format
44

55
help:
66
@echo "Available commands:"
7-
@echo " make all - Run all tasks: venv, test, type-check, lint"
7+
@echo " make all - Run all tasks: venv, test, type-check, format"
88
@echo " make venv - Create a virtual environment and install dependencies"
99
@echo " make test - Run unittests and check coverage"
1010
@echo " make type-check - Check typing with mypy"
11-
@echo " make lint - Lint the codebase"
11+
@echo " make format - Format the codebase"
1212

1313
venv:
1414
python3 -m venv $(VENV_DIR) --clear
@@ -22,7 +22,8 @@ test:
2222
type-check:
2323
$(VENV_DIR)/bin/python -m mypy --install-types --non-interactive streamable tests
2424

25-
lint:
26-
$(VENV_DIR)/bin/python -m autoflake --in-place --remove-all-unused-imports --remove-unused-variables --ignore-init-module -r streamable tests
27-
$(VENV_DIR)/bin/python -m isort streamable tests
28-
$(VENV_DIR)/bin/python -m black .
25+
format:
26+
$(VENV_DIR)/bin/python -m ruff format streamable tests
27+
28+
format-check:
29+
$(VENV_DIR)/bin/python -m ruff format --check streamable tests

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![coverage](https://codecov.io/gh/ebonnal/streamable/graph/badge.svg?token=S62T0JQK9N)](https://codecov.io/gh/ebonnal/streamable)
22
[![unittest](https://github.com/ebonnal/streamable/actions/workflows/unittest.yml/badge.svg?branch=main)](https://github.com/ebonnal/streamable/actions)
33
[![typing](https://github.com/ebonnal/streamable/actions/workflows/typing.yml/badge.svg?branch=main)](https://github.com/ebonnal/streamable/actions)
4-
[![lint](https://github.com/ebonnal/streamable/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/ebonnal/streamable/actions)
4+
[![formatting](https://github.com/ebonnal/streamable/actions/workflows/formatting.yml/badge.svg?branch=main)](https://github.com/ebonnal/streamable/actions)
55
[![PyPI](https://github.com/ebonnal/streamable/actions/workflows/pypi.yml/badge.svg?branch=main)](https://pypi.org/project/streamable)
66

77
# `streamable`

requirements-dev.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
autoflake==2.2.1
2-
black==24.3.0
3-
isort==5.12.0
1+
ruff==0.9.10
42
mypy==1.7.1
53
mypy-extensions==1.0.0
64
parameterized==0.9.0

streamable/util/functiontools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def sidify(func: Callable[[T], Any]) -> Callable[[T], T]:
4343

4444

4545
def async_sidify(
46-
func: Callable[[T], Coroutine]
46+
func: Callable[[T], Coroutine],
4747
) -> Callable[[T], Coroutine[Any, Any, T]]:
4848
async def wrap(arg: T) -> T:
4949
coroutine = func(arg)
@@ -75,6 +75,7 @@ def __call__(self, args: Tuple) -> R:
7575
T8 = TypeVar("T8")
7676
T9 = TypeVar("T9")
7777

78+
7879
# fmt: off
7980
@overload
8081
def star(func: Callable[[T], R]) -> Callable[[Tuple], R]: ...

tests/test_readme.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
three_integers_per_second: Stream[int] = integers.throttle(5, per=timedelta(seconds=1))
1717

18+
1819
# fmt: off
1920
class TestReadme(unittest.TestCase):
2021
def test_collect_it(self) -> None:

tests/test_stream.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,9 @@ def test_map_or_foreach_with_exception(
577577
self.assertListEqual(
578578
list(
579579
method(
580-
Stream(src), throw_for_odd_func(raised_exc), concurrency=concurrency # type: ignore
580+
Stream(src),
581+
throw_for_odd_func(raised_exc),
582+
concurrency=concurrency, # type: ignore
581583
).catch(*catched_exc)
582584
),
583585
list(even_src),
@@ -989,13 +991,14 @@ def test_group(self) -> None:
989991
Stream([1]).group(
990992
size=100, interval=datetime.timedelta(seconds=seconds)
991993
)
992-
),
994+
)
995+
993996
for size in [-1, 0]:
994997
with self.assertRaises(
995998
ValueError,
996999
msg="`group` should raise error when called with `size` < 1.",
9971000
):
998-
list(Stream([1]).group(size=size)),
1001+
list(Stream([1]).group(size=size))
9991002

10001003
# group size
10011004
self.assertListEqual(

0 commit comments

Comments
 (0)