Skip to content

Commit

Permalink
Add Python 3.12 to supported versions, bump tool versions (#77)
Browse files Browse the repository at this point in the history
* Bump and pin flake8.

* Add Python 3.12 to supported versions.

* Bump black.

* Bump mypy and pylint.

* Update CI actions.
  • Loading branch information
wRAR authored Oct 17, 2023
1 parent 6aca919 commit 19b0414
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 35 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ jobs:
strategy:
matrix:
include:
- python-version: 3
- python-version: 3.12
env:
TOXENV: black
- python-version: 3
- python-version: 3.12
env:
TOXENV: bandit
- python-version: 3
- python-version: 3.12
env:
TOXENV: flake8
- python-version: 3.8
- python-version: 3.12
env:
TOXENV: typing
- python-version: 3.8
- python-version: 3.12
env:
TOXENV: pylint

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@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest

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

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.12

- name: Publish to PyPI
run: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "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@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -35,10 +35,10 @@ 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@v4
with:
python-version: 3.8

Expand All @@ -62,10 +62,10 @@ jobs:
os: [macos-latest, windows-latest]

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

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
3 changes: 0 additions & 3 deletions itemadapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def field_names(self) -> KeysView:


class _MixinAttrsDataclassAdapter:

_fields_dict: dict
item: Any

Expand Down Expand Up @@ -163,7 +162,6 @@ def get_field_names_from_class(cls, item_class: type) -> Optional[List[str]]:


class PydanticAdapter(AdapterInterface):

item: Any

@classmethod
Expand Down Expand Up @@ -212,7 +210,6 @@ def __len__(self) -> int:


class _MixinDictScrapyItemAdapter:

_fields_dict: dict
item: Any

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Framework :: Scrapy",
"Intended Audience :: Developers",
"Topic :: Internet :: WWW/HTTP",
Expand Down
6 changes: 0 additions & 6 deletions tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def test_non_item(self):


class BaseTestMixin:

item_class = None
item_class_nested = None

Expand Down Expand Up @@ -228,7 +227,6 @@ def test_field_names_from_class_empty(self):


class DictTestCase(unittest.TestCase, BaseTestMixin):

item_class = dict
item_class_nested = dict

Expand All @@ -255,7 +253,6 @@ def test_field_names_from_class(self):


class ScrapySubclassedItemTestCase(NonDictTestMixin, unittest.TestCase):

item_class = ScrapySubclassedItem
item_class_nested = ScrapySubclassedItemNested
item_class_subclassed = ScrapySubclassedItemSubclassed
Expand All @@ -269,23 +266,20 @@ def test_get_value_keyerror_item_dict(self):


class PydanticModelTestCase(NonDictTestMixin, unittest.TestCase):

item_class = PydanticModel
item_class_nested = PydanticModelNested
item_class_subclassed = PydanticModelSubclassed
item_class_empty = PydanticModelEmpty


class DataClassItemTestCase(NonDictTestMixin, unittest.TestCase):

item_class = DataClassItem
item_class_nested = DataClassItemNested
item_class_subclassed = DataClassItemSubclassed
item_class_empty = DataClassItemEmpty


class AttrsItemTestCase(NonDictTestMixin, unittest.TestCase):

item_class = AttrsItem
item_class_nested = AttrsItemNested
item_class_subclassed = AttrsItemSubclassed
Expand Down
3 changes: 0 additions & 3 deletions tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def get_field_meta_from_class(cls, item_class: type, field_name: str) -> Mapping


class BaseFakeItemAdapterTest(unittest.TestCase):

item_class = FakeItemClass
adapter_class = BaseFakeItemAdapter

Expand Down Expand Up @@ -183,7 +182,6 @@ def test_field_names(self):


class MetadataFakeItemAdapterTest(BaseFakeItemAdapterTest):

item_class = FakeItemClass
adapter_class = MetadataFakeItemAdapter

Expand All @@ -209,7 +207,6 @@ def test_get_field_meta_from_class(self):


class FieldNamesFakeItemAdapterTest(BaseFakeItemAdapterTest):

item_class = FakeItemClass
adapter_class = FieldNamesFakeItemAdapter

Expand Down
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@ commands =
[testenv:flake8]
basepython = python3
deps =
flake8>=3.7.9
flake8==6.1.0
commands =
flake8 --exclude=.git,.tox,venv* {posargs:itemadapter tests}

[testenv:typing]
basepython = python3
deps =
mypy==0.991
mypy==1.5.1
attrs
pydantic
scrapy
commands =
mypy --install-types --non-interactive \
--show-error-codes --ignore-missing-imports {posargs:itemadapter}
--ignore-missing-imports {posargs:itemadapter}

[testenv:black]
basepython = python3
deps =
black==22.12.0
black==23.9.1
commands =
black --check {posargs:itemadapter tests}

[testenv:pylint]
deps =
pylint==2.11.1
pylint==3.0.0
commands =
pylint {posargs:itemadapter}

0 comments on commit 19b0414

Please sign in to comment.