-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BLD: Split out tests into pandas_tests package #53007
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
base: main
Are you sure you want to change the base?
Changes from all commits
d3edcdf
8e0d861
bd83272
339dacc
eea0220
a5a89b3
48df264
d00e471
a43c9fe
b2c2b8c
d6ac87c
427ea4e
7174249
f50f110
9cbbb66
053ad48
f2573ee
547dcc1
1044441
f3c182a
06d3697
13063d8
8254943
9ed91e0
d4502af
b61a6a4
1a6531c
e00ecf5
799687f
1d6137b
792c011
2a78345
16f5964
b911945
beb64dc
3135e67
d17ddaf
50410ad
554d478
8d68f7d
98ec61a
b8e3588
a19f2e6
b4aa062
a2ba3bf
7ee6adc
19fa7f9
be64699
f1c18cc
e835993
5bdc0d1
2cf3911
e9ba935
e53ad08
23952aa
23b9827
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 |
---|---|---|
|
@@ -46,6 +46,7 @@ jobs: | |
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} | ||
outputs: | ||
sdist_file: ${{ steps.save-path.outputs.sdist_name }} | ||
pandas_tests_loc: ${{ steps.save-tests-path.outputs.pandas_tests_loc }} | ||
steps: | ||
- name: Checkout pandas | ||
uses: actions/checkout@v4 | ||
|
@@ -59,22 +60,34 @@ jobs: | |
|
||
- name: Build sdist | ||
run: | | ||
python -m pip install build | ||
python -m pip install build wheel setuptools-scm | ||
python -m build --sdist | ||
|
||
- name: Build pandas_tests | ||
run: | | ||
cd pandas | ||
# we want to place the pandas_tests wheel in the same | ||
# dist directory as the sdist | ||
python -m build --wheel --outdir ../dist --no-isolation | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: sdist | ||
name: sdist-and-tests | ||
path: ./dist/* | ||
|
||
- name: Sanity check sdist files | ||
- name: Sanity check built files | ||
run: | | ||
ls ./dist | ||
|
||
- name: Output sdist name | ||
id: save-path | ||
shell: bash -el {0} | ||
run: echo "sdist_name=$(ls ./dist)" >> "$GITHUB_OUTPUT" | ||
run: echo "sdist_name=$(ls ./dist/*.tar.gz)" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Output pandas_tests location | ||
id: save-tests-path | ||
shell: bash -el {0} | ||
run: echo "pandas_tests_loc=$(ls ./dist/*.whl)" >> "$GITHUB_OUTPUT" | ||
|
||
build_wheels: | ||
needs: build_sdist | ||
|
@@ -109,52 +122,48 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
# TODO: Build wheels from sdist again | ||
# There's some sort of weird race condition? | ||
# within Github that makes the sdist be missing files | ||
|
||
# We need to build wheels from the sdist since the sdist | ||
# removes unnecessary files from the release | ||
- name: Download sdist (not macOS) | ||
#if: ${{ matrix.buildplat[1] != 'macosx_*' }} | ||
- name: Download sdist and pandas_tests | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: sdist | ||
name: sdist-and-tests | ||
path: ./dist | ||
|
||
- name: Output sdist name (macOS) | ||
id: save-path | ||
shell: bash -el {0} | ||
run: echo "sdist_name=$(ls ./dist)" >> "$GITHUB_ENV" | ||
|
||
# Python version used to build sdist doesn't matter | ||
# wheel will be built from sdist with the correct version | ||
# The sdist will be corrupted by cibuildwheel/macOS sometimes somehow | ||
WillAyd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# (I think this is a Github Actions bug) | ||
- name: Unzip sdist (macOS) | ||
if: ${{ startsWith(matrix.buildplat[1], 'macosx') }} | ||
run: | | ||
tar -xzf ./dist/${{ env.sdist_name }} -C ./dist | ||
tar -xzf ${{ needs.build_sdist.outputs.sdist_file }} -C ./dist | ||
|
||
- name: Output sdist name (macOS) | ||
- name: Output new sdist name (macOS) | ||
id: save-path2 | ||
if: ${{ matrix.buildplat[1] == 'macosx_*' }} | ||
shell: bash -el {0} | ||
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV" | ||
run: echo "sdist_name=./dist/$(cd ./dist && ls -d */)" >> "$GITHUB_ENV" | ||
|
||
- name: Build normal wheels | ||
if: ${{ (env.IS_SCHEDULE_DISPATCH != 'true' || env.IS_PUSH == 'true') }} | ||
uses: pypa/[email protected] | ||
with: | ||
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }} | ||
package-dir: ${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }} | ||
env: | ||
CIBW_PRERELEASE_PYTHONS: True | ||
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} | ||
# Note: Since the sdist is the project directory, it does not contain the tests | ||
WillAyd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# We need to manually install tests from the host. This isn't ideal since it breaks | ||
# isolation but should be no big deal | ||
# (On Linux, need to prefix with /host, since we run builds in a container and the root directory is | ||
# mounted to host) | ||
CIBW_BEFORE_TEST: > | ||
pip install ${{ startsWith(matrix.buildplat[0], 'ubuntu') && '/host'|| '' }}${{ github.workspace }}/${{ needs.build_sdist.outputs.pandas_tests_loc }} | ||
|
||
- name: Build nightly wheels (with NumPy pre-release) | ||
if: ${{ (env.IS_SCHEDULE_DISPATCH == 'true' && env.IS_PUSH != 'true') }} | ||
uses: pypa/[email protected] | ||
with: | ||
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }} | ||
env: | ||
# The nightly wheels should be build witht he NumPy 2.0 pre-releases | ||
# The nightly wheels should be build with the NumPy 2.0 pre-releases | ||
# which requires the additional URL. | ||
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple | ||
CIBW_PRERELEASE_PYTHONS: True | ||
|
@@ -185,13 +194,15 @@ jobs: | |
$TST_CMD = @" | ||
python -m pip install hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0; | ||
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl); | ||
python -m pip install `$(Get-Item pandas\dist\pandas_tests*.whl); | ||
python -c `'import pandas as pd; pd.test(extra_args=[`\"--no-strict-data-files`\", `\"-m not clipboard and not single_cpu and not slow and not network and not db`\"])`'; | ||
"@ | ||
# add rc to the end of the image name if the Python version is unreleased | ||
docker pull python:${{ matrix.python[1] == '3.12' && '3.12-rc' || format('{0}-windowsservercore', matrix.python[1]) }} | ||
docker run --env PANDAS_CI='1' -v ${PWD}:C:\pandas python:${{ matrix.python[1] == '3.12' && '3.12-rc' || format('{0}-windowsservercore', matrix.python[1]) }} powershell -Command $TST_CMD | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} | ||
path: ./wheelhouse/*.whl | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,6 +189,19 @@ | |
__git_version__ = v.get("full-revisionid") | ||
del get_versions, v | ||
|
||
import sys | ||
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. Does this break an API users potentially use. If so will we need a depr cycle? 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. Kinda. This is technically breaking, but the next release also happens to be 3.0, so I think we'd be able to get away with a breaking change here :) |
||
|
||
try: | ||
import pandas_tests # pyright: ignore [reportMissingImports] | ||
|
||
sys.modules["pandas.tests"] = pandas_tests | ||
|
||
del pandas_tests | ||
except ImportError: | ||
pass | ||
|
||
del sys | ||
|
||
|
||
# module level doc-string | ||
__doc__ = """ | ||
|
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.
Is setuptools-scm a misnomer or does it have some kind of dependency with setuptools?
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.
We use it to version the pandas-tests package?
Setting up versioneer is probably overkill for pandas-tests.
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.
Hmm not sure I understand. So this does still require setuptools right? I think that is confusing given the work we have put into meson to replace that library
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.
Yeah, pandas-tests is built using setuptools.
I figured it was much easier to use setuptools given this is a pure Python package.
(Note that if you're just doing regular development you'll never need setuptools, unless you want to build pandas_tests by hand for some reason)