Skip to content

Commit e1c86aa

Browse files
authored
Fix up CI (#363)
* Bump versions, get off lintlizard * fix up typing * ruff format
1 parent 472c913 commit e1c86aa

32 files changed

+147
-377
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
build_and_upload:
12-
runs-on: 'ubuntu-20.04'
12+
runs-on: 'ubuntu-24.04'
1313
environment: production
1414
permissions:
1515
# id-token for the trusted publisher setup
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/setup-python@v2
2323
name: Install Python
2424
with:
25-
python-version: 3.10
25+
python-version: 3.12
2626

2727
- run: |
2828
pip install packaging

.github/workflows/test.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
1515
name: Lint ${{ matrix.python-version }}
16-
runs-on: 'ubuntu-20.04'
16+
runs-on: 'ubuntu-24.04'
1717
container: python:${{ matrix.python-version }}
1818
steps:
1919
- name: Checkout code
@@ -22,16 +22,18 @@ jobs:
2222
- name: Lint code
2323
run: |
2424
pip install -c requirements.txt -r requirements-lint.txt
25-
lintlizard --ci
25+
mypy .
26+
ruff check
27+
ruff format
2628
2729
# Run tests
2830
test:
2931
strategy:
3032
matrix:
3133
python-version: ['3.10', '3.11', '3.12', '3.13']
32-
os: ['ubuntu-20.04']
34+
os: ['ubuntu-24.04']
3335
redis-version: [4, 5, "6.2.6", "7.0.9"]
34-
redis-py-version: [3.3.0, 4.6.0]
36+
redis-py-version: [4.6.0, 6.1.0]
3537
# Do not cancel any jobs when a single job fails
3638
fail-fast: false
3739
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with Redis ${{ matrix.redis-version }} and redis-py==${{ matrix.redis-py-version }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM circleci/python:3.10
1+
FROM python:3.12
22

33
WORKDIR /src
44
COPY requirements.txt .

pyproject.toml

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
[tool.black]
2-
line-length = 79
3-
exclude = '''
4-
/(
5-
\.git
6-
)/
7-
'''
8-
9-
[tool.isort]
10-
skip = ['.git', 'venv']
11-
known_tests = 'tests'
12-
sections = ['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'TESTS', 'LOCALFOLDER']
13-
default_section = 'THIRDPARTY'
14-
use_parentheses = true
15-
multi_line_output = 3
16-
include_trailing_comma = true
17-
force_grid_wrap = 0
18-
combine_as_imports = true
19-
line_length = 79
20-
float_to_top = true
1+
[tool.mypy]
2+
ignore_missing_imports = true
3+
follow_imports = "skip"

requirements-lint.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
lintlizard==0.26.0
1+
mypy==1.19.0
2+
ruff==0.14.7
23
types-redis

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
click==8.1.7
2-
redis==4.5.2
2+
redis==6.1.0
33
structlog==24.1.0
44
croniter

scripts/redis_scan.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
Can also set the TTL for keys to facilitate removing data.
66
"""
7+
78
import signal
89
import sys
910
import time

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
VERSION_FILE = "tasktiger/__init__.py"
66
with open(VERSION_FILE, encoding="utf8") as fd:
7-
version = re.search(r'__version__ = ([\'"])(.*?)\1', fd.read()).group(2)
7+
version = re.search(r'__version__ = ([\'"])(.*?)\1', fd.read()).group(2) # type: ignore
88

99
with open("README.rst", encoding="utf-8") as file:
1010
long_description = file.read()

tasktiger/_internal.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ def serialize_func_name(func: Union[Callable, Type]) -> str:
9797
"""
9898
if func.__module__ == "__main__":
9999
raise ValueError(
100-
"Functions from the __main__ module cannot be processed by "
101-
"workers."
100+
"Functions from the __main__ module cannot be processed by workers."
102101
)
103102
try:
104103
# This will only work on Python 3.3 or above, but it will allow us to use static/classmethods
@@ -143,7 +142,7 @@ def serialize_retry_method(retry_method: Any) -> Tuple[str, Tuple]:
143142

144143

145144
def get_timestamp(
146-
when: Optional[Union[datetime.timedelta, datetime.datetime]]
145+
when: Optional[Union[datetime.timedelta, datetime.datetime]],
147146
) -> Optional[float]:
148147
# convert timedelta to datetime
149148
if isinstance(when, datetime.timedelta):

tasktiger/executor.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@ def execute_tasks(self, tasks: List[Task], log: BoundLogger) -> bool:
135135

136136
hard_timeouts = self.worker.get_hard_timeouts(func, tasks)
137137

138-
with WorkerContextManagerStack(
139-
self.config["CHILD_CONTEXT_MANAGERS"]
140-
):
138+
with WorkerContextManagerStack(self.config["CHILD_CONTEXT_MANAGERS"]):
141139
if is_batch_func:
142140
# Batch process if the task supports it.
143141
g["current_tasks"] = tasks
@@ -165,9 +163,7 @@ def execute_tasks(self, tasks: List[Task], log: BoundLogger) -> bool:
165163
execution["time_failed"] = time.time()
166164
if self.worker.store_tracebacks:
167165
# Currently we only log failed task executions to Redis.
168-
execution["traceback"] = "".join(
169-
traceback.format_exception(*exc_info)
170-
)
166+
execution["traceback"] = "".join(traceback.format_exception(*exc_info))
171167
execution["success"] = success
172168
execution["host"] = socket.gethostname()
173169

@@ -360,9 +356,7 @@ def check_child_exit() -> Optional[int]:
360356
execution = {
361357
"time_started": time_started,
362358
"time_failed": now,
363-
"exception_name": serialize_func_name(
364-
JobTimeoutException
365-
),
359+
"exception_name": serialize_func_name(JobTimeoutException),
366360
"success": False,
367361
"host": socket.gethostname(),
368362
}

0 commit comments

Comments
 (0)