diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aae3e6c..2a2d7cf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,24 +10,24 @@ jobs: fail-fast: false matrix: include: - - python-version: "3.5" - env: - TOXENV: py35-scrapy18 - - python-version: "3.5" + - python-version: "3.6" env: - TOXENV: py35 + TOXENV: py36-scrapy16 - python-version: "3.6" env: - TOXENV: py36 + TOXENV: py - python-version: "3.7" env: - TOXENV: py37 + TOXENV: py - python-version: "3.8" env: - TOXENV: py38 + TOXENV: py - python-version: "3.9" env: - TOXENV: py39 + TOXENV: py + - python-version: "3.10" + env: + TOXENV: py steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index c50d24c..a62e579 100644 --- a/setup.py +++ b/setup.py @@ -8,8 +8,8 @@ long_description=open('README.md').read(), packages=find_packages(), install_requires=[ - 'Scrapy>=1.0', - 'scrapinghub>=1.9.0', + 'Scrapy>=1.6', + 'scrapinghub>=2.1.0', ], entry_points={ 'console_scripts': [ @@ -18,7 +18,7 @@ 'shub-image-info = sh_scrapy.crawl:shub_image_info', ], }, - python_requires='>=3.5', + python_requires='>=3.6', classifiers=[ 'Framework :: Scrapy', 'Development Status :: 5 - Production/Stable', @@ -27,11 +27,11 @@ 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Topic :: Utilities', ], ) diff --git a/sh_scrapy/extension.py b/sh_scrapy/extension.py index 0192bfb..f2f1f0d 100644 --- a/sh_scrapy/extension.py +++ b/sh_scrapy/extension.py @@ -19,14 +19,18 @@ try: - from itemadapter import is_item + from itemadapter import ItemAdapter except ImportError: _base_item_cls = [dict, scrapy.item.Item] with suppress(AttributeError): _base_item_cls.append(scrapy.item.BaseItem) + _base_item_cls = tuple(_base_item_cls) def is_item(item): - return isinstance(item, tuple(_base_item_cls)) + return isinstance(item, _base_item_cls) +else: + def is_item(item): + return ItemAdapter.is_item(item) class HubstorageExtension(object): diff --git a/tests/test_writer.py b/tests/test_writer.py index 2843987..9078eb1 100644 --- a/tests/test_writer.py +++ b/tests/test_writer.py @@ -3,8 +3,8 @@ import logging import os import threading +from queue import Queue -from six.moves.queue import Queue import pytest from sh_scrapy.writer import _PipeWriter diff --git a/tox.ini b/tox.ini index 849f440..49682e8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ # tox.ini [tox] -envlist = py35-scrapy18, py35, py36, py37, py38, py39 +envlist = py36-scrapy16, py [testenv] deps = @@ -8,8 +8,7 @@ deps = pytest-cov mock hubstorage - six packaging - py35-scrapy18: Scrapy==1.8 + py36-scrapy16: Scrapy==1.6 commands = pytest --verbose --cov=sh_scrapy --cov-report=term-missing --cov-report=html --cov-report=xml {posargs: sh_scrapy tests}