Skip to content
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

BLD: Setup meson builds #49115

Merged
merged 129 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
a5b2572
BLD: Add meson.build files
lithomas1 Oct 15, 2022
7191763
BLD: Python changes to make meson build work
lithomas1 Oct 15, 2022
65be7cc
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Oct 17, 2022
e5805fc
Revert moving generate_version.py to scripts
lithomas1 Oct 17, 2022
2e89b1f
Update for sas byteswap module
lithomas1 Oct 18, 2022
66346a4
Update
lithomas1 Oct 22, 2022
e267f87
Add pyproject.toml changes
lithomas1 Oct 23, 2022
545a91a
Merge branch 'meson-py-file-changes' into add-meson-build-files
lithomas1 Oct 23, 2022
f85bd93
Revert "Add pyproject.toml changes"
lithomas1 Oct 23, 2022
8896002
Merge branch 'main' into add-meson-build-files
lithomas1 Oct 25, 2022
399a93f
fix style?
lithomas1 Oct 29, 2022
d01fe1a
fix?
lithomas1 Oct 29, 2022
9b64577
Squashed commit of the following:
lithomas1 Nov 9, 2022
0de3320
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Nov 9, 2022
a26c9dd
catchsegv and prepare to disable asserts
lithomas1 Nov 9, 2022
cf24f5d
Go for green
lithomas1 Nov 10, 2022
c5cbcab
green take 2
lithomas1 Nov 11, 2022
f56d1d4
Go for green take 3
lithomas1 Nov 11, 2022
24d07c2
forgot something
lithomas1 Nov 12, 2022
8ceb278
get the code-checks passing too
lithomas1 Nov 12, 2022
7d26fca
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Nov 12, 2022
796d4c4
Fix the darn code checks
lithomas1 Nov 12, 2022
d2764ef
pls work
lithomas1 Nov 12, 2022
ec386f7
maybe get the last failure
lithomas1 Nov 12, 2022
069e76e
pls work
lithomas1 Nov 12, 2022
9068490
maybe maybe maybe???
lithomas1 Nov 12, 2022
6d18625
pls work
lithomas1 Nov 13, 2022
496294c
Respect pyproject.toml
lithomas1 Nov 13, 2022
2e642e8
Maybe bring back cython doctests
lithomas1 Nov 13, 2022
2157f06
Cleanup
lithomas1 Nov 13, 2022
f1555ee
Cleanup
lithomas1 Nov 15, 2022
057ea20
Merge branch 'main' into add-meson-build-files
lithomas1 Nov 15, 2022
beeab2a
Revert changes to 32 bit
lithomas1 Nov 18, 2022
4ecbb41
Fix tests and benchmarks
lithomas1 Nov 18, 2022
e4c5933
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Nov 18, 2022
d00d35a
Fix bad merge
lithomas1 Nov 18, 2022
a823304
Try to fix tests after sync
lithomas1 Nov 19, 2022
073e371
Fix package checks
lithomas1 Nov 19, 2022
55f7ec8
Update
lithomas1 Nov 23, 2022
5c5a0ac
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Nov 23, 2022
5570d9b
update deps
lithomas1 Nov 23, 2022
2b5505e
Update all deps
lithomas1 Nov 23, 2022
a7a2e6f
update the rest
lithomas1 Nov 23, 2022
6ef5a18
Go for green
lithomas1 Nov 23, 2022
9fd9d2b
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Nov 23, 2022
782a8c7
Disable arm64 wheels for now
lithomas1 Nov 23, 2022
3dae633
Merge branch 'main' into add-meson-build-files
lithomas1 Nov 25, 2022
f86b11a
Merge branch 'add-meson-build-files' of github.com:lithomas1/pandas i…
lithomas1 Nov 25, 2022
d7a7bf1
Add docs
lithomas1 Nov 26, 2022
597dd67
update test docs
lithomas1 Nov 26, 2022
aa94fc7
Merge branch 'main' into add-meson-build-files
lithomas1 Nov 29, 2022
77ed403
Update wheels.yml
lithomas1 Nov 29, 2022
a2a8361
Merge branch 'main' into add-meson-build-files
lithomas1 Nov 29, 2022
a01aee8
Bad merge
lithomas1 Nov 29, 2022
b0a2093
Merge branch 'main' into add-meson-build-files
lithomas1 Dec 3, 2022
c2291dc
Fix benchmarks
lithomas1 Dec 3, 2022
6663d31
Update test_rolling.py
lithomas1 Dec 3, 2022
094957d
Update test_rolling.py
lithomas1 Dec 4, 2022
4fe3ec0
Merge branch 'pandas-dev:main' into add-meson-build-files
lithomas1 Dec 7, 2022
0ee732d
Merge branch 'main' into add-meson-build-files
lithomas1 Dec 23, 2022
6291b9b
Adjust for editable support in meson-python
lithomas1 Dec 30, 2022
f6422e5
Merge branch 'main' into add-meson-build-files
lithomas1 Dec 30, 2022
e1f750e
fixes
lithomas1 Dec 30, 2022
f36e014
Merge branch 'add-meson-build-files' of github.com:lithomas1/pandas i…
lithomas1 Dec 30, 2022
6ed4572
Try again
lithomas1 Dec 30, 2022
792c9eb
bring back cov-config
lithomas1 Dec 30, 2022
d64acbf
syntax
lithomas1 Dec 30, 2022
de5c42f
fix arraymanager
lithomas1 Dec 30, 2022
a862508
go for green
lithomas1 Dec 30, 2022
320a64b
Merge branch 'add-meson-build-files' of github.com:lithomas1/pandas i…
lithomas1 Dec 30, 2022
a7f973a
Update docs
lithomas1 Dec 31, 2022
fe904c5
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Jan 3, 2023
1bdedc6
Update contributing_environment.rst
lithomas1 Jan 3, 2023
9e1ccc2
Merge branch 'add-meson-build-files' of github.com:lithomas1/pandas i…
lithomas1 Jan 7, 2023
09c573d
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Jan 7, 2023
9c63bb1
Re-enable more tests
lithomas1 Jan 7, 2023
a3e7ba2
fix code checks
lithomas1 Jan 8, 2023
7a5e1d8
Also install _util.py
lithomas1 Jan 8, 2023
7f6afda
Install in editable mode on Windows as well
lithomas1 Jan 8, 2023
b9e9087
Merge branch 'pandas-dev:main' into add-meson-build-files
lithomas1 Jan 10, 2023
9592429
Merge branch 'main' into add-meson-build-files
lithomas1 Jan 21, 2023
cc89d18
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Feb 11, 2023
c228822
Add back the conda-forge compilers
lithomas1 Feb 13, 2023
cd38f4c
Merge branch 'main' into add-meson-build-files
lithomas1 Feb 16, 2023
3136cc5
debug
lithomas1 Mar 2, 2023
93f6e86
Merge branch 'main' into add-meson-build-files
lithomas1 Mar 2, 2023
b8be6a4
try something
lithomas1 Mar 2, 2023
12617c0
Merge branch 'main' into add-meson-build-files
lithomas1 Mar 2, 2023
6d088dd
missing deps for 3.11
lithomas1 Mar 2, 2023
23c2aaa
Merge branch 'main' into add-meson-build-files
lithomas1 Mar 3, 2023
3d92e2b
Bump meson, simplify
lithomas1 Mar 4, 2023
3b6bc5c
Merge branch 'main' into add-meson-build-files
lithomas1 Mar 14, 2023
61e4172
update for capsules?
lithomas1 Mar 14, 2023
cd5137c
more fixes
lithomas1 Mar 14, 2023
65bba29
Merge branch 'main' into add-meson-build-files
lithomas1 Mar 18, 2023
7225844
debug
lithomas1 Mar 18, 2023
e6133df
pin meson-python
lithomas1 Mar 18, 2023
dd46921
add back coverage stuff
lithomas1 Mar 24, 2023
9142148
Merge branch 'main' into add-meson-build-files
lithomas1 Mar 24, 2023
cf67679
yay, a 32 bit test passed
lithomas1 Mar 24, 2023
5213192
Merge branch 'main' into add-meson-build-files
lithomas1 Mar 26, 2023
3881827
fully fix 32-bit
lithomas1 Mar 28, 2023
2306dd5
pin more
lithomas1 Mar 28, 2023
e8389ca
remove unnecessary import
lithomas1 Mar 28, 2023
dc9d5f1
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 Apr 10, 2023
1ff6c41
Squashed commit of the following:
lithomas1 Apr 11, 2023
41ef248
fixes
lithomas1 Apr 12, 2023
98600cc
Merge branch 'main' into add-meson-build-files
lithomas1 Apr 18, 2023
e34480a
remove libreduction
lithomas1 Apr 18, 2023
fe03652
go for green
lithomas1 Apr 22, 2023
b513ee8
go for green
lithomas1 Apr 23, 2023
00fd024
Update code-checks.yml
lithomas1 Apr 23, 2023
f854c02
Merge branch 'main' into add-meson-build-files
lithomas1 Apr 23, 2023
6270a2a
fix id
lithomas1 Apr 23, 2023
035df6b
fix code checks
lithomas1 Apr 23, 2023
a3e59fa
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 May 3, 2023
1bfd61e
Go for green
lithomas1 May 3, 2023
ae67059
use python instead of python3
lithomas1 May 3, 2023
70a43bb
fix 32bit/musl compile command
lithomas1 May 3, 2023
996b93c
updates
lithomas1 May 4, 2023
432cd42
go for green
lithomas1 May 4, 2023
cda4d05
Fix code checks again? and musllinux
lithomas1 May 4, 2023
62fa12c
fix doctests
lithomas1 May 4, 2023
4df819c
fix docstrings
lithomas1 May 4, 2023
46845d5
remove extra meson-python install
lithomas1 May 4, 2023
58895b2
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 May 4, 2023
d9d1658
remove some TODOs
lithomas1 May 4, 2023
28237d9
Merge branch 'main' of https://github.com/pandas-dev/pandas into add-…
lithomas1 May 9, 2023
7774dea
update debug instructions
lithomas1 May 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,18 @@
from pandas.util._tester import test

