Skip to content

Commit

Permalink
build: use python3.12 as default version
Browse files Browse the repository at this point in the history
  • Loading branch information
rmax committed Jul 4, 2024
1 parent 39cba9f commit 363fa76
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 20 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This is GitHub Action for cross platform building
name: build
on:
push:
branches: [master]
pull_request:
branches: [master]

Expand All @@ -11,18 +13,18 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11.3"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Run build
env:
env:
TOXENV: build
run: |
pip install -r requirements-tests.txt
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# This is GitHub Action for linting and security check
name: check
on:
push:
branches: [master]
pull_request:
branches: [master]

concurrency:
group: ${{github.workflow}}-${{ github.ref }}
cancel-in-progress: true

jobs:
checks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11.3"]
python-version: ["3.12"]
env: [security, flake8]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Run check
env:
env:
TOXENV: ${{ matrix.env }}
run: |
pip install -r requirements-tests.txt
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This is GitHub Action for tests
name: test
on:
push:
branches: [master]
pull_request:
branches: [master]

Expand All @@ -10,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.11.3"]
python-version: ["3.12"]

services:
redis:
Expand All @@ -24,7 +26,12 @@ jobs:
container: python:${{ matrix.python-version }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Run pytest
env:
Expand Down
2 changes: 1 addition & 1 deletion src/scrapy_redis/dupefilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def request_fingerprint(self, request):
}
fingerprint_json = json.dumps(fingerprint_data, sort_keys=True)
return hashlib.sha1(fingerprint_json.encode()).hexdigest()

@classmethod
def from_spider(cls, spider):
settings = spider.settings
Expand Down
6 changes: 4 additions & 2 deletions src/scrapy_redis/spiders.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,10 @@ def make_request_from_data(self, data):
if is_dict(formatted_data):
parameter = json.loads(formatted_data)
else:
self.logger.warning(f"{TextColor.WARNING}WARNING: String request is deprecated, please use JSON data format. \
Detail information, please check https://github.com/rmax/scrapy-redis#features{TextColor.ENDC}")
self.logger.warning(
f"{TextColor.WARNING}WARNING: String request is deprecated, please use JSON data format. "
f"Detail information, please check https://github.com/rmax/scrapy-redis#features{TextColor.ENDC}"
)
return FormRequest(formatted_data, dont_filter=True)

if parameter.get('url', None) is None:
Expand Down
19 changes: 12 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
envlist =
security
flake8
py{38,39,310,311}-scrapy{26,27,28,29}-redis{42,43,44,45,46,50}
py{38,39,310,311,312}-scrapy{26,27,28,29,210,211}-redis{42,43,44,45,46,50}
minversion = 3.0.0

[base]
deps =
-r requirements-tests.txt
-r requirements.txt
setuptools

[testenv]
basepython =
py38: python3.8
py39: python3.9
py310: python3.10
py311: python3.11
py312: python3.12
deps =
{[base]deps}
scrapy26: scrapy~=2.6.0
Expand All @@ -35,28 +37,31 @@ commands =

[testenv:flake8]
basepython =
python3.11
python3.12
deps =
{[base]deps}
commands =
flake8 --ignore=W503,E265,E731 docs/ tests/
flake8 --ignore=W503,E265,E731 docs src tests

[testenv:security]
basepython = python3.11
basepython =
python3.12
deps =
bandit==1.7.3
bandit~=1.7.3
commands =
bandit -r -c .bandit.yml src/ tests/

[testenv:pytest]
basepython = python3.11
basepython =
python3.12
deps =
{[testenv]deps}
commands =
python -m pytest --cov-report term --cov=scrapy_redis

[testenv:build]
basepython=python3.11
basepython =
python3.12
deps =
{[base]deps}
build
Expand Down

0 comments on commit 363fa76

Please sign in to comment.