Skip to content

Commit 6291b9b

Browse files
committed
Adjust for editable support in meson-python
1 parent 0ee732d commit 6291b9b

File tree

11 files changed

+21
-30
lines changed

11 files changed

+21
-30
lines changed

.github/workflows/32-bit-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ jobs:
4343
pip install "git+https://github.com/mesonbuild/meson-python.git@main" && \
4444
python -m pip install versioneer[toml] && \
4545
export PANDAS_CI=1 && \
46-
python -m pip install --no-build-isolation -v . && \
46+
python -m pip install --no-build-isolation -ev . && \
4747
python -m pip list && \
48-
pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml --import-mode=importlib"
48+
pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml
4949
5050
- name: Publish test results for Python 3.8-32 bit full Linux
5151
uses: actions/upload-artifact@v3

.github/workflows/code-checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
if: ${{ steps.build.outcome == 'success' && always() }}
7171

7272
- name: Run checks on imported code
73-
run: cd ci && ./code_checks.sh code
73+
run: ci/code_checks.sh code
7474
if: ${{ steps.build.outcome == 'success' && always() }}
7575

7676
- name: Run doctests
@@ -99,7 +99,7 @@ jobs:
9999
if: ${{ steps.build.outcome == 'success' && always() }}
100100

101101
- name: Run docstring validation script tests
102-
run: pytest scripts --import-mode=append
102+
run: pytest scripts
103103
if: ${{ steps.build.outcome == 'success' && always() }}
104104

105105
asv-benchmarks:

.github/workflows/docbuild-and-upload.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ jobs:
4949
run: python web/pandas_web.py web/pandas --target-path=web/build
5050

5151
- name: Build documentation
52-
run: python doc/make.py --warnings-are-errors
52+
run: doc/make.py --warnings-are-errors
5353

5454
- name: Build documentation zip
55-
run: python doc/make.py zip_html
55+
run: doc/make.py zip_html
5656

5757
- name: Install ssh key
5858
run: |

.github/workflows/package-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ jobs:
5252

5353
- name: Pip install with extra
5454
run: |
55-
python -m pip install .[${{ matrix.extra }}] -v
55+
python -m pip install .[${{ matrix.extra }}] -v --no-build-isolation
5656
shell: bash -el {0}

.github/workflows/python-dev.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ jobs:
8585
8686
# Sigh, someone (numpy?) is depending on mingw, which pandas doesn't compile with.
8787
# Also, meson doesn't detect visual c++ unless cl.exe is in path.
88-
# TODO: File a bug with meson about this.
88+
# TODO: File a bug with meson-python about this.
8989
- name: Build Pandas
9090
if : ${{ runner.os != 'Windows' }}
9191
run: |
92-
python3 -m pip install . --no-build-isolation -v
92+
python3 -m pip install -ve . --no-build-isolation
9393
shell: bash -el {0}
9494

9595
- name: Build Pandas (Windows)
@@ -102,8 +102,7 @@ jobs:
102102

103103
- name: Build Version
104104
run: |
105-
# Can't import pandas from the source directory
106-
cd .. && python -c "import pandas; pandas.show_versions();"
105+
python -c "import pandas; pandas.show_versions();"
107106
108107
- name: Test
109108
uses: ./.github/actions/run-tests

.github/workflows/sdist.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,9 @@ jobs:
4646

4747
- name: Install dependencies
4848
run: |
49-
python -m pip install --upgrade pip setuptools wheel build Cython oldest-supported-numpy
49+
python -m pip install --upgrade pip setuptools wheel build
5050
python -m pip install versioneer[toml]
5151
52-
# GH 39416
53-
pip install numpy
54-
5552
- name: Build pandas sdist
5653
run: |
5754
pip list

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ RUN apt-get install -y build-essential
77
# hdf5 needed for pytables installation
88
RUN apt-get install -y libhdf5-dev
99

10-
1110
RUN python -m pip install --upgrade pip
1211
RUN python -m pip install \
1312
-r https://raw.githubusercontent.com/pandas-dev/pandas/main/requirements-dev.txt

ci/code_checks.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,11 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
6767

