openzim / openzim/python-libzim

Enhance no GIL / free threaded support

Open
#240 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
108
Forks
29
Avg merge
9d 1h
Merged PRs (30d)
1

Description

CPython now has free-threaded builds since 3.13: https://docs.python.org/3/howto/free-threading-python.html

In https://github.com/openzim/python-libzim/pull/237 (to be released as 3.8.0), we've fixed tests and documentation regarding the fact that python-libzim requires the GIL ATM.

We need to investigate if we really need the GIL, because multiple methods are already marked as nogil, especially important ones around the creation of the ZIM (where we do expect the python-libzim user to handle thread-safety when required).

Aim would be to mark the module as free-threaded. I don't know yet how to do this with Cython (if possible at all).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Python's free-threading documentation and the existing methods marked nogil. Investigate whether Cython can mark the module as free-threaded and whether the binding truly requires the GIL. Done means the module supports free-threaded builds safely, with the relevant tests and documentation updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.