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 127 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
5 changes: 1 addition & 4 deletions .circleci/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ if pip list | grep -q ^pandas; then
pip uninstall -y pandas || true
fi

echo "Build extensions"
python setup.py build_ext -q -j4

echo "Install pandas"
python -m pip install --no-build-isolation --no-use-pep517 -e .
python -m pip install --no-build-isolation -ve .

echo "done"
14 changes: 9 additions & 5 deletions .github/actions/build_pandas/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build pandas
description: Rebuilds the C extensions and installs pandas
inputs:
editable:
description: Whether to build pandas in editable mode (default true)
default: true
runs:
using: composite
steps:
Expand All @@ -12,9 +16,9 @@ runs:

- name: Build Pandas
run: |
python setup.py build_ext -j $N_JOBS
python -m pip install -e . --no-build-isolation --no-use-pep517 --no-index
if [[ ${{ inputs.editable }} == "true" ]]; then
pip install -e . --no-build-isolation -v
else
pip install . --no-build-isolation -v
fi
shell: bash -el {0}
env:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
N_JOBS: ${{ runner.os == 'macOS' && 3 || 2 }}
20 changes: 16 additions & 4 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,24 @@ jobs:
- name: Build Pandas
id: build
uses: ./.github/actions/build_pandas
with:
editable: false

# The following checks are independent of each other and should still be run if one fails

# TODO: The doctests have to be run first right now, since the Cython doctests only work
# with pandas installed in non-editable mode
# This can be removed once pytest-cython doesn't require C extensions to be installed inplace
- name: Run doctests
run: cd ci && ./code_checks.sh doctests
if: ${{ steps.build.outcome == 'success' && always() }}

- name: Install pandas in editable mode
id: build-editable
uses: ./.github/actions/build_pandas
with:
editable: true

- name: Check for no warnings when building single-page docs
run: ci/code_checks.sh single-docs
if: ${{ steps.build.outcome == 'success' && always() }}
Expand All @@ -73,10 +89,6 @@ jobs:
run: ci/code_checks.sh code
if: ${{ steps.build.outcome == 'success' && always() }}

- name: Run doctests
run: ci/code_checks.sh doctests
if: ${{ steps.build.outcome == 'success' && always() }}

- name: Run docstring validation
run: ci/code_checks.sh docstrings
if: ${{ steps.build.outcome == 'success' && always() }}
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/package-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,7 @@ jobs:
with:
python-version: '3.10'

- name: Install required dependencies
run: |
python -m pip install --upgrade pip setuptools wheel python-dateutil pytz numpy cython
python -m pip install versioneer[toml]
shell: bash -el {0}

- name: Pip install with extra
run: |
python -m pip install -e .[${{ matrix.extra }}] --no-build-isolation
python -m pip install .[${{ matrix.extra }}] -v
shell: bash -el {0}
13 changes: 5 additions & 8 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,9 @@ jobs:
run: |
/opt/python/cp39-cp39/bin/python -m venv ~/virtualenvs/pandas-dev
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir --no-deps -U pip wheel setuptools
python -m pip install -U pip wheel setuptools meson[ninja]==1.0.1 meson-python==0.13.1
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.0.0 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
python setup.py build_ext -q -j$(nproc)
python -m pip install --no-cache-dir --no-build-isolation --no-use-pep517 -e .
python -m pip install --no-cache-dir --no-build-isolation -e .
python -m pip list
export PANDAS_CI=1
python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml
Expand Down Expand Up @@ -268,10 +267,9 @@ jobs:
run: |
/opt/python/cp39-cp39/bin/python -m venv ~/virtualenvs/pandas-dev
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir --no-deps -U pip wheel setuptools
python -m pip install -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.0.1
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.0.0 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
python setup.py build_ext -q -j$(nproc)
python -m pip install --no-cache-dir --no-build-isolation --no-use-pep517 -e .
python -m pip install --no-cache-dir --no-build-isolation -e .
python -m pip list --no-cache-dir

- name: Run Tests
Expand Down Expand Up @@ -347,8 +345,7 @@ jobs:

- name: Build Pandas
run: |
python setup.py build_ext -q -j4
python -m pip install -e . --no-build-isolation --no-use-pep517 --no-index
python -m pip install -e . --no-build-isolation --no-index

- name: Build Version
run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
- [ubuntu-20.04, manylinux_x86_64]
- [macos-11, macosx_*]
- [windows-2019, win_amd64]
- [windows-2019, win32]
# TODO: support PyPy?
python: [["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"]]# "pp39"]
env:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*.py[ocd]
*.so
.build_cache_dir
.mesonpy-native-file.ini
MANIFEST

# Python files #
Expand Down Expand Up @@ -76,6 +77,8 @@ coverage_html_report
__pycache__
# pytest-monkeytype
monkeytype.sqlite3
# meson editable install folder
.mesonpy


