Skip to content

Commit c201e90

Browse files
authored
Merge pull request #245 from openzim/python_3_13
Upgrade to Python 3.13
2 parents 9550e4d + cf2cc44 commit c201e90

File tree

9 files changed

+33
-27
lines changed

9 files changed

+33
-27
lines changed

.github/workflows/Publish.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
python -m build --sdist --wheel
107107
108108
- name: Publish to PyPI
109-
uses: pypa/gh-action-pypi-publish@release/v1.8
109+
uses: pypa/gh-action-pypi-publish@release/v1.12
110110
# OPTIONAL PUBLICATION TO NPM, NOT NEEDED BY SCRAPERS IN THE END
111111

112112
# publish-js:

.github/workflows/Tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: install ffmpeg and gifsicle
5757
run: sudo apt update && sudo apt install ffmpeg gifsicle
5858

59-
- name: Set up Python 3.12
59+
- name: Set up Python
6060
uses: actions/setup-python@v5
6161
with:
6262
python-version-file: pyproject.toml

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
hooks:
1313
- id: black
1414
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.7.0
15+
rev: v0.9.2
1616
hooks:
1717
- id: ruff
1818
- repo: https://github.com/RobertCraigie/pyright-python

.readthedocs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version: 2
66
build:
77
os: ubuntu-24.04
88
tools:
9-
python: '3.12'
9+
python: '3.13'
1010