# use the closest tagged version if possible
from pandas._version import get_versions
_built_with_meson = False
try:
from pandas._version_meson import __version__, __git_version__

_built_with_meson = True
except ImportError:
from pandas._version import get_versions

v = get_versions()
__version__ = v.get("closest-tag", v["version"])
__git_version__ = v.get("full-revisionid")
del get_versions, v
v = get_versions()
__version__ = v.get("closest-tag", v["version"])
__git_version__ = v.get("full-revisionid")
del get_versions, v

# GH 27101
__deprecated_num_index_names = ["Float64Index", "Int64Index", "UInt64Index"]
Expand Down
15 changes: 11 additions & 4 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def check(self, namespace, expected, ignored=None):
class TestPDApi(Base):
# these are optionally imported based on testing
# & need to be ignored
ignored = ["tests", "locale", "conftest"]
ignored = ["tests", "locale", "conftest", "_version_meson"]

# top-level sub-packages
public_lib = [
Expand All @@ -43,7 +43,7 @@ class TestPDApi(Base):
"io",
"tseries",
]
private_lib = ["compat", "core", "pandas", "util"]
private_lib = ["compat", "core", "pandas", "util", "_built_with_meson"]

# these are already deprecated; awaiting removal
deprecated_modules: list[str] = ["np", "datetime"]
Expand Down Expand Up @@ -195,8 +195,9 @@ class TestPDApi(Base):
"_is_numpy_dev",
"_testing",
"_typing",
"_version",
]
if not pd._built_with_meson:
private_modules.append("_version")

