Skip to content

Commit d5b0c87

Browse files
committed
fix py 3.13 issue
1 parent 1969e36 commit d5b0c87

File tree

2 files changed

+16
-31
lines changed

2 files changed

+16
-31
lines changed

comfy_kitchen/backends/cuda/CMakeLists.txt

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,25 @@ set(CPP_SOURCES
112112
)
113113

114114
# Create the nanobind module
115+
# Python 3.12+: Use stable ABI (abi3) for forward compatibility with 3.13+
116+
# Python 3.10/3.11: Version-specific module (nanobind stable ABI requires 3.12+)
115117
if(Python_VERSION VERSION_GREATER_EQUAL "3.12")
116-
nanobind_add_module(_C
117-
NB_STATIC
118-
STABLE_ABI
119-
LTO
120-
${CPP_SOURCES}
121-
${CUDA_SOURCES}
122-
)
118+
message(STATUS "Python ${Python_VERSION} detected - enabling stable ABI (abi3)")
119+
nanobind_add_module(_C NB_STATIC STABLE_ABI LTO ${CPP_SOURCES} ${CUDA_SOURCES})
120+
# Explicitly set abi3 suffix
121+
if(WIN32)
122+
set_target_properties(_C PROPERTIES SUFFIX ".abi3.pyd")
123+
else()
124+
set_target_properties(_C PROPERTIES SUFFIX ".abi3.so")
125+
endif()
126+
target_compile_definitions(_C PRIVATE Py_LIMITED_API=0x030C0000)
123127
else()
124-
# Python 3.10/3.11: version-specific module
125-
nanobind_add_module(_C
126-
NB_STATIC
127-
LTO
128-
${CPP_SOURCES}
129-
${CUDA_SOURCES}
130-
)
128+
message(STATUS "Python ${Python_VERSION} detected - building version-specific wheel")
129+
nanobind_add_module(_C NB_STATIC LTO ${CPP_SOURCES} ${CUDA_SOURCES})
131130
endif()
132131

132+
target_compile_definitions(_C PRIVATE NB_STATIC)
133+
133134
# Set target properties
134135
target_compile_options(_C PRIVATE
135136
$<$<COMPILE_LANGUAGE:CUDA>:${CUDA_NVCC_FLAGS}>
@@ -181,22 +182,6 @@ if(CMAKE_CONFIGURATION_TYPES)
181182
)
182183
endif()
183184

184-
# Set properties for ABI3 compatibility (Stable ABI) - Python 3.12+ only
185-
# Nanobind's stable ABI support requires Python 3.12+
186-
if(Python_VERSION VERSION_GREATER_EQUAL "3.12")
187-
message(STATUS "Python ${Python_VERSION} detected - enabling stable ABI (abi3)")
188-
target_compile_definitions(_C PRIVATE
189-
Py_LIMITED_API=0x030C0000
190-
NB_STATIC
191-
)
192-
else()
193-
message(STATUS "Python ${Python_VERSION} detected - building version-specific wheel")
194-
target_compile_definitions(_C PRIVATE
195-
NB_STATIC
196-
)
197-
endif()
198-
199-
200185
# Install target
201186
install(TARGETS _C
202187
LIBRARY DESTINATION .

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
99

1010
[project]
1111
name = "comfy-kitchen"
12-
version = "0.1.5"
12+
version = "0.1.6"
1313
description = "Fast Kernel Library for ComfyUI with multiple compute backends"
1414
readme = "README.md"
1515
requires-python = ">=3.10"

0 commit comments

Comments
 (0)