1111
# custom commands to run mkdocs build within hatch, as suggested by maintainer in
1212
# https://github.com/readthedocs/readthedocs.org/issues/10706

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Upgrade to support only Python 3.13 (#203)
13+
1014
## [5.0.0] - 2025-01-14
1115

1216
This is a major release with a lot of breaking changes but most changes are easy to fix.

pyproject.toml

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[build-system]
22
# jinja2 is required to generate JS and Python rules at build time
33
# PyYAML is used to parse fuzzy rules and generate Python/JS code
4-
requires = ["hatchling", "hatch-openzim>=0.2", "jinja2==3.1.4", "PyYAML==6.0.2"]
4+
requires = ["hatchling", "hatch-openzim>=0.2", "jinja2==3.1.5", "PyYAML==6.0.2"]
55
build-backend = "hatchling.build"
66

77
[project]
88
name = "zimscraperlib"
9-
requires-python = ">=3.12,<3.13"
9+
requires-python = ">=3.13,<3.14"
1010
description = "Collection of python tools to re-use common code across scrapers"
1111
readme = "README.md"
1212
dependencies = [
@@ -51,13 +51,13 @@ scripts = [
5151
# jinja2 is required to generate JS and Python rules at build time
5252
# PyYAML is used to parse fuzzy rules and generate Python/JS code
5353
# also update version in build-system above and in build_js.sh
54-
"jinja2==3.1.4",
54+
"jinja2==3.1.5",
5555
"PyYAML==6.0.2",
5656

5757
]
5858
lint = [
5959
"black==24.10.0",
60-
"ruff==0.8.2",
60+
"ruff==0.9.2",
6161
]
6262
check = [
6363
"pyright==1.1.391",
@@ -66,19 +66,19 @@ check = [
6666
test = [
6767
"pytest==8.3.4",
6868
"pytest-mock==3.14.0",
69-
"coverage==7.6.9",
69+
"coverage==7.6.10",
7070
]
7171
docs = [
7272
"mkdocs==1.6.1",
7373
"mkdocstrings[python]==0.27.0",
74-
"mkdocs-material==9.5.44",
75-
"pymdown-extensions==10.12",
74+
"mkdocs-material==9.5.50",
75+
"pymdown-extensions==10.14",
7676
"mkdocs-gen-files==0.5.0",
7777
"mkdocs-literate-nav==0.6.1",
7878
"mkdocs-include-markdown-plugin==7.1.2",
7979
]
8080
dev = [
81-
"ipython==8.30.0",
81+
"ipython==8.31.0",
8282
"pre-commit==4.0.1",
8383
"zimscraperlib[scripts]",
8484
"zimscraperlib[lint]",
@@ -155,10 +155,10 @@ build = "inv docs-build --args '{args}'"
155155

156156
[tool.black]
157157
line-length = 88
158-
target-version = ['py312']
158+
target-version = ['py313']
159159

160160
[tool.ruff]
161-
target-version = "py312"
161+
target-version = "py313"
162162
line-length = 88
163163
src = ["src", "contrib"]
164164

@@ -221,6 +221,8 @@ select = [
221221
"YTT", # flake8-2020
222222
]
223223
ignore = [
224+
# Allow to shadow Python standard-library modules
225+
"A005",
224226
# Allow non-abstract empty methods in abstract base classes
225227
"B027",
226228
# Remove flake8-errmsg since we consider they bloat the code and provide limited value
@@ -289,7 +291,7 @@ exclude_lines = [
289291
include = ["contrib", "src", "tests", "tasks.py"]
290292
exclude = [".env/**", ".venv/**"]
291293
extraPaths = ["src"]
292-
pythonVersion = "3.12"
294+
pythonVersion = "3.13"
293295
typeCheckingMode="strict"
294296
disableBytesTypePromotions = true
295297

src/zimscraperlib/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "5.0.1-dev0"
1+
__version__ = "5.1.0-dev0"

src/zimscraperlib/zim/providers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(
5757
def get_size(self) -> int:
5858
return getattr(self, "size", -1)
5959

60-
def gen_blob(self) -> Generator[libzim.writer.Blob, None, None]:
60+
def gen_blob(self) -> Generator[libzim.writer.Blob]:
6161
yield libzim.writer.Blob(self.fileobj.getvalue()) # pragma: no cover
6262

6363

@@ -88,7 +88,7 @@ def get_size_of(url: str) -> int | None:
8888
def get_size(self) -> int:
8989
return getattr(self, "size", -1)
9090

91-
def gen_blob(self) -> Generator[libzim.writer.Blob, None, None]: # pragma: no cover
91+
def gen_blob(self) -> Generator[libzim.writer.Blob]: # pragma: no cover
9292
for chunk in self.resp.iter_content(10 * 1024):
9393
if chunk:
9494
yield libzim.writer.Blob(chunk)

tests/rewriting/conftest.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ def get_document_uri(
4444

4545

4646
@pytest.fixture(scope="module")
47-
def simple_url_rewriter_gen() -> (
48-
Generator[Callable[[str], ArticleUrlRewriter], None, None]
49-
):
47+
def simple_url_rewriter_gen() -> Generator[Callable[[str], ArticleUrlRewriter]]:
5048
"""Fixture to create a basic url rewriter returning URLs as-is"""
5149

5250
def get_simple_url_rewriter(url: str, suffix: str = "") -> ArticleUrlRewriter:
@@ -56,11 +54,13 @@ def get_simple_url_rewriter(url: str, suffix: str = "") -> ArticleUrlRewriter:
5654

5755

5856
@pytest.fixture(scope="module")
59-
def js_rewriter_gen() -> Generator[
60-
Callable[[ArticleUrlRewriter, str | None, Callable[[ZimPath], None]], JsRewriter],
61-
None,
62-
None,
63-
]:
57+
def js_rewriter_gen() -> (
58+
Generator[
59+
Callable[
60+
[ArticleUrlRewriter, str | None, Callable[[ZimPath], None]], JsRewriter
61+
]
62+
]
63+
):
6464
"""Fixture to create a basic url rewriter returning URLs as-is"""
6565

6666
def get_js_rewriter(
@@ -79,7 +79,7 @@ def get_js_rewriter(
7979

8080
@pytest.fixture(scope="module")
8181
def css_rewriter_gen() -> (
82-
Generator[Callable[[ArticleUrlRewriter, str | None], CssRewriter], None, None]
82+
Generator[Callable[[ArticleUrlRewriter, str | None], CssRewriter]]
8383
):
8484
"""Fixture to create a basic url rewriter returning URLs as-is"""
8585

0 commit comments

Comments
 (0)