Skip to content

Commit 1960df5

Browse files
authored
Use sphinx-scrapy, require Python 3.10, switch to pyproject.toml (#98)
1 parent 26dcb9b commit 1960df5

14 files changed

Lines changed: 215 additions & 118 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
include:
20-
- python-version: "3.9"
20+
- python-version: "3.10"
2121
tox: min
22-
- python-version: "3.9"
2322
- python-version: "3.10"
2423
tox: min-x402
2524
- python-version: "3.10"
@@ -53,7 +52,7 @@ jobs:
5352
strategy:
5453
fail-fast: false
5554
matrix:
56-
python-version: ["3.13"] # Keep in sync with .readthedocs.yml
55+
python-version: ["3.13"] # In sync with pyproject.toml
5756
tox-job: ["mypy", "docs"]
5857

5958
steps:

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ repos:
2020
rev: v1.0.0
2121
hooks:
2222
- id: sphinx-lint
23+
- repo: https://github.com/scrapy/sphinx-scrapy
24+
rev: 0.8.3
25+
hooks:
26+
- id: sphinx-scrapy

.readthedocs.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
version: 2
2-
formats: all
3-
sphinx:
4-
configuration: docs/conf.py
52
build:
63
os: ubuntu-24.04
74
tools:
8-
# For available versions, see:
9-
# https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python
10-
python: "3.13" # Keep in sync with .github/workflows/test.yml
11-
python:
12-
install:
13-
- requirements: docs/requirements.txt
14-
- path: .
5+
python: "3.13"
6+
commands:
7+
- pip install tox
8+
- tox -e docs
9+
- mkdir -p $READTHEDOCS_OUTPUT/html
10+
- cp -a docs/_build/all/. $READTHEDOCS_OUTPUT/html/

MANIFEST.in

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Or, to use x402_:
4343
4444
pip install zyte-api[x402]
4545
46-
.. note:: Python 3.9+ is required; Python 3.10+ if using x402.
46+
.. note:: Python 3.10+ is required.
4747

4848
.. install-end
4949

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/_build/

docs/conf.py

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@
3737
sys.path.insert(0, str(Path(__file__).parent.absolute())) # _ext
3838
extensions = [
3939
"_ext",
40-
"sphinx.ext.autodoc",
41-
"sphinx.ext.intersphinx",
40+
"sphinx_scrapy",
4241
"sphinx.ext.ifconfig",
43-
"sphinx.ext.viewcode",
4442
"sphinx.ext.githubpages",
4543
"sphinxarg.ext",
4644
]
@@ -188,33 +186,16 @@
188186
# not turned into –api-key in descriptions.
189187
smartquotes = False
190188

191-
192-
# -- Extension configuration -------------------------------------------------
193-
194-
# -- Options for intersphinx extension ---------------------------------------
195-
intersphinx_mapping = {
196-
"python": (
197-
"https://docs.python.org/3",
198-
None,
199-
),
200-
"aiohttp": (
201-
"https://docs.aiohttp.org/en/stable/",
202-
None,
203-
),
204-
"tenacity": (
205-
"https://tenacity.readthedocs.io/en/latest/",
206-
None,
207-
),
208-
"zyte": (
209-
"https://docs.zyte.com",
210-
None,
211-
),
212-
}
213-
214189
autodoc_default_options = {
215190
# 'special-members': '__init__,__call__',
216191
# 'undoc-members': True,
217192
"exclude-members": "__weakref__"
218193
}
219194

220195
add_module_names = False
196+
197+
scrapy_intersphinx_enable = [
198+
"aiohttp",
199+
"tenacity",
200+
"zyte",
201+
]

docs/requirements.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
aiohttp
2+
sphinx
3+
sphinx-argparse
4+
sphinx-rtd-theme
5+
sphinx-scrapy @ git+https://github.com/scrapy/sphinx-scrapy.git@0.8.3
6+
tenacity

docs/requirements.txt

Lines changed: 107 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,107 @@
1-
aiohttp >= 3.6.0
2-
Sphinx >= 4.2.0
3-
sphinx-argparse
4-
sphinx-rtd-theme >= 0.4
5-
tenacity
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile -p 3.14 requirements.in -o requirements.txt
3+
aiohappyeyeballs==2.6.1
4+
# via aiohttp
5+
aiohttp==3.13.5
6+
# via -r requirements.in
7+
aiosignal==1.4.0
8+
# via aiohttp
9+
alabaster==1.0.0
10+
# via sphinx
11+
attrs==26.1.0
12+
# via aiohttp
13+
babel==2.18.0
14+
# via sphinx
15+
certifi==2026.2.25
16+
# via requests
17+
charset-normalizer==3.4.7
18+
# via requests
19+
docutils==0.22.4
20+
# via
21+
# sphinx
22+
# sphinx-argparse
23+
# sphinx-markdown-builder
24+
# sphinx-rtd-theme
25+
frozenlist==1.8.0
26+
# via
27+
# aiohttp
28+
# aiosignal
29+
idna==3.12
30+
# via
31+
# requests
32+
# yarl
33+
imagesize==2.0.0
34+
# via sphinx
35+
jinja2==3.1.6
36+
# via sphinx
37+
markupsafe==3.0.3
38+
# via jinja2
39+
multidict==6.7.1
40+
# via
41+
# aiohttp
42+
# yarl
43+
packaging==26.1
44+
# via
45+
# sphinx
46+
# sphinx-scrapy
47+
propcache==0.4.1
48+
# via
49+
# aiohttp
50+
# yarl
51+
pygments==2.20.0
52+
# via sphinx
53+
requests==2.33.1
54+
# via sphinx
55+
roman-numerals==4.1.0
56+
# via sphinx
57+
snowballstemmer==3.0.1
58+
# via sphinx
59+
sphinx==9.1.0
60+
# via
61+
# -r requirements.in
62+
# sphinx-argparse
63+
# sphinx-copybutton
64+
# sphinx-last-updated-by-git
65+
# sphinx-llms-txt
66+
# sphinx-markdown-builder
67+
# sphinx-rtd-theme
68+
# sphinx-scrapy
69+
# sphinxcontrib-jquery
70+
sphinx-argparse==0.5.2
71+
# via -r requirements.in
72+
sphinx-copybutton==0.5.2
73+
# via sphinx-scrapy
74+
sphinx-last-updated-by-git==0.3.8
75+
# via sphinx-sitemap
76+
sphinx-llms-txt @ git+https://github.com/zytedata/sphinx-llms-txt.git@5e8866cb0cc249aa2017ad9050b3b83a7ca16f69
77+
# via sphinx-scrapy
78+
sphinx-markdown-builder @ git+https://github.com/zytedata/sphinx-markdown-builder.git@cfe4c0bfd7b4542f7e6b65a58cdf9ec765829940
79+
# via sphinx-scrapy
80+
sphinx-rtd-theme==3.1.0
81+
# via -r requirements.in
82+
sphinx-scrapy @ git+https://github.com/scrapy/sphinx-scrapy.git@f20366277f2598d0c8a60e55fe282aff2da40dcf
83+
# via -r requirements.in
84+
sphinx-sitemap==2.9.0
85+
# via sphinx-scrapy
86+
sphinxcontrib-applehelp==2.0.0
87+
# via sphinx
88+
sphinxcontrib-devhelp==2.0.0
89+
# via sphinx
90+
sphinxcontrib-htmlhelp==2.1.0
91+
# via sphinx
92+
sphinxcontrib-jquery==4.1
93+
# via sphinx-rtd-theme
94+
sphinxcontrib-jsmath==1.0.1
95+
# via sphinx
96+
sphinxcontrib-qthelp==2.0.0
97+
# via sphinx
98+
sphinxcontrib-serializinghtml==2.0.0
99+
# via sphinx
100+
tabulate==0.10.0
101+
# via sphinx-markdown-builder
102+
tenacity==9.1.4
103+
# via -r requirements.in
104+
urllib3==2.6.3
105+
# via requests
106+
yarl==1.23.0
107+
# via aiohttp

pyproject.toml

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,68 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "zyte-api"
7+
dynamic = ["version"]
8+
description = "Python interface to Zyte API"
9+
readme = { file = "README.rst", content-type = "text/x-rst" }
10+
authors = [
11+
{ name = "Zyte Group Ltd", email = "opensource@zyte.com" },
12+
]
13+
license = { file = "LICENSE" }
14+
requires-python = ">=3.10"
15+
dependencies = [
16+
"aiohttp>=3.8.0",
17+
"attrs>=20.1.0",
18+
"brotli>=0.5.2",
19+
"runstats>=0.0.1",
20+
"tenacity>=8.2.0",
21+
"tqdm>=4.16.0",
22+
"w3lib>=2.1.1",
23+
]
24+
classifiers = [
25+
"Development Status :: 3 - Alpha",
26+
"Intended Audience :: Developers",
27+
"License :: OSI Approved :: BSD License",
28+
"Natural Language :: English",
29+
"Operating System :: OS Independent",
30+
"Programming Language :: Python :: 3",
31+
"Programming Language :: Python :: 3.10",
32+
"Programming Language :: Python :: 3.11",
33+
"Programming Language :: Python :: 3.12",
34+
"Programming Language :: Python :: 3.13",
35+
]
36+
37+
[project.optional-dependencies]
38+
x402 = [
39+
"eth-account>=0.13.7",
40+
"x402>=0.1.1,<2.0.0",
41+
]
42+
43+
[project.scripts]
44+
zyte-api = "zyte_api.__main__:_main"
45+
46+
[project.urls]
47+
Homepage = "https://github.com/zytedata/python-zyte-api"
48+
Documentation = "https://python-zyte-api.readthedocs.io/en/stable/"
49+
50+
[tool.hatch.build.targets.sdist]
51+
include = [
52+
"/docs",
53+
"/tests",
54+
"/zyte_api",
55+
"/.pre-commit-config.yaml",
56+
"/CHANGES.rst",
57+
"/tox.ini",
58+
]
59+
60+
[tool.hatch.version]
61+
path = "zyte_api/__version__.py"
62+
63+
[tool.hatch.build.targets.wheel]
64+
packages = ["zyte_api"]
65+
166
[tool.bumpversion]
267
current_version = "0.9.0"
368
commit = true
@@ -13,9 +78,6 @@ regex = true
1378
[[tool.bumpversion.files]]
1479
filename = "docs/conf.py"
1580

16-
[[tool.bumpversion.files]]
17-
filename = "setup.py"
18-
1981
[[tool.bumpversion.files]]
2082
filename = "zyte_api/__version__.py"
2183

@@ -188,3 +250,6 @@ split-on-trailing-comma = false
188250

189251
[tool.ruff.lint.pydocstyle]
190252
convention = "pep257"
253+
254+
[tool.sphinx-scrapy]
255+
python-version = "3.13" # In sync with test.yml

0 commit comments

Comments
 (0)