6868
MSG='Doctests' ; echo $MSG
6969
# Ignore test_*.py files or else the unit tests will run
70-
# cd out of pandas directory, otherwise regular unit tests will also be collected
71-
# TODO: fix?
72-
cd ~
73-
python -c 'import pandas as pd; pd.test(extra_args=["--doctest-modules", "--ignore-glob=**/test_*.py", "-v"])'
70+
python -m pytest --doctest-modules --ignore-glob="**/test_*.py" pandas
7471
RET=$(($RET + $?)) ; echo $MSG "DONE"
7572

7673
MSG='Cython Doctests' ; echo $MSG
77-
python -c 'import pandas as pd; pd.test(extra_args=["--doctest-cython", "--ignore-glob=**/test_*.py", "-v"])'
74+
python -m pytest --doctest-cython pandas/_libs
7875
RET=$(($RET + $?)) ; echo $MSG "DONE"
7976

8077
fi

ci/run_tests.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash -e
22

3-
43
# Workaround for pytest-xdist (it collects different tests in the workers if PYTHONHASHSEED is not set)
54
# https://github.com/pytest-dev/pytest/issues/920
65
# https://github.com/pytest-dev/pytest/issues/1075
@@ -14,7 +13,7 @@ if [[ "not network" == *"$PATTERN"* ]]; then
1413
fi
1514

1615
if [[ "$COVERAGE" == "true" ]]; then
17-
COVERAGE="-s --cov=pandas --cov-report=xml --cov-append --cov-config=setup.cfg"
16+
COVERAGE="-s --cov=pandas --cov-report=xml --cov-append"
1817
else
1918
COVERAGE="" # We need to reset this for COVERAGE="false" case
2019
fi
@@ -25,7 +24,7 @@ if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then
2524
XVFB="xvfb-run "
2625
fi
2726

28-
PYTEST_CMD="${XVFB}pytest -r fEs -n $PYTEST_WORKERS --dist=loadfile --import-mode=importlib $TEST_ARGS $COVERAGE $PYTEST_TARGET"
27+
PYTEST_CMD="${XVFB}pytest -r fEs -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE $PYTEST_TARGET"
2928

3029
if [[ "$PATTERN" ]]; then
3130
PYTEST_CMD="$PYTEST_CMD -m \"$PATTERN\""
@@ -34,7 +33,7 @@ fi
3433
echo $PYTEST_CMD
3534
sh -c "$PYTEST_CMD"
3635

37-
if [[ "$PANDAS_DATA_MANAGER" != "array" && "$PYTEST_TARGET" == "pandas/pandas" ]]; then
36+
if [[ "$PANDAS_DATA_MANAGER" != "array" && "$PYTEST_TARGET" == "pandas" ]]; then
3837
# The ArrayManager tests should have already been run by PYTEST_CMD if PANDAS_DATA_MANAGER was already set to array
3938
# If we're targeting specific files, e.g. test_downstream.py, don't run.
4039
PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE pandas"

doc/make.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ def main():
324324
"'ecosystem.rst', 'pandas.DataFrame.join'"
325325
),
326326
)
327+
argparser.add_argument(
328+
"--python-path", type=str, default=os.path.dirname(DOC_PATH), help="path"
329+
)
327330
argparser.add_argument(
328331
"-v",
329332
action="count",
@@ -350,6 +353,8 @@ def main():
350353
# external libraries (namely Sphinx) to compile this module and resolve
351354
# the import of `python_path` correctly. The latter is used to resolve
352355
# the import within the module, injecting it into the global namespace
356+
os.environ["PYTHONPATH"] = args.python_path
357+
sys.path.insert(0, args.python_path)
353358
globals()["pandas"] = importlib.import_module("pandas")
354359

355360
# Set the matplotlib backend to the non-interactive Agg backend for all

doc/source/development/contributing_codebase.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -787,11 +787,6 @@ options or subtle interactions to test (or think of!) all of them.
787787
Running the test suite
788788
----------------------
789789

790-
.. note::
791-
If you have built pandas with meson, you'll need to add the
792-
``--import-mode=importlib`` flag to each pytest invocation, or pandas
793-
will fail to import in the tests.
794-
795790
The tests can then be run directly inside your Git clone (without having to
796791
install pandas) by typing::
797792

0 commit comments

Comments
 (0)