Skip to content
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
15 changes: 11 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: Publish

permissions:
contents: read

on:
push:
tags:
Expand All @@ -10,14 +14,17 @@ jobs:
name: pypi
url: https://pypi.org/p/zyte-api
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
python-version: 3.13
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: 3.14
- run: |
python -m pip install --upgrade build
python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
26 changes: 17 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

name: tox

permissions:
contents: read

on:
push:
branches: [ main ]
Expand All @@ -17,24 +20,27 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: "3.10"
- python-version: "3.11"
tox: min
- python-version: "3.10"
- python-version: "3.11"
tox: min-x402
- python-version: "3.10"
- python-version: "3.11"
- python-version: "3.12"
- python-version: "3.13"
- python-version: "3.14"
- python-version: "3.14"
tox: x402
- python-version: "3.15"

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -44,7 +50,7 @@ jobs:
tox -e ${{ matrix.tox || 'py' }}
- name: coverage
if: ${{ success() }}
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -53,13 +59,15 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.13"] # In sync with pyproject.toml
python-version: ["3.14"] # In sync with pyproject.toml
tox-job: ["mypy", "docs"]

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.3
rev: v0.16.10
hooks:
- id: ruff-check
args: [ --fix ]
Expand All @@ -10,17 +10,17 @@ repos:
hooks:
- id: blacken-docs
additional_dependencies:
- black==25.9.0
- black==26.10.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
rev: v1.0.2
hooks:
- id: sphinx-lint
- repo: https://github.com/scrapy/sphinx-scrapy
rev: 0.8.4
rev: 0.13.0
hooks:
- id: sphinx-scrapy
6 changes: 2 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ version: 2
build:
os: ubuntu-24.04
tools:
python: "3.13"
python: "3.14"
commands:
- pip install tox
- tox -e docs
- mkdir -p $READTHEDOCS_OUTPUT/html
- cp -a docs/_build/all/. $READTHEDOCS_OUTPUT/html/
- tox -e docs -- $READTHEDOCS_OUTPUT/html
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Or, to use x402_:

pip install zyte-api[x402]

.. note:: Python 3.10+ is required.
.. note:: Python 3.11+ is required.

.. install-end

