-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python: Use meson-python instead of setuptools #644
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ if get_option('ipc') | |
) | ||
nanoarrow_ipc_dep = declare_dependency(include_directories: [incdir], | ||
link_with: nanoarrow_ipc_lib, | ||
dependencies: [nanoarrow_dep, flatcc_dep]) | ||
dependencies: [nanoarrow_dep]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it was a mistake to include the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm unclear on the difference but yes, the flatcc headers are deliberately not included in nanoarrow's public headers such that a library using nanoarrow does not need |
||
endif | ||
|
||
needs_device = get_option('device') or get_option('metal') or get_option('cuda') | ||
|
@@ -137,6 +137,10 @@ if needs_device | |
install: true, | ||
cpp_args: device_defines, | ||
) | ||
|
||
nanoarrow_device_dep = declare_dependency(include_directories: [incdir], | ||
link_with: nanoarrow_device_lib, | ||
dependencies: device_deps) | ||
endif | ||
|
||
needs_testing = get_option('testing') or get_option('tests') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import os | ||
import pathlib | ||
import shutil | ||
|
||
|
||
def main(): | ||
src_dir = pathlib.Path(os.environ["MESON_SOURCE_ROOT"]).parent.resolve() | ||
dist_dir = pathlib.Path(os.environ["MESON_DIST_ROOT"]).resolve() | ||
subproj_dir = dist_dir / "subprojects" / "arrow-nanoarrow" | ||
|
||
if subproj_dir.is_symlink(): | ||
subproj_dir.unlink() | ||
|
||
subproj_dir.mkdir() | ||
shutil.copy(src_dir / "meson.build", subproj_dir / "meson.build") | ||
shutil.copy(src_dir / "meson.options", subproj_dir / "meson.options") | ||
|
||
subproj_subproj_dir = subproj_dir / "subprojects" | ||
subproj_subproj_dir.mkdir() | ||
for f in (src_dir / "subprojects").glob("*.wrap"): | ||
shutil.copy(f, subproj_subproj_dir / f.name) | ||
|
||
target_src_dir = subproj_dir / "src" | ||
shutil.copytree(src_dir / "src", target_src_dir) | ||
|
||
# this files are only needed by bootstrap.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The amount of scripting here is unfortunate...would still be nice to replace bootstrap.py and/or bundle.py, but not sure I want to tackle that in this PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this PR I think you will have the most success just renaming There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean by "including a meson lib definition?" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah OK - so you want to run bootstrap.py continuously, not just when the distribution is being created? The current form uses the subproject symlink for live integration with the C project and only vendors when the distribution is created There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you can get all the tests passing and all the wheels building with that go for it! I think you will have more success tackling those two battles separately but the time is yours 🙂 |
||
shutil.copy(src_dir / "CMakeLists.txt", subproj_dir / "CMakeLists.txt") | ||
subproj_ci_scripts_dir = subproj_dir / "ci" / "scripts" | ||
subproj_ci_scripts_dir.mkdir(parents=True) | ||
shutil.copy( | ||
src_dir / "ci" / "scripts" / "bundle.py", subproj_ci_scripts_dir / "bundle.py" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,11 @@ Changelog = "https://github.com/apache/arrow-nanoarrow/blob/main/CHANGELOG.md" | |
|
||
[build-system] | ||
requires = [ | ||
"setuptools >= 61.0.0", | ||
"meson-python", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably need a version constraint here? |
||
"Cython" | ||
] | ||
build-backend = "setuptools.build_meta" | ||
build-backend = "mesonpy" | ||
|
||
[tool.meson-python.args] | ||
install = ['--skip-subprojects'] | ||
dist = ['--include-subprojects'] |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ | |
Arrow C Data and Arrow C Stream interfaces. | ||
""" | ||
|
||
import importlib.metadata | ||
|
||
from nanoarrow._utils import c_version | ||
from nanoarrow.c_array import c_array_from_buffers, c_array | ||
from nanoarrow.c_array_stream import c_array_stream | ||
|
@@ -75,7 +77,8 @@ | |
from nanoarrow.array import array, Array | ||
from nanoarrow.array_stream import ArrayStream | ||
from nanoarrow.visitor import nulls_as_sentinel, nulls_forbid, nulls_separate | ||
from nanoarrow._version import __version__ # noqa: F401 | ||
|
||
__version__ = importlib.metadata.version("nanoarrow") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jorisvandenbossche is there any issues with versioning in this way? Is there any cost to importing (I am only skeptical because I haven't seen a Python package do this before) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I accidentally removed the comment, but the downside to this approach versus a dynamic version generator like miniver is that the git hash is not included as part of the project metadata. In this case the project definition from pyproject.toml just imports whatever the build-backend provides, which is currently 0.7.0-SNAPSHOT |
||
|
||
# Helps Sphinx automatically populate an API reference section | ||
__all__ = [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like setup-python still installs a 32 bit Python by default on the windows runner, while cibuildwheel is expected 64 bit on that host
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still get 32-bit wheels?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe so...I think cibuildwheel controls that, and since we don't override anything in the pyproject.toml I think it should still generate the same types of wheels as specified here:
https://cibuildwheel.pypa.io/en/stable/options/#build-skip
Admittedly my knowledge of Windows and how it builds for different architectures is limited, so definitely something to verify when wheels actually get build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might have to update the
python-wheels.yaml
workflow to fire onpython/meson.build
instead ofpython/setup.py
to get it to run on this PR (in which case we can inspect the results and find out!)