1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
From 5842ee415f9357a9418cc8341d621b6e1e2aaddd Mon Sep 17 00:00:00 2001
From: TibRib <thibaud.simon@amadeus.com>
Date: Fri, 8 Aug 2025 15:24:03 +0200
Subject: [PATCH] Upgrade cython to 3.0+ to suppport Python3.13 and upwards
---
.appveyor.yml | 6 ++++--
HACKING.md | 3 +++
README.md | 2 +-
doc/requirements-dev.txt | 3 ++-
doc/requirements-docs.txt | 2 +-
doc/requirements-test.txt | 7 +++++--
imgui/ansifeed.pxd | 6 +++---
imgui/cimgui.pxd | 5 +++--
imgui/core.pxd | 2 +-
imgui/core.pyx | 29 +++++++++++++++--------------
imgui/internal.pxd | 6 +++---
imgui/internal.pyx | 6 +++---
pyproject.toml | 2 +-
setup.py | 4 +++-
14 files changed, 48 insertions(+), 35 deletions(-)
diff --git a/.appveyor.yml b/.appveyor.yml
index a9fb2d43..963007b8 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -6,6 +6,8 @@ image:
environment:
matrix:
+ - CIBW_BUILD: "cp313-*"
+ - CIBW_BUILD: "cp312-*"
- CIBW_BUILD: "cp311-*"
- CIBW_BUILD: "cp310-*"
- CIBW_BUILD: "cp39-*"
@@ -17,7 +19,7 @@ environment:
- CIBW_BUILD: "pp38-*"
- CIBW_BUILD: "pp37-*"
-stack: python 3.7
+stack: python 3.8
init:
- cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH%
@@ -25,7 +27,7 @@ init:
install: |
python --version
git submodule update --init --recursive
- python -m pip install cibuildwheel==2.12.1
+ python -m pip install cibuildwheel==2.23.3
build_script: python -m cibuildwheel --output-dir dist
diff --git a/HACKING.md b/HACKING.md
index 5ea13377..b357d1ec 100644
--- a/HACKING.md
+++ b/HACKING.md
@@ -58,6 +58,9 @@ We may have specific plans that you are not informed of.
For running tests, you will need some additional
requirements from `doc/requirements-test.txt`.
+You will additionally need to build extension in-place before running.
+`python setup.py build_ext --inplace`
+
You can run tests with:
py.test
diff --git a/README.md b/README.md
index 1a71583e..8893ba8d 100644
--- a/README.md
+++ b/README.md
@@ -79,7 +79,7 @@ succesfully for all major operating systems with different architectures:
* Linux (32bit & 64bit)
* OS X (universal build)
-Right now we are ready shipping the built wheels for these three systems
+Right now we are ready shipping the built wheels for these systems
(even for Linux using `manylinux1` wheels). The build pipeline covers multiple
Python versions:
diff --git a/doc/requirements-dev.txt b/doc/requirements-dev.txt
index 41e9b1ac..2ffa2156 100644
--- a/doc/requirements-dev.txt
+++ b/doc/requirements-dev.txt
@@ -1,5 +1,6 @@
-Cython>=0.24,<0.30
+Cython>=3.0
PyOpenGL
glfw
wheel
click
+glibc
diff --git a/doc/requirements-docs.txt b/doc/requirements-docs.txt
index cf336d6c..62b4089b 100644
--- a/doc/requirements-docs.txt
+++ b/doc/requirements-docs.txt
@@ -1,4 +1,4 @@
-Cython>=0.24,<0.30
+Cython>=3.0
Sphinx==6.1.3
#docutils<0.13.1
PyOpenGL
diff --git a/doc/requirements-test.txt b/doc/requirements-test.txt
index 8fa66bb9..b24bb270 100644
--- a/doc/requirements-test.txt
+++ b/doc/requirements-test.txt
@@ -1,6 +1,8 @@
-Cython>=0.24,<0.30
+Cython>=3.0
click
wheel
+pytest
+setuptools
# note: Sphinx and docutils are for collecting tests
# note: Newer Sphinx versions won't work on Python 2.7 and Python 3.3
@@ -9,7 +11,8 @@ wheel
Sphinx==1.6.7; python_version < '3.7.0'
# note: But older versions wont collect tests on Python 3.7
Sphinx==1.8.1; python_version >= '3.7.0' and python_version < '3.8'
-Sphinx==6.1.3; python_version >= '3.8.0'
+Sphinx==6.1.3; python_version >= '3.8.0' and python_version < '3.13'
+Sphinx==7.4.7; python_version >= '3.13'
markupsafe==0.23; python_version >= '3.7.0' and python_version < '3.8'
diff --git a/imgui/ansifeed.pxd b/imgui/ansifeed.pxd
index 29c4a095..c0ea7d89 100644
--- a/imgui/ansifeed.pxd
+++ b/imgui/ansifeed.pxd
@@ -8,9 +8,9 @@ Notes:
`✗` marks API element as "yet to be mapped
"""
-cimport cimgui
-
-from cimgui cimport ImVec4
+cimport cython
+from . cimport cimgui
+from .cimgui cimport ImVec4
cdef extern from "../ansifeed-cpp/AnsiTextColored.h" namespace "ImGui":
void TextAnsi(const char* fmt, ...) except + # ✓
diff --git a/imgui/cimgui.pxd b/imgui/cimgui.pxd
index d5c5c935..8b30f16d 100644
--- a/imgui/cimgui.pxd
+++ b/imgui/cimgui.pxd
@@ -8,7 +8,7 @@ Notes:
"""
from libcpp cimport bool
-from enums cimport ImGuiKey_, ImGuiCol_, ImGuiSliderFlags_
+from .enums cimport ImGuiKey_, ImGuiCol_, ImGuiSliderFlags_
cdef extern from "imgui.h":
# ====
@@ -708,7 +708,8 @@ cdef extern from "imgui.h":
float Ascent # ✗
float Descent # ✗
int MetricsTotalSurface # ✗
- ImU8 Used4kPagesMap[(IM_UNICODE_CODEPOINT_MAX+1)/4096/8] # ✗
+ ImU8 Used4kPagesMap[544] # ✗
+ # (IM_UNICODE_CODEPOINT_MAX+1)/4096/8 = (0x10FFFF+1)/4096/8 = 544
# Methods
const ImFontGlyph*FindGlyph(ImWchar c) except + # ✗
diff --git a/imgui/core.pxd b/imgui/core.pxd
index 04ce6caf..1de4bc04 100644
--- a/imgui/core.pxd
+++ b/imgui/core.pxd
@@ -3,7 +3,7 @@ This file provides all C/C++ definitions that need to be shared between all
extension modules. This is mostly for the `extra` submodule that provides
some additional utilities that do not belong to `core`.
"""
-cimport cimgui
+from . cimport cimgui
cdef class _Font(object):
cdef cimgui.ImFont* _ptr
diff --git a/imgui/core.pyx b/imgui/core.pyx
index f96eaaa1..9bbac83a 100644
--- a/imgui/core.pyx
+++ b/imgui/core.pyx
@@ -24,18 +24,19 @@ from libc.stdlib cimport malloc, realloc, free
from libc.stdint cimport uintptr_t
from libc.string cimport strdup
from libc.string cimport strncpy, strlen
-from libc.float cimport FLT_MIN
-from libc.float cimport FLT_MAX
+from libc.float cimport FLT_MIN
+from libc.float cimport FLT_MAX
from libcpp cimport bool
FLOAT_MIN = FLT_MIN
FLOAT_MAX = FLT_MAX
+FLOAT_SIZE = sizeof(float)
-cimport cimgui
-cimport core
-cimport enums
-cimport ansifeed
-cimport internal
+from . cimport cimgui
+from . cimport core
+from . cimport enums
+from . cimport ansifeed
+from . cimport internal
from cpython.version cimport PY_MAJOR_VERSION
@@ -3525,7 +3526,7 @@ cdef class _IO(object):
cdef cvarray nav_inputs = cvarray(
shape=(enums.ImGuiNavInput_COUNT,),
format='f',
- itemsize=sizeof(float),
+ itemsize=FLOAT_SIZE,
allocate_buffer=False
)
nav_inputs.data = <char*>self._ptr.NavInputs
@@ -3659,7 +3660,7 @@ cdef class _InputTextSharedBuffer(object):
cdef _InputTextSharedBuffer _input_text_shared_buffer = _InputTextSharedBuffer()
-cdef int _ImGuiInputTextCallback(cimgui.ImGuiInputTextCallbackData* data):
+cdef int _ImGuiInputTextCallback(cimgui.ImGuiInputTextCallbackData* data) noexcept:
cdef _ImGuiInputTextCallbackData callback_data = _ImGuiInputTextCallbackData.from_ptr(data)
callback_data._require_pointer()
@@ -3671,7 +3672,7 @@ cdef int _ImGuiInputTextCallback(cimgui.ImGuiInputTextCallbackData* data):
cdef ret = (<_callback_user_info>callback_data._ptr.UserData).callback_fn(callback_data)
return ret if ret is not None else 0
-cdef int _ImGuiInputTextOnlyResizeCallback(cimgui.ImGuiInputTextCallbackData* data):
+cdef int _ImGuiInputTextOnlyResizeCallback(cimgui.ImGuiInputTextCallbackData* data) noexcept:
# This callback is used internally if user asks for buffer resizing but does not provide any python callback function.
if data.EventFlag == enums.ImGuiInputTextFlags_CallbackResize:
@@ -3825,7 +3826,7 @@ cdef class _ImGuiInputTextCallbackData(object):
-cdef void _ImGuiSizeCallback(cimgui.ImGuiSizeCallbackData* data):
+cdef void _ImGuiSizeCallback(cimgui.ImGuiSizeCallbackData* data) noexcept:
cdef _ImGuiSizeCallbackData callback_data = _ImGuiSizeCallbackData.from_ptr(data)
callback_data._require_pointer()
(<_callback_user_info>callback_data._ptr.UserData).callback_fn(callback_data)
@@ -9977,7 +9978,7 @@ def plot_lines(
float scale_min = FLOAT_MAX,
float scale_max = FLOAT_MAX,
graph_size = (0, 0),
- int stride = sizeof(float),
+ int stride = FLOAT_SIZE,
):
"""
@@ -10035,7 +10036,7 @@ def plot_lines(
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
ImVec2 graph_size = ImVec2(0,0),
- int stride = sizeof(float)
+ int stride = FLOAT_SIZE
)
"""
if values_count == -1:
@@ -10069,7 +10070,7 @@ def plot_histogram(
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
graph_size = (0, 0),
- int stride = sizeof(float),
+ int stride = 32,
):
"""
Plot a histogram of float values.
diff --git a/imgui/internal.pxd b/imgui/internal.pxd
index 583f7244..fba4c638 100644
--- a/imgui/internal.pxd
+++ b/imgui/internal.pxd
@@ -9,10 +9,10 @@ Notes:
"""
from libcpp cimport bool
-from enums cimport ImGuiKey_, ImGuiCol_, ImGuiSliderFlags_
+from .enums cimport ImGuiKey_, ImGuiCol_, ImGuiSliderFlags_
-cimport cimgui
-cimport enums_internal
+from . cimport cimgui
+from . cimport enums_internal
cdef UpdateImGuiContext(cimgui.ImGuiContext* _ptr)
diff --git a/imgui/internal.pyx b/imgui/internal.pyx
index fb4b42a8..ebfcd82e 100644
--- a/imgui/internal.pyx
+++ b/imgui/internal.pyx
@@ -5,9 +5,9 @@
import cython
-cimport cimgui
-cimport internal
-cimport enums_internal
+from . cimport cimgui
+from . cimport internal
+from . cimport enums_internal
from cpython.version cimport PY_MAJOR_VERSION
diff --git a/pyproject.toml b/pyproject.toml
index f1cee56d..38db4f4c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -15,7 +15,7 @@ environment = { LC_ALL="en_US.UTF-8", LANG="en_US.UTF-8" }
[build-system]
requires = [
- "Cython>=0.24,<0.30",
+ "Cython>=3.0",
"PyOpenGL",
"glfw",
"wheel",
diff --git a/setup.py b/setup.py
index eab3d538..2424c1e5 100644
--- a/setup.py
+++ b/setup.py
@@ -104,7 +104,7 @@ def backend_extras(*requirements):
return ["PyOpenGL"] + list(requirements)
EXTRAS_REQUIRE = {
- 'Cython': ['Cython>=0.24,<0.30'],
+ 'Cython': ['Cython>=3.0'],
'cocos2d': backend_extras(
"cocos2d",
"pyglet>=1.5.6; sys_platform == 'darwin'",
@@ -180,6 +180,8 @@ def backend_extras(*requirements):
'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 :: Implementation :: CPython',
'Programming Language :: Cython',
|