Support free-threaded Python
Not urgent to fix, but importing on free-threaded build fails:
Python 3.13.0rc1 experimental free-threading build (main, Aug 7 2024, 15:09:54) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import whenever
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
import whenever
File "/Users/arie/code/whenever/pysrc/whenever/__init__.py", line 2, in <module>
from ._whenever import *
SystemError: init function of _whenever returned uninitialized object
>>>
After some experimentation, I can't find the cause yet. Even after removing the entire module contents, I still get the error. I'll have to do more digging.
With the introduction of whenever's own timezone logic, supporting free-threaded Python will become non-trivial. This because the timezone cache is a shared mutable state that will require concurrency control (if the GIL is absent). That said, Rust has the right building blocks to enable this, of course.
Will free-threaded Python be supported in the first version of the released current improvements? We are interested in using that variant exclusively for performance benefits and so that we have ample time to prepare for when it becomes the default.
Happy to hear you're interested! It probably won't be included in the next release (0.8) because I don't want to delay it further—as it's been more than a month.
That said, releasing a thread-safe version of whenever would be quite the scoop, considering the standard library zoneinfo itself ~isn't even free-threading-enabled~ hasn't been declared threadsafe 👀. Might be a fun challenge, and also to finally get my hands dirty with sync Rust.
I can't give an indication of when I'll get to it, although I can say it's certainly not in the 'freezer'
edit: clarification