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
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[run]
core = ctrace
plugins = Cython.Coverage
source = libzim
12 changes: 6 additions & 6 deletions .github/workflows/CI-wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, windows-2022, ubuntu-24.04]
os: [macos-14, windows-2022, ubuntu-24.04]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up QEMU
if: runner.os == 'Linux'
Expand All @@ -31,9 +31,9 @@ jobs:
platforms: all

- name: Build wheels
uses: pypa/cibuildwheel@v2.22
uses: pypa/cibuildwheel@v3.2

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
Expand All @@ -42,12 +42,12 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: sdist
path: dist/*.tar.gz
28 changes: 14 additions & 14 deletions .github/workflows/Publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04, macos-13, windows-2022]
os: [ubuntu-24.04, macos-14, windows-2022]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up QEMU
if: runner.os == 'Linux'
Expand All @@ -34,7 +34,7 @@ jobs:
platforms: all

- name: Prepare Apple Keychain for Signing
if: matrix.os == 'macos-13'
if: matrix.os == 'macos-14'
shell: bash
run: |
# store certificate on filesystem
Expand Down Expand Up @@ -68,17 +68,17 @@ jobs:
security unlock-keychain -p mysecretpassword ${APPLE_SIGNING_KEYCHAIN_PATH}

- name: Build wheels
uses: pypa/cibuildwheel@v2.22
uses: pypa/cibuildwheel@v3.2

- name: Cleanup Apple Keychain
if: matrix.os == 'macos-13'
if: matrix.os == 'macos-14'
shell: bash
run: |
security lock-keychain ${APPLE_SIGNING_KEYCHAIN_PATH}
security delete-keychain ${APPLE_SIGNING_KEYCHAIN_PATH}
rm -f ${APPLE_SIGNING_KEYCHAIN_PATH}

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
Expand All @@ -87,12 +87,12 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: sdist
path: dist/*.tar.gz
Expand All @@ -103,24 +103,24 @@ jobs:
environment: release
steps:
# retrieve all artifacts
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v6
with:
name: sdist
path: dist
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v6
with:
name: wheels-ubuntu-24.04
path: dist
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v6
with:
name: wheels-macos-13
name: wheels-macos-14
path: dist
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v6
with:
name: wheels-windows-2022
path: dist

- uses: pypa/gh-action-pypi-publish@v1.9.0
- uses: pypa/gh-action-pypi-publish@v1.13.0
with:
user: __token__
# password: ${{ secrets.PYPI_TEST_API_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/QA.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.13"
python-version: "3.14"
architecture: x64

- name: Install dependencies (and project)
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,35 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, windows-2022, ubuntu-24.04]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [macos-14, macos-15, macos-15-intel, windows-2022, windows-2025, ubuntu-22.04, ubuntu-24.04]
python: ["3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
architecture: x64

- name: Display Python version
run: python -VV

- name: Install dependencies (and project)
run: |
pip install -U pip
pip install -e .[test,scripts]

- name: move DLLs next to wrapper
if: matrix.os == 'windows-2022'
if: startsWith(matrix.os, 'windows-')
run: Move-Item -Force -Path .\libzim\*.dll -Destination .\

- name: Run the tests
run: inv coverage --args "-vvv"

- name: Upload coverage report to codecov
if: matrix.os == 'ubuntu-24.04' && matrix.python == '3.13'
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-24.04' && matrix.python == '3.14'
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Maintenance upgrades (#237):
- Drop support of Python 3.9
- Add support for Python 3.14
- Upgrade dependencies, especially Cython 3.1.6
- Upgrade supported macOS to 14.0+ (instead of 13.0+)
- Add support for free-threaded CPython (3.13 and 3.14)
- Upgrade Github CI Actions
- Run tests on minimum supported platforms + more recent stable ones

## [3.7.0] - 2025-04-18

### Added
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Our [PyPI wheels](https://pypi.org/project/libzim/) bundle a [recent release](ht

Wheels are available for CPython only (but can be built for Pypy).

Free-threaded CPython is not supported. If you use a free-threaded CPython, GIL must be turned on (using the environment variable PYTHON_GIL or the command-line option -X gil). If you don't turn it on yourself, GIL will be forced-on and you will get a warning. Only few methods support the GIL to be disabled.

Users on other platforms can install the source distribution (see [Building](#Building) below).


Expand Down
4 changes: 2 additions & 2 deletions libzim/writer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Blob:
class ContentProvider:
def feed(self) -> Blob: ...
def get_size(self) -> int: ...
def gen_blob(self) -> Generator[Blob, None, None]: ...
def gen_blob(self) -> Generator[Blob]: ...

generator: Generator[Blob, None, None]
generator: Generator[Blob]

class StringProvider(ContentProvider):
def __init__(self, content: str | bytes) -> None: ...
Expand Down
65 changes: 34 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[build-system]
requires = [
"setuptools == 74.1.1",
"wheel == 0.44.0",
"cython == 3.0.11",
"setuptools == 80.9.0",
"wheel == 0.45.1",
"cython == 3.1.6",
# https://github.com/pypa/cibuildwheel/blob/v2.22/cibuildwheel/resources/constraints.txt
"delocate == 0.12.0 ; platform_system=='Windows'",
"delocate == 0.13.0 ; platform_system=='Windows'",
]
build-backend = "setuptools.build_meta"

[project]
name = "libzim"
version = "3.7.1-dev0"
requires-python = ">=3.9,<3.14"
requires-python = ">=3.10,<3.15"
description = "A python-facing API for creating and interacting with ZIM files"
authors = [
{name = "openZIM", email = "[email protected]"},
Expand All @@ -30,11 +30,11 @@ classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"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 :: 3.14",
"Typing :: Stubs Only",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: MacOS",
Expand All @@ -50,43 +50,43 @@ scripts = [
"invoke==2.2.0",
]
lint = [
"black==25.1.0",
"ruff==0.9.5",
"black==25.9.0",
"ruff==0.14.3",
"libzim",
"libzim[build]",
]
check = [
"pyright==1.1.393",
"pyright==1.1.407",
"libzim",
"libzim[build]",
"libzim[test]",
"types-setuptools",
]
test = [
"pytest==8.3.4",
"coverage==7.6.10",
"pytest==8.4.2",
"coverage==7.11.0",
# for cython coverage plugin
"libzim[build]",
]
build = [
"setuptools == 75.8.0",
"setuptools == 80.9.0",
"wheel == 0.45.1",
"cython == 3.0.11",
"delocate == 0.12.0 ; platform_system=='Windows'",
"cython == 3.1.6",
"delocate == 0.13.0 ; platform_system=='Windows'",
]
docs = [
"mkdocs==1.6.1",
"mkdocstrings-python==1.14.5",
"mkdocs-material==9.5.49",
"pymdown-extensions==10.14",
"mkdocstrings-python==1.18.2",
"mkdocs-material==9.6.23",
"pymdown-extensions==10.16.1",
"mkdocs-gen-files==0.5.0",
"mkdocs-literate-nav==0.6.1",
"mkdocs-include-markdown-plugin==7.1.2",
"griffe==1.5.6",
"mkdocs-literate-nav==0.6.2",
"mkdocs-include-markdown-plugin==7.2.0",
"griffe==1.14.0",
]
dev = [
"pre-commit==4.1.0",
"ipython==8.32.0",
"pre-commit==4.3.0",
"ipython==9.6.0",
"types-setuptools",
"libzim[scripts]",
"libzim[lint]",
Expand Down Expand Up @@ -123,6 +123,11 @@ skip = "pp* *win32*"
test-requires = ["pytest"]
test-command = "py.test {project}/tests/"

# Override test command for free-threaded builds to force GIL on
[[tool.cibuildwheel.overrides]]
select = "cp313t-* cp314t-*"
test-command = "python -X gil=1 -m pytest {project}/tests/"

manylinux-x86_64-image = "manylinux_2_28"
manylinux-aarch64-image = "manylinux_2_28"
manylinux-pypy_x86_64-image = "manylinux_2_28"
Expand All @@ -137,12 +142,10 @@ archs = ["x86_64", "aarch64"]

[tool.cibuildwheel.macos]
archs = ["x86_64", "arm64"]
# macOS arm64 is cross-compiled and can not be tested.
# cibuildwheel skips it already. *_arm64 this removes the warning
# skipping tests on cp <=3.9 as the wheels we produce are on unexpected combinations
# because those python versions were released before our building host version
# macOS x86_64 is cross-compiled and can not be tested.
# cibuildwheel skips it already. *_x86_64 this removes the warning
# > requires changing wheel names
test-skip = "*_arm64 cp39*"
test-skip = "*_x86_64"

[tool.hatch.build]
exclude = [
Expand All @@ -168,7 +171,7 @@ features = ["scripts", "test"]
PROFILE = "1"

[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]

[tool.hatch.envs.test.scripts]
run = "inv test --args '{args}'"
Expand Down Expand Up @@ -206,10 +209,10 @@ all = "inv checkall --args '{args}'"

[tool.black]
line-length = 88
target-version = ['py312']
target-version = ['py314']

[tool.ruff]
target-version = "py312"
target-version = "py314"
line-length = 88
src = ["src"]

Expand Down Expand Up @@ -336,6 +339,6 @@ exclude_lines = [
[tool.pyright]
include = ["libzim", "tests", "tasks.py"]
exclude = [".env/**", ".venv/**"]
pythonVersion = "3.13"
pythonVersion = "3.14"
typeCheckingMode="basic"
disableBytesTypePromotions = true
Loading
Loading