Expand Down
1 change: 1 addition & 0 deletions docs/_ext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ def http_api_reference_role(
def setup(app):
# https://github.com/scrapy-plugins/scrapy-zyte-api/blob/2bfb2bef2e43293a62f47781914331bc4fa08f06/docs/_ext/__init__.py#L42
app.add_role("http", http_api_reference_role)
return {"parallel_read_safe": True, "parallel_write_safe": True}
2 changes: 1 addition & 1 deletion docs/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ aiohttp
sphinx
sphinx-argparse
sphinx-rtd-theme
sphinx-scrapy @ git+https://github.com/scrapy/sphinx-scrapy.git@0.8.4
sphinx-scrapy==0.13.0
tenacity
26 changes: 16 additions & 10 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was autogenerated by uv via the following command:
# uv pip compile -p 3.13 docs/requirements.in -o docs/requirements.txt
# uv pip compile -p 3.14 requirements.in -o requirements.txt
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.14.3
Expand All @@ -20,8 +20,9 @@ docutils==0.22.4
# via
# sphinx
# sphinx-argparse
# sphinx-markdown-builder
# sphinx-llm-friendly
# sphinx-rtd-theme
# sphinx-scrapy
frozenlist==1.8.0
# via
# aiohttp
Expand Down Expand Up @@ -51,7 +52,9 @@ propcache==0.4.1
pygments==2.20.0
# via sphinx
requests==2.33.1
# via sphinx
# via
# sphinx
# sphinxcontrib-youtube
roman-numerals==4.1.0
# via sphinx
snowballstemmer==3.0.1
Expand All @@ -61,25 +64,26 @@ sphinx==9.1.0
# -r requirements.in
# sphinx-argparse
# sphinx-copybutton
# sphinx-design
# sphinx-last-updated-by-git
# sphinx-llms-txt
# sphinx-markdown-builder
# sphinx-llm-friendly
# sphinx-rtd-theme
# sphinx-scrapy
# sphinxcontrib-jquery
# sphinxcontrib-youtube
sphinx-argparse==0.5.2
# via -r requirements.in
sphinx-copybutton==0.5.2
# via sphinx-scrapy
sphinx-design==0.7.0
# via sphinx-scrapy
sphinx-last-updated-by-git==0.3.8
# via sphinx-sitemap
sphinx-llms-txt @ git+https://github.com/zytedata/sphinx-llms-txt.git@5e8866cb0cc249aa2017ad9050b3b83a7ca16f69
# via sphinx-scrapy
sphinx-markdown-builder @ git+https://github.com/zytedata/sphinx-markdown-builder.git@cfe4c0bfd7b4542f7e6b65a58cdf9ec765829940
sphinx-llm-friendly==0.7.0
# via sphinx-scrapy
sphinx-rtd-theme==3.1.0
# via -r requirements.in
sphinx-scrapy @ git+https://github.com/scrapy/sphinx-scrapy.git@0.8.4
sphinx-scrapy==0.13.0
# via -r requirements.in
sphinx-sitemap==2.9.0
# via sphinx-scrapy
Expand All @@ -97,8 +101,10 @@ sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
sphinxcontrib-youtube==1.5.0
# via sphinx-scrapy
tabulate==0.10.0
# via sphinx-markdown-builder
# via sphinx-llm-friendly
tenacity==9.1.4
# via -r requirements.in
urllib3==2.8.0
Expand Down
19 changes: 11 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ authors = [
{ name = "Zyte Group Ltd", email = "opensource@zyte.com" },
]
license = { file = "LICENSE" }
requires-python = ">=3.10"
requires-python = ">=3.11"
dependencies = [
"aiohttp>=3.8.0",
"aiohttp>=3.8.2",
"attrs>=20.1.0",
"brotli>=0.5.2",
"python-dotenv>=1.0.0",
Expand All @@ -30,11 +30,11 @@ classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
]

[project.optional-dependencies]
Expand Down Expand Up @@ -175,6 +175,8 @@ extend-select = [
"YTT",
]
ignore = [
# Do not catch blind exception
"BLE001",
# Trailing comma missing
"COM812",
# Missing docstring in public module
Expand Down Expand Up @@ -215,6 +217,8 @@ ignore = [
"PLR0913",
# Too many statements
"PLR0915",
# Too many positional arguments
"PLR0917",
# Magic value used in comparison
"PLR2004",
# String contains ambiguous {}.
Expand All @@ -227,6 +231,8 @@ ignore = [
"RUF012",
# Use of `assert` detected
"S101",
# Prefer `TypeError` exception for invalid type
"TRY004",
]

[tool.ruff.lint.flake8-pytest-style]
Expand All @@ -245,14 +251,11 @@ split-on-trailing-comma = false
"zyte_api/__init__.py" = ["F401"]
"zyte_api/aio/errors.py" = ["F401"]
"zyte_api/aio/retry.py" = ["F401"]
"tests/*" = ["S"]
"tests/*" = ["ASYNC240", "S"]
"docs/**" = ["B006"]
# Skip PEP 604 suggestions for files with attr classes
"zyte_api/errors.py" = ["UP007", "UP045"]
"zyte_api/stats.py" = ["UP007", "UP045"]

[tool.ruff.lint.pydocstyle]
convention = "pep257"

[tool.sphinx-scrapy]
python-version = "3.13" # In sync with test.yml
python-version = "3.14" # In sync with test.yml
27 changes: 14 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[tox]
min_version = 4.25.0
requires =
sphinx-scrapy[tox] @ git+https://github.com/scrapy/sphinx-scrapy.git@0.8.4
envlist = pre-commit,mypy,min,min-x402,py310,py311,py312,py313,py314,x402,docs,twine
sphinx-scrapy[tox]==0.13.0
envlist = pre-commit,mypy,min,min-x402,py3{11-15},x402,docs,twine

[testenv]
deps =
Expand All @@ -24,7 +25,7 @@ extras = x402
[min]
deps =
{[testenv]deps}
aiohttp==3.8.0
aiohttp==3.8.2
attrs==20.1.0
brotli==0.5.2
runstats==0.0.1
Expand All @@ -33,13 +34,13 @@ deps =
w3lib==2.1.1

[testenv:min]
basepython = python3.10
basepython = python3.11
deps =
{[min]deps}
typing-extensions==4.5.0

[testenv:min-x402]
basepython = python3.10
basepython = python3.11
deps =
{[min]deps}
eth_account==0.13.7
Expand All @@ -49,12 +50,12 @@ deps =

[testenv:mypy]
deps =
mypy==1.18.2
eth-account==0.13.7
pytest==8.3.3
Twisted==25.5.0
types-tqdm==4.67.0.20250809
x402==0.2.1
mypy==2.4.0
eth-account==0.14.0
pytest==9.1.1
Twisted==26.4.0
types-tqdm==4.70.0.20260906
x402==1.0.0

commands = mypy \
zyte_api \
Expand All @@ -66,8 +67,8 @@ commands = pre-commit run --all-files --show-diff-on-failure

[testenv:twine]
deps =
twine==6.2.0
build==1.3.0
twine==7.0.0
build==1.6.1
commands =
python -m build --sdist
twine check dist/*
2 changes: 1 addition & 1 deletion zyte_api/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def read_input(
intype = _guess_intype(input_fp.name, lines)
if intype == "txt":
urls = [u.strip() for u in lines if u.strip()]
base = params if params else {"browserHtml": True}
base = params or {"browserHtml": True}
records = [{"url": url, **base} for url in urls]
else:
records = [
Expand Down
Loading
Loading