def test_api(self):

Expand Down Expand Up @@ -316,8 +317,14 @@ def test_util_testing_deprecated_direct(self):
assert "pandas.util.testing is deprecated" in str(m[0].message)
assert "pandas.testing instead" in str(m[0].message)

def test_util_in_top_level(self):
def test_util_in_top_level(self, monkeypatch):
# in a subprocess to avoid import caching issues

# Can't import pandas from the test directory since its not
# built inplace with meson
if pd._built_with_meson:
monkeypatch.chdir("..")

out = subprocess.check_output(
[
sys.executable,
Expand Down
12 changes: 10 additions & 2 deletions pandas/tests/io/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,13 @@ def test_gzip_reproducibility_file_object():
assert output == buffer.getvalue()


def test_with_missing_lzma():
def test_with_missing_lzma(monkeypatch):
"""Tests if import pandas works when lzma is not present."""
# https://github.com/pandas-dev/pandas/issues/27575
# Can't import pandas from the test directory since its not
# built inplace with meson
if pd._built_with_meson:
WillAyd marked this conversation as resolved.
Show resolved Hide resolved
monkeypatch.chdir("..")
code = textwrap.dedent(
"""\
import sys
Expand All @@ -214,10 +218,14 @@ def test_with_missing_lzma():
subprocess.check_output([sys.executable, "-c", code], stderr=subprocess.PIPE)


def test_with_missing_lzma_runtime():
def test_with_missing_lzma_runtime(monkeypatch):
"""Tests if RuntimeError is hit when calling lzma without
having the module available.
"""
# Can't import pandas from the test directory since its not
# built inplace with meson
if pd._built_with_meson:
monkeypatch.chdir("..")
code = textwrap.dedent(
"""
import sys
Expand Down
13 changes: 11 additions & 2 deletions pandas/tests/plotting/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
PeriodIndex,
Series,
Timestamp,
_built_with_meson,
arrays,
date_range,
)
Expand Down Expand Up @@ -45,8 +46,12 @@
dates = pytest.importorskip("matplotlib.dates")


def test_registry_mpl_resets():
def test_registry_mpl_resets(monkeypatch):
# Check that Matplotlib converters are properly reset (see issue #27481)
# Can't import pandas from the test directory since its not
# built inplace with meson
if _built_with_meson:
monkeypatch.chdir("..")
code = (
"import matplotlib.units as units; "
"import matplotlib.dates as mdates; "
Expand All @@ -65,7 +70,11 @@ def test_timtetonum_accepts_unicode():


class TestRegistration:
def test_dont_register_by_default(self):
def test_dont_register_by_default(self, monkeypatch):
# Can't import pandas from the test directory since its not
# built inplace with meson
if _built_with_meson:
monkeypatch.chdir("..")
# Run in subprocess to ensure a clean state
code = (
"import matplotlib.units; "
Expand Down
23 changes: 20 additions & 3 deletions pandas/tests/test_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,21 @@ def test_xarray_cftimeindex_nearest():
assert result == expected


def test_oo_optimizable():
def test_oo_optimizable(monkeypatch):
# GH 21071
# Can't import pandas from the test directory since its not
# built inplace with meson
if pd._built_with_meson:
monkeypatch.chdir("..")
subprocess.check_call([sys.executable, "-OO", "-c", "import pandas"])


def test_oo_optimized_datetime_index_unpickle():
def test_oo_optimized_datetime_index_unpickle(monkeypatch):
# GH 42866
# Can't import pandas from the test directory since its not
# built inplace with meson
if pd._built_with_meson:
monkeypatch.chdir("..")
subprocess.check_call(
[
sys.executable,
Expand Down Expand Up @@ -270,7 +278,11 @@ def test_yaml_dump(df):
tm.assert_frame_equal(df, loaded2)


def test_missing_required_dependency():
def test_missing_required_dependency(monkeypatch):
# TODO: This test is basically disabled until we have
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still relevant?

# editable installs in meson-python. Re-enable this when
# that happens.

# GH 23868
# To ensure proper isolation, we pass these flags
# -S : disable site-packages
Expand All @@ -283,6 +295,11 @@ def test_missing_required_dependency():
# We skip this test if pandas is installed as a site package. We first
# import the package normally and check the path to the module before
# executing the test which imports pandas with site packages disabled.

# Can't import pandas from the test directory since its not
# built inplace with meson
if pd._built_with_meson:
monkeypatch.chdir("..")
call = [pyexe, "-c", "import pandas;print(pandas.__file__)"]
output = subprocess.check_output(call).decode()
if "site-packages" in output:
Expand Down
11 changes: 8 additions & 3 deletions pandas/util/_print_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ def _get_commit_hash() -> str | None:
Use vendored versioneer code to get git hash, which handles
git worktree correctly.
"""
from pandas._version import get_versions
try:
from pandas._version_meson import __git_version__

versions = get_versions()
return versions["full-revisionid"]
return __git_version__
except ImportError:
from pandas._version import get_versions

versions = get_versions()
return versions["full-revisionid"]


def _get_sys_info() -> dict[str, JSONSerializable]:
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
# Minimum requirements for the build system to execute.
# See https://github.com/scipy/scipy/pull/12940 for the AIX issue.
requires = [
"setuptools>=51.0.0",
"meson-python",
"wheel",
"Cython>=0.29.32,<3", # Note: sync with setup.py, environment.yml and asv.conf.json
"oldest-supported-numpy>=0.10"
]
# uncomment to enable pep517 after versioneer problem is fixed.
# https://github.com/python-versioneer/python-versioneer/issues/193
# build-backend = "setuptools.build_meta"
build-backend = "mesonpy"

[tool.cibuildwheel]
skip = "cp36-* cp37-* pp37-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux*"
Expand Down
6 changes: 5 additions & 1 deletion scripts/validate_min_versions_in_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def get_versions_from_ci(content: list[str]) -> tuple[dict[str, str], dict[str,
elif "# optional dependencies" in line:
seen_optional = True
elif seen_required and line.strip():
package, version = line.strip().split("=")
try:
package, version = line.strip().split("=")
except ValueError:
# pip dependencies, just skip
continue
package = package[2:]
if package in EXCLUDE_DEPS:
continue
Expand Down