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.12 and 3.13, drop Python 3.8, update tool versions #76

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

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
Expand All @@ -42,13 +42,13 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.11']
python-version: ['3.12'] # Keep in sync with .readthedocs.yml
tox-job: ["mypy", "docs"]

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
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.13.1
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
rev: 1.19.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==24.3.0
- black==24.10.0
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build:
tools:
# For available versions, see:
# https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python
python: "3.11" # Keep in sync with .github/workflows/test.yml
python: "3.12" # Keep in sync with .github/workflows/test.yml
python:
install:
- requirements: docs/requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Installation

pip install zyte-api

.. note:: Python 3.8+ is required.
.. note:: Python 3.9+ is required.

.. install-end

Expand Down
9 changes: 1 addition & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import sys
from pathlib import Path

import sphinx_rtd_theme

sys.path.insert(0, os.path.abspath("../"))


Expand Down Expand Up @@ -58,7 +56,7 @@
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"
source_suffix = {".rst": "restructuredtext"}

# The master toctree document.
master_doc = "index"
Expand Down Expand Up @@ -86,11 +84,6 @@
#
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom themes here, relative to this directory.
# Add path to the RTD explicitly to robustify builds (otherwise might
# fail in a clean Debian build env)
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ profile = "black"
multi_line_output = 3

[tool.black]
target-version = ["py38", "py39", "py310", "py311", "py312"]
target-version = ["py39", "py310", "py311", "py312", "py313"]
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
import os

from setuptools import find_packages, setup
Expand Down Expand Up @@ -41,9 +40,10 @@ def get_version():
"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",
],
)
7 changes: 4 additions & 3 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ async def test_run(queries, expected_response, store_errors, exception):
async_client_mock.return_value.iter = request_parallel_mock

# Patch the AsyncZyteAPI class in __main__ with the mock
with patch("zyte_api.__main__.AsyncZyteAPI", async_client_mock), patch(
"zyte_api.__main__.create_session"
) as create_session_mock:
with (
patch("zyte_api.__main__.AsyncZyteAPI", async_client_mock),
patch("zyte_api.__main__.create_session") as create_session_mock,
):
# Mock create_session to return an AsyncMock
create_session_mock.return_value = AsyncMock()

Expand Down
15 changes: 9 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38,py39,py310,py311,mypy,docs,twine
envlist = py39,py310,py311,py312,py313,mypy,docs,twine

[testenv]
deps =
Expand All @@ -19,9 +19,12 @@ commands =

[testenv:mypy]
deps =
mypy==0.982
mypy==1.12.0
pytest==8.3.3
Twisted==24.7.0
types-tqdm==4.66.0.20240417

commands = mypy --ignore-missing-imports --no-warn-no-return \
commands = mypy --ignore-missing-imports \
zyte_api \
tests

Expand All @@ -39,8 +42,8 @@ commands = pre-commit run --all-files --show-diff-on-failure

[testenv:twine]
deps =
twine==4.0.2
build==1.0.3
twine==5.1.1
build==1.2.2
commands =
python setup.py sdist
python -m build --sdist
twine check dist/*
4 changes: 2 additions & 2 deletions zyte_api/_async.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import time
from asyncio import Future
Expand All @@ -17,8 +19,6 @@

if TYPE_CHECKING:
_ResponseFuture = Future[Dict[str, Any]]
else:
_ResponseFuture = Future # Python 3.8 support


def _post_func(session):
Expand Down
Loading