Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.13, drop Python 3.8, update tool versions #110

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: '3.8'
- python-version: '3.9'
- python-version: '3.10'
- python-version: '3.11'
- python-version: '3.12'
- python-version: '3.8'
- python-version: '3.13'
- python-version: '3.9'
toxenv: min
- python-version: '3.12'
- python-version: '3.13'
toxenv: extra
- python-version: '3.8'
- python-version: '3.9'
toxenv: min-extra

steps:
Expand All @@ -51,7 +51,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.12']
python-version: ['3.12'] # Keep in sync with .readthedocs.yml

steps:
- uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
exclude: test_mypy\.py$ # https://github.com/davidfritzsche/pytest-mypy-testing/issues/29
language_version: python3
repo: https://github.com/psf/black
rev: 24.2.0
rev: 24.10.0
- hooks:
- id: isort
language_version: python3
Expand All @@ -19,10 +19,10 @@ repos:
- flake8-debugger
- flake8-string-format
repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.1
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
rev: 1.19.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==24.2.0
- black==24.10.0
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ zyte-common-items

.. description starts

``zyte-common-items`` is a Python 3.8+ library of item_ and `page object`_
``zyte-common-items`` is a Python 3.9+ library of item_ and `page object`_
classes for web data extraction that we use at Zyte_ to maximize opportunities
for code reuse.

Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Sphinx==5.1.0
sphinx-rtd-theme==1.0.0
Sphinx==8.1.3
sphinx-rtd-theme==3.0.1
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
],
python_requires=">=3.8",
python_requires=">=3.9",
)
10 changes: 3 additions & 7 deletions tests/test_adapter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
from collections.abc import Collection
from contextlib import contextmanager
from copy import copy

# In Python ≤ 3.8 you cannot annotate with “collections.abc.Collection[Item]”,
# so we need to import typing.Collection for annotation instead.
from typing import Collection as CollectionType
from typing import Optional

import attrs
Expand Down Expand Up @@ -125,7 +121,7 @@ def __iter__(self):
def test_asdict_empty_collection(value):
@attrs.define
class _Item(Item):
children: CollectionType[Item]
children: Collection[Item]

item = _Item(value)
with configured_adapter():
Expand Down Expand Up @@ -376,7 +372,7 @@ def test_unknown_field_remove_missing():
def test_keep_empty_adapter_global():
@attrs.define
class _Item(Item):
children: CollectionType[Item]
children: Collection[Item]

item = _Item([])
with configured_adapter(ZyteItemKeepEmptyAdapter):
Expand All @@ -388,7 +384,7 @@ class _Item(Item):
def test_keep_empty_adapter_local():
@attrs.define
class _Item(Item):
children: CollectionType[Item]
children: Collection[Item]

class TestAdapter(ItemAdapter):
ADAPTER_CLASSES = [ZyteItemKeepEmptyAdapter] + list(ItemAdapter.ADAPTER_CLASSES)
Expand Down
12 changes: 5 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = min,min-extra,py38,py39,py310,py311,py312,extra,mypy,docs,twinecheck
envlist = min,min-extra,py39,py310,py311,py312,py313,extra,mypy,docs,twinecheck

[base]
deps =
Expand Down Expand Up @@ -28,7 +28,7 @@ commands =


[testenv:min]
basepython = python3.8
basepython = python3.9
deps =
{[base]deps}
attrs==22.2.0
Expand All @@ -46,7 +46,7 @@ deps =
scrapy

[testenv:min-extra]
basepython = python3.8
basepython = python3.9
deps =
{[testenv:min]deps}
scrapy==2.0.1
Expand All @@ -64,17 +64,15 @@ commands =
# https://github.com/scrapinghub/web-poet/pull/194

[testenv:mypy]
basepython = python3.12
deps =
mypy==1.9.0
mypy==1.11.2

commands = mypy zyte_common_items tests

[testenv:twinecheck]
basepython = python3
deps =
twine==5.1.1
build==1.2.1
build==1.2.2
commands =
python -m build --sdist
twine check dist/*
Expand Down