Skip to content

Commit 8618be6

Browse files
authored
build: use python3.12 as default version (#297)
1 parent 39cba9f commit 8618be6

File tree

7 files changed

+51
-21
lines changed

7 files changed

+51
-21
lines changed

.github/workflows/builds.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# This is GitHub Action for cross platform building
22
name: build
33
on:
4+
push:
5+
branches: [master]
46
pull_request:
57
branches: [master]
68

@@ -11,18 +13,18 @@ jobs:
1113
fail-fast: false
1214
matrix:
1315
os: [ubuntu-latest, macos-latest, windows-latest]
14-
python-version: ["3.11.3"]
16+
python-version: ["3.12"]
1517

1618
steps:
17-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
1820

1921
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v5
2123
with:
2224
python-version: ${{ matrix.python-version }}
2325

2426
- name: Run build
25-
env:
27+
env:
2628
TOXENV: build
2729
run: |
2830
pip install -r requirements-tests.txt

.github/workflows/checks.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
# This is GitHub Action for linting and security check
22
name: check
33
on:
4+
push:
5+
branches: [master]
46
pull_request:
57
branches: [master]
68

9+
concurrency:
10+
group: ${{github.workflow}}-${{ github.ref }}
11+
cancel-in-progress: true
12+
713
jobs:
814
checks:
915
runs-on: ubuntu-latest
1016
strategy:
1117
fail-fast: false
1218
matrix:
13-
python-version: ["3.11.3"]
19+
python-version: ["3.12"]
1420
env: [security, flake8]
1521

1622
steps:
17-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v4
1824

1925
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v2
26+
uses: actions/setup-python@v5
2127
with:
2228
python-version: ${{ matrix.python-version }}
2329

2430
- name: Run check
25-
env:
31+
env:
2632
TOXENV: ${{ matrix.env }}
2733
run: |
2834
pip install -r requirements-tests.txt

.github/workflows/tests.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# This is GitHub Action for tests
22
name: test
33
on:
4+
push:
5+
branches: [master]
46
pull_request:
57
branches: [master]
68

@@ -10,7 +12,7 @@ jobs:
1012
strategy:
1113
fail-fast: false
1214
matrix:
13-
python-version: ["3.11.3"]
15+
python-version: ["3.12"]
1416

1517
services:
1618
redis:
@@ -24,7 +26,12 @@ jobs:
2426
container: python:${{ matrix.python-version }}
2527

2628
steps:
27-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v4
30+
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
2835

2936
- name: Run pytest
3037
env:

requirements-tests.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ flake8
33
mock
44
pytest>=6.0,<7
55
pytest-cov
6-
tox>=3.0,<4
6+
tox>=4.0,<5

src/scrapy_redis/dupefilter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def request_fingerprint(self, request):
122122
}
123123
fingerprint_json = json.dumps(fingerprint_data, sort_keys=True)
124124
return hashlib.sha1(fingerprint_json.encode()).hexdigest()
125-
125+
126126
@classmethod
127127
def from_spider(cls, spider):
128128
settings = spider.settings

src/scrapy_redis/spiders.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ def make_request_from_data(self, data):
172172
if is_dict(formatted_data):
173173
parameter = json.loads(formatted_data)
174174
else:
175-
self.logger.warning(f"{TextColor.WARNING}WARNING: String request is deprecated, please use JSON data format. \
176-
Detail information, please check https://github.com/rmax/scrapy-redis#features{TextColor.ENDC}")
175+
self.logger.warning(
176+
f"{TextColor.WARNING}WARNING: String request is deprecated, please use JSON data format. "
177+
f"Detail information, please check https://github.com/rmax/scrapy-redis#features{TextColor.ENDC}"
178+
)
177179
return FormRequest(formatted_data, dont_filter=True)
178180

179181
if parameter.get('url', None) is None:

tox.ini

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
[tox]
2+
requires =
3+
tox>=4
24
envlist =
35
security
46
flake8
5-
py{38,39,310,311}-scrapy{26,27,28,29}-redis{42,43,44,45,46,50}
7+
py{38,39,310,311,312}-scrapy{26,27,28,29,210,211}-redis{42,43,44,45,46,50}
68
minversion = 3.0.0
79

810
[base]
911
deps =
1012
-r requirements-tests.txt
1113
-r requirements.txt
14+
setuptools
1215

1316
[testenv]
1417
basepython =
1518
py38: python3.8
1619
py39: python3.9
1720
py310: python3.10
1821
py311: python3.11
22+
py312: python3.12
1923
deps =
2024
{[base]deps}
2125
scrapy26: scrapy~=2.6.0
@@ -30,33 +34,42 @@ deps =
3034
redis45: redis~=4.5.0
3135
redis46: redis~=4.6.0
3236
redis50: redis~=5.0.0
37+
passenv =
38+
REDIS_HOST
39+
REDIS_PORT
3340
commands =
3441
python -m pytest # --cov-report term --cov=scrapy_redis
3542

3643
[testenv:flake8]
3744
basepython =
38-
python3.11
45+
python3.12
3946
deps =
4047
{[base]deps}
4148
commands =
42-
flake8 --ignore=W503,E265,E731 docs/ tests/
49+
flake8 --ignore=W503,E265,E731 docs src tests
4350

4451
[testenv:security]
45-
basepython = python3.11
52+
basepython =
53+
python3.12
4654
deps =
47-
bandit==1.7.3
55+
bandit~=1.7.3
4856
commands =
4957
bandit -r -c .bandit.yml src/ tests/
5058

5159
[testenv:pytest]
52-
basepython = python3.11
60+
basepython =
61+
python3.12
5362
deps =
5463
{[testenv]deps}
64+
passenv =
65+
REDIS_HOST
66+
REDIS_PORT
5567
commands =
5668
python -m pytest --cov-report term --cov=scrapy_redis
5769

5870
[testenv:build]
59-
basepython=python3.11
71+
basepython =
72+
python3.12
6073
deps =
6174
{[base]deps}
6275
build

0 commit comments

Comments
 (0)