# OS generated files #
Expand Down
8 changes: 4 additions & 4 deletions asv_bench/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
// pip (with all the conda available packages installed first,
// followed by the pip installed packages).
"matrix": {
"numpy": [],
"Cython": ["0.29.33"],
"matplotlib": [],
"sqlalchemy": [],
Expand All @@ -56,6 +55,9 @@
"xlrd": [],
"odfpy": [],
"jinja2": [],
"meson": [],
"meson-python": [],
"python-build": [],
},
"conda_channels": ["conda-forge"],
// Combinations of libraries/python versions can be excluded/included
Expand Down Expand Up @@ -125,7 +127,5 @@
"regression_thresholds": {
},
"build_command":
["python -m pip install versioneer[toml]",
"python setup.py build -j4",
"PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"],
["python -m build -Cbuilddir=builddir --wheel --outdir {build_cache_dir} {build_dir}"]
}
9 changes: 2 additions & 7 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,8 @@ fi
### DOCTESTS ###
if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then

MSG='Doctests' ; echo $MSG
# Ignore test_*.py files or else the unit tests will run
python -m pytest --doctest-modules --ignore-glob="**/test_*.py" pandas
RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Cython Doctests' ; echo $MSG
python -m pytest --doctest-cython pandas/_libs
MSG='Python and Cython Doctests' ; echo $MSG
python -c 'import pandas as pd; pd.test(run_doctests=True)'
RET=$(($RET + $?)) ; echo $MSG "DONE"

fi
Expand Down
7 changes: 6 additions & 1 deletion ci/deps/actions-310-numpydev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ dependencies:

# build dependencies
- versioneer[toml]
- meson[ninja]=1.0.1
- meson-python=0.13.1

# test dependencies
- pytest>=7.0.0
- pytest-cov
- pytest-xdist>=2.2.0
# Once pytest-cov > 4 comes out, unpin this
# Right now, a DeprecationWarning related to rsyncdir
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 still an issue?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, pytest-cov hasn't released anything since September sadly.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm do you know why we are seeing this DeprecationWarning which changing to meson? (just curious, not a blocker)

# causes an InternalError within pytest
- pytest-xdist>=2.2.0, <3
- hypothesis>=6.46.1
- pytest-asyncio>=0.17.0

Expand Down
2 changes: 2 additions & 0 deletions ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ dependencies:
# build dependencies
- versioneer[toml]
- cython>=0.29.33
- meson[ninja]=1.0.1
- meson-python=0.13.1

# test dependencies
- pytest>=7.0.0
Expand Down
2 changes: 2 additions & 0 deletions ci/deps/actions-311-pyarrownightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ dependencies:

# build dependencies
- versioneer[toml]
- meson[ninja]=1.0.1
- cython>=0.29.33
- meson-python=0.13.1

# test dependencies
- pytest>=7.0.0
Expand Down
2 changes: 2 additions & 0 deletions ci/deps/actions-311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ dependencies:
# build dependencies
- versioneer[toml]
- cython>=0.29.33
- meson[ninja]=1.0.1
- meson-python=0.13.1

# test dependencies
- pytest>=7.0.0
Expand Down
3 changes: 2 additions & 1 deletion ci/deps/actions-39-downstream_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ dependencies:
# build dependencies
- versioneer[toml]
- cython>=0.29.33
- meson[ninja]=1.0.1
- meson-python=0.13.1

# test dependencies
- pytest>=7.0.0
Expand Down Expand Up @@ -69,7 +71,6 @@ dependencies:
- pandas-datareader
- pyyaml
- py

- pip:
- pyqt5>=5.15.6
- tzdata>=2022.1
2 changes: 2 additions & 0 deletions ci/deps/actions-39-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ dependencies:
# build dependencies
- versioneer[toml]
- cython>=0.29.33
- meson[ninja]=1.0.1
- meson-python=0.13.1

# test dependencies
- pytest>=7.0.0
Expand Down
2 changes: 2 additions & 0 deletions ci/deps/actions-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ dependencies:
# build dependencies
- versioneer[toml]
- cython>=0.29.33
- meson[ninja]=1.0.1
- meson-python=0.13.1

# test dependencies
- pytest>=7.0.0
Expand Down
3 changes: 2 additions & 1 deletion ci/deps/actions-pypy-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ dependencies:
# build dependencies
- versioneer[toml]
- cython>=0.29.33
- meson[ninja]=1.0.1
- meson-python=0.13.1

# test dependencies
- pytest>=7.0.0
Expand All @@ -22,6 +24,5 @@ dependencies:
- numpy
- python-dateutil
- pytz

- pip:
- tzdata>=2022.1
2 changes: 2 additions & 0 deletions ci/deps/circle-39-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ dependencies:
# build dependencies
- versioneer[toml]
- cython>=0.29.33
- meson[ninja]=1.0.1
- meson-python=0.13.1

# test dependencies
- pytest>=7.0.0
Expand Down
4 changes: 2 additions & 2 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ if [[ "not network" == *"$PATTERN"* ]]; then
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
fi

COVERAGE="-s --cov=pandas --cov-report=xml --cov-append"
COVERAGE="-s --cov=pandas --cov-report=xml --cov-append --cov-config=pyproject.toml"

