Skip to content

Commit

Permalink
add python 3.13 wheels, now that its ABI is stable
Browse files Browse the repository at this point in the history
  • Loading branch information
ariebovenberg committed Aug 2, 2024
1 parent 27ecc62 commit 7c52227
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
if : ${{ matrix.os == 'windows' }}
with:
python-version: '3.12'
python-version: '3.13'
architecture: ${{ matrix.python-architecture || 'x64' }}
allow-prereleases: true
- run: pip install -U twine
- name: Generate third-party license information
run: |
Expand All @@ -73,7 +75,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --strip --out dist --interpreter '3.9 3.10 3.11 3.12'
args: --release --strip --out dist --interpreter '3.9 3.10 3.11 3.12 3.13'
manylinux: ${{ matrix.manylinux || 'auto' }}
sccache: 'true'
rust-toolchain: "1.79"
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
🚀 Changelog
============

0.6.7 (2024-08-02)
------------------

- Add Python 3.13 binary wheels, now that its ABI is stable
- Small improvements to import speed

0.6.6 (2024-07-27)
------------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors = [
{name = "Arie Bovenberg", email = "a.c.bovenberg@gmail.com"},
]
readme = "README.md"
version = "0.6.6"
version = "0.6.7rc0"
description = "Modern datetime library for Python, written in Rust"
requires-python = ">=3.9"
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion pysrc/whenever/_pywhenever.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# - It saves some overhead
from __future__ import annotations

__version__ = "0.6.6"
__version__ = "0.6.7rc0"

import enum
import re
Expand Down
24 changes: 13 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,22 +440,24 @@ unsafe extern "C" fn module_exec(module: *mut PyObject) -> c_int {

// Making time patcheable results in a performance hit.
// Only enable it if the time_machine module is available.
state.time_machine_exists = match PyImport_ImportModule(c"time_machine".as_ptr()).as_result() {
Ok(m) => {
Py_DecRef(m);
true
}
Err(_) => {
PyErr_Clear();
false
}
};

state.time_machine_exists = unwrap_or_errcode!(time_machine_installed());
state.time_patch = TimePatch::Unset;

0
}

unsafe fn time_machine_installed() -> PyResult<bool> {
// Important: we don't import the `time_machine` here,
// because that would be slower. We only need to check its existence.
let find_spec = PyObject_GetAttrString(
steal!(PyImport_ImportModule(c"importlib.util".as_ptr()).as_result()?),
c"find_spec".as_ptr(),
);
let spec = call1(find_spec, steal!("time_machine".to_py()?))?;
defer_decref!(spec);
Ok(!((spec as *mut PyObject) == Py_None()))
}

unsafe fn do_visit(target: *mut PyObject, visit: visitproc, arg: *mut c_void) {
let obj: *mut PyObject = target.cast();
if !obj.is_null() {
Expand Down

0 comments on commit 7c52227

Please sign in to comment.