Skip to content

Commit 600bf5a

Browse files
authored
BLD: Try using shared memory utilities in Cython to reduce wheel sizes
1 parent e55d907 commit 600bf5a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

meson.build

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,27 @@ endif
4747
cy = meson.get_compiler('cython')
4848
if cy.version().version_compare('>=3.1.0')
4949
add_project_arguments('-Xfreethreading_compatible=true', language: 'cython')
50+
51+
# Use shared utility code to reduce wheel sizes
52+
# copied from https://github.com/scikit-learn/scikit-learn/pull/31151/files
53+
cy = find_program(cy.cmd_array()[0])
54+
cython_shared_src = custom_target(
55+
install: false,
56+
output: '_cyutility.c',
57+
command: [
58+
cy, '-3', '--fast-fail',
59+
'--generate-shared=' + meson.current_build_dir()/'_cyutility.c'
60+
],
61+
)
62+
63+
py.extension_module('_cyutility',
64+
cython_shared_src,
65+
subdir: 'pandas/_libs',
66+
cython_args: cython_args,
67+
install: true,
68+
)
69+
70+
add_project_arguments('--shared=pandas._libs._cyutility'', language: 'cython')
5071
endif
5172

5273
# Needed by pandas.test() when it looks for the pytest ini options

0 commit comments

Comments
 (0)