# If no X server is found, we use xvfb to emulate it
if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then
export DISPLAY=":0"
XVFB="xvfb-run "
fi

PYTEST_CMD="${XVFB}pytest -r fEs -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE $PYTEST_TARGET"
PYTEST_CMD="MESONPY_EDITABLE_VERBOSE=1 ${XVFB}pytest -r fEs -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE $PYTEST_TARGET"

if [[ "$PATTERN" ]]; then
PYTEST_CMD="$PYTEST_CMD -m \"$PATTERN\""
Expand Down
65 changes: 58 additions & 7 deletions doc/source/development/contributing_environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,47 @@ for :ref:`building pandas with GitPod <contributing-gitpod>`.
Step 3: build and install pandas
--------------------------------

You can now run::
There are currently two supported ways of building pandas, pip/meson and setuptools(setup.py).
Historically, pandas has only supported using setuptools to build pandas. However, this method
requires a lot of convoluted code in setup.py and also has many issues in compiling pandas in parallel
due to limitations in setuptools.

The newer build system, invokes the meson backend through pip (via a `PEP 517 <https://peps.python.org/pep-0517/>`_ build).
It automatically uses all available cores on your CPU, and also avoids the need for manual rebuilds by
rebuilding automatically whenever pandas is imported(with an editable install).

For these reasons, you should compile pandas with meson.
Because the meson build system is newer, you may find bugs/minor issues as it matures. You can report these bugs
`here <https://github.com/pandas-dev/pandas/issues/49683>`_.

To compile pandas with meson, run::

# Build and install pandas
# The number after -j is the number of compiling jobs run in parallel
# Change it according to your machine's hardware spec
python setup.py build_ext -j 4
python -m pip install -e . --no-build-isolation --no-use-pep517
python -m pip install -ve . --no-build-isolation

** Build options **

It is possible to pass options from the pip frontend to the meson backend if you would like to configure your
install. Occasionally, you'll want to use this to adjust the build directory, and/or toggle debug/optimization levels.

You can pass a build directory to pandas by appending ``--config-settings builddir="your builddir here"`` to your pip command.
This option allows you to configure where meson stores your built C extensions, and allows for fast rebuilds.

Sometimes, it might be useful to compile pandas with debugging symbols, when debugging C extensions.
Appending ``--config-settings setup-args="-Ddebug=true"`` will do the trick.

With pip, it is possible to chain together multiple config settings (for example specifying both a build directory
and building with debug symbols would look like
``--config-settings builddir="your builddir here" --config-settings setup-args="-Ddebug=true"``.

**Compiling pandas with setup.py**

.. note::
This method of compiling pandas will be deprecated and removed very soon, as the meson backend matures.

To compile pandas with setuptools, run::

python setup.py develop

.. note::
You will need to repeat this step each time the C extensions change, for example
Expand All @@ -226,5 +260,22 @@ At this point you should be able to import pandas from your locally built versio
>>> print(pandas.__version__) # note: the exact output may differ
2.0.0.dev0+880.g2b9e661fbb.dirty

This will create the new environment, and not touch any of your existing environments,
nor any existing Python installation.
When building pandas with meson, importing pandas will automatically trigger a rebuild, even when C/Cython files are modified.
By default, no output will be produced by this rebuild (the import will just take longer). If you would like to see meson's
output when importing pandas, you can set the environment variable ``MESONPY_EDTIABLE_VERBOSE``. For example, this would be::

# On Linux/macOS
MESONPY_EDITABLE_VERBOSE=1 python

# Windows
set MESONPY_EDITABLE_VERBOSE=1 # Only need to set this once per session
python

If you would like to see this verbose output every time, you can set the ``editable-verbose`` config setting to ``true`` like so::

python -m pip install -ve . --config-settings editable-verbose=true
Copy link
Member

Choose a reason for hiding this comment

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

This does not work with meson 1.0.0

meson-python: error: Unknown configuration entry "editable-verbose"

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, what version of meson-python are you using?
You need to install from main in order for editable installs to work.
Try reinstalling it.
e.g. pip uninstall meson-python && pip install git+https://github.com/mesonbuild/meson-python.git@main

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I already installed from meson main. No change when reinstalling

Copy link
Member

Choose a reason for hiding this comment

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

meson==1.0.0
meson-python @ git+https://github.com/mesonbuild/meson-python.git@8a13f8d199e4961fe2b0aeff01d231f510b6c59b

output from pip freeze

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 still outstanding?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for not getting back on this. This works for me on macOS.
Perhaps it was a bug in meson-python < 0.13.1

Copy link
Contributor

Choose a reason for hiding this comment

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

This works with 0.13.1 indeed, it can be resolved now. Editable support was added in 0.13.0 - the whole implementation changed after the Jan 4 comments.


.. tip::
If you ever find yourself wondering whether setuptools or meson was used to build your pandas,
you can check the value of ``pandas._built_with_meson``, which will be true if meson was used
to compile pandas.
Loading