Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 341f161

Browse filesBrowse files
BLD: Try using shared memory utilities in Cython to reduce wheel sizes (#61384)
* BLD: Try using shared memory utilities in Cython to reduce wheel sizes * fix syntax * maybe fix? * switch keyword order? * try putting as list? * try the cython rc * add more version checks * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b2b2d04 commit 341f161
Copy full SHA for 341f161

File tree

5 files changed

+43
-3
lines changed
Filter options

5 files changed

+43
-3
lines changed

‎meson.build

Copy file name to clipboardExpand all lines: meson.build
+21Lines 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,
59+
'-3',
60+
'--fast-fail',
61+
'--generate-shared=' + meson.current_build_dir() / '_cyutility.c',
62+
],
63+
)
64+
65+
py.extension_module(
66+
'_cyutility',
67+
cython_shared_src,
68+
subdir: 'pandas/_libs',
69+
install: true,
70+
)
5071
endif
5172

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

‎pandas/_libs/meson.build

Copy file name to clipboardExpand all lines: pandas/_libs/meson.build
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ if get_option('buildtype') == 'debug'
148148
cython_args += ['--gdb']
149149
endif
150150

151+
# Use shared utility code to reduce wheel sizes
152+
# copied from https://github.com/scikit-learn/scikit-learn/pull/31151/files
153+
if cy.version().version_compare('>=3.1.0')
154+
cython_args += ['--shared=pandas._libs._cyutility']
155+
endif
156+
151157
foreach ext_name, ext_dict : libs_sources
152158
py.extension_module(
153159
ext_name,

‎pandas/_libs/tslibs/meson.build

Copy file name to clipboardExpand all lines: pandas/_libs/tslibs/meson.build
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ if get_option('buildtype') == 'debug'
2828
cython_args += ['--gdb']
2929
endif
3030

31+
# Use shared utility code to reduce wheel sizes
32+
# copied from https://github.com/scikit-learn/scikit-learn/pull/31151/files
33+
if cy.version().version_compare('>=3.1.0')
34+
cython_args += ['--shared=pandas._libs._cyutility']
35+
endif
36+
3137
foreach ext_name, ext_dict : tslibs_sources
3238
py.extension_module(
3339
ext_name,

‎pandas/_libs/window/meson.build

Copy file name to clipboardExpand all lines: pandas/_libs/window/meson.build
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
cy_args = ['-X always_allow_keywords=true']
2+
# Use shared utility code to reduce wheel sizes
3+
# copied from https://github.com/scikit-learn/scikit-learn/pull/31151/files
4+
if cy.version().version_compare('>=3.1.0')
5+
cython_args += ['--shared=pandas._libs._cyutility']
6+
endif
7+
18
py.extension_module(
29
'aggregations',
310
['aggregations.pyx'],
4-
cython_args: ['-X always_allow_keywords=true'],
11+
cython_args: cy_args,
512
include_directories: [inc_np, inc_pd],
613
subdir: 'pandas/_libs/window',
714
override_options: ['cython_language=cpp'],
@@ -11,7 +18,7 @@ py.extension_module(
1118
py.extension_module(
1219
'indexers',
1320
['indexers.pyx'],
14-
cython_args: ['-X always_allow_keywords=true'],
21+
cython_args: cy_args,
1522
include_directories: [inc_np, inc_pd],
1623
subdir: 'pandas/_libs/window',
1724
install: true,

‎pyproject.toml

Copy file name to clipboardExpand all lines: pyproject.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ requires = [
55
"meson-python>=0.13.1",
66
"meson>=1.2.1,<2",
77
"wheel",
8-
"Cython~=3.0.5", # Note: sync with setup.py, environment.yml and asv.conf.json
8+
"Cython==3.1.0rc1", # Note: sync with setup.py, environment.yml and asv.conf.json
99
# Force numpy higher than 2.0rc1, so that built wheels are compatible
1010
# with both numpy 1 and 2
1111
"numpy>=2.0.0rc1",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.