From 04f0bde676e8aff9fdbc9dd9daf62720c1d84dc2 Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Mon, 11 Dec 2023 12:48:24 +0400 Subject: [PATCH 1/2] Add Python 3.12 support. --- .github/workflows/publish.yml | 6 +++--- .github/workflows/test.yml | 9 +++++---- .readthedocs.yml | 2 +- setup.py | 1 + tox.ini | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 240ffca0..35aca3ed 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,11 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: '3.12' - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94adcf03..af983264 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,13 +28,14 @@ jobs: - python-version: "3.9" - python-version: "3.10" - python-version: "3.11" - - python-version: "3.11" + - python-version: "3.12" + - python-version: "3.12" toxenv: "asyncio" 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: Install dependencies @@ -53,7 +54,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.11'] + python-version: ['3.12'] tox-job: ["mypy", "docs", "linters", "twinecheck"] steps: diff --git a/.readthedocs.yml b/.readthedocs.yml index f841974b..9961cf58 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,7 +6,7 @@ sphinx: build: os: ubuntu-22.04 tools: - python: "3.11" # Keep in sync with .github/workflows/tests.yml + python: "3.12" # Keep in sync with .github/workflows/tests.yml python: install: diff --git a/setup.py b/setup.py index 52fc431b..f0e5431e 100755 --- a/setup.py +++ b/setup.py @@ -43,5 +43,6 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], ) diff --git a/tox.ini b/tox.ini index 9e539733..eb86d3fa 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = min,py38,py39,py310,py311,asyncio,asyncio-min,mypy,docs +envlist = min,py38,py39,py310,py311,py312,asyncio,asyncio-min,mypy,docs [testenv] deps = From 96d25077ae596eb012b8bd2b7bfb69dafc549e10 Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Mon, 11 Dec 2023 12:55:37 +0400 Subject: [PATCH 2/2] Bump flake8. --- .flake8 | 42 ++++++++++++++++++++++++++-------------- .pre-commit-config.yaml | 2 +- tests/test_injection.py | 2 +- tests/test_middleware.py | 4 ++-- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/.flake8 b/.flake8 index 6fd67c26..1d317e49 100644 --- a/.flake8 +++ b/.flake8 @@ -12,20 +12,34 @@ ignore = C408, # To be addressed: - D100, # Missing docstring in public module - D101, # Missing docstring in public class - D102, # Missing docstring in public method - D103, # Missing docstring in public function - D104, # Missing docstring in public package - D105, # Missing docstring in magic method - D107, # Missing docstring in __init__ - D200, # One-line docstring should fit on one line with quotes - D202, # No blank lines allowed after function docstring - D205, # 1 blank line required between summary line and description - D209, # Multi-line docstring closing quotes should be on a separate line - D400, # First line should end with a period - D401, # First line should be in imperative mood - D402 # First line should not be the function's "signature" + # Missing docstring in public module + D100, + # Missing docstring in public class + D101, + # Missing docstring in public method + D102, + # Missing docstring in public function + D103, + # Missing docstring in public package + D104, + # Missing docstring in magic method + D105, + # Missing docstring in __init__ + D107, + # One-line docstring should fit on one line with quotes + D200, + # No blank lines allowed after function docstring + D202, + # 1 blank line required between summary line and description + D205, + # Multi-line docstring closing quotes should be on a separate line + D209, + # First line should end with a period + D400, + # First line should be in imperative mood + D401, + # First line should not be the function's "signature" + D402 per-file-ignores = # F401: Ignore "imported but unused" errors in __init__ files, as those diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8121eb3c..99c37e9a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,4 +19,4 @@ repos: - flake8-docstrings - flake8-string-format repo: https://github.com/pycqa/flake8 - rev: 4.0.1 + rev: 6.1.0 diff --git a/tests/test_injection.py b/tests/test_injection.py index 9a0f0eba..799df630 100644 --- a/tests/test_injection.py +++ b/tests/test_injection.py @@ -430,7 +430,7 @@ def test_load_provider_classes(): injector = get_injector_for_testing( {provider_as_string: 2, HttpResponseProvider: 1} ) - assert all(type(prov) == HttpResponseProvider for prov in injector.providers) + assert all(type(prov) is HttpResponseProvider for prov in injector.providers) assert len(injector.providers) == 2 diff --git a/tests/test_middleware.py b/tests/test_middleware.py index bb0faa76..f09e6d10 100644 --- a/tests/test_middleware.py +++ b/tests/test_middleware.py @@ -262,8 +262,8 @@ def parse( @inlineCallbacks def test_multi_args_callbacks(settings): item, _, _ = yield crawl_single_item(MultiArgsCallbackSpider, ProductHtml, settings) - assert type(item["product"]) == ProductPage - assert type(item["provided"]) == ProvidedWithDeferred + assert type(item["product"]) is ProductPage + assert type(item["provided"]) is ProvidedWithDeferred assert item["cb_arg"] == "arg!" assert item["cb_arg2"] is False assert item["non_cb_arg"] is None