Skip to content

BLD: Add pyproject.toml to wheels #50330

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

Merged
merged 22 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ jobs:
pip install hypothesis>=6.34.2 pytest>=7.0.0 pytest-xdist>=2.2.0 pytest-asyncio>=0.17
cd .. # Not a good idea to test within the src tree
python -c "import pandas; print(pandas.__version__);
pandas.test(extra_args=['-m not clipboard and not single_cpu', '--skip-slow', '--skip-network', '--skip-db', '-n=2']);
pandas.test(extra_args=['-m not clipboard and single_cpu', '--skip-slow', '--skip-network', '--skip-db'])"
pandas.test(extra_args=['-m not clipboard and not single_cpu', '--skip-slow', '--skip-network', '--skip-db', '-n=2', '--no-strict-data-files']);
pandas.test(extra_args=['-m not clipboard and single_cpu', '--skip-slow', '--skip-network', '--skip-db', '--no-strict-data-files'])"
- uses: actions/upload-artifact@v3
with:
name: sdist
Expand Down
38 changes: 21 additions & 17 deletions ci/test_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,24 @@
else:
import pandas as pd

pd.test(
extra_args=[
"-m not clipboard and not single_cpu",
"--skip-slow",
"--skip-network",
"--skip-db",
"-n=2",
]
)
pd.test(
extra_args=[
"-m not clipboard and single_cpu",
"--skip-slow",
"--skip-network",
"--skip-db",
]
)
for data_manager in ["block", "array"]:
os.environ["PANDAS_DATA_MANAGER"] = data_manager
pd.test(
extra_args=[
"-m not clipboard and not single_cpu",
"--skip-slow",
"--skip-network",
"--skip-db",
"--no-strict-data-files",
"-n=2",
]
)
pd.test(
extra_args=[
"-m not clipboard and single_cpu",
"--skip-slow",
"--skip-network",
"--skip-db",
"--no-strict-data-files",
]
)
4 changes: 2 additions & 2 deletions ci/test_wheels_windows.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set test_command=import pandas as pd; print(pd.__version__); ^
pd.test(extra_args=['-m not clipboard and not single_cpu', '--skip-slow', '--skip-network', '--skip-db', '-n=2']); ^
pd.test(extra_args=['-m not clipboard and single_cpu', '--skip-slow', '--skip-network', '--skip-db'])
pd.test(extra_args=['-m not clipboard and not single_cpu', '--skip-slow', '--skip-network', '--skip-db', '--no-strict-data-files', '-n=2']); ^
pd.test(extra_args=['-m not clipboard and single_cpu', '--skip-slow', '--skip-network', '--skip-db', '--no-strict-data-files'])

python --version
pip install pytz six numpy python-dateutil
Expand Down
14 changes: 7 additions & 7 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def pytest_addoption(parser) -> None:
)
parser.addoption("--only-slow", action="store_true", help="run only slow tests")
parser.addoption(
"--strict-data-files",
action="store_true",
help="Fail if a test is skipped for missing data file.",
"--no-strict-data-files",
action="store_false",
help="Don't fail if a test is skipped for missing data file.",
)


Expand Down Expand Up @@ -1133,9 +1133,9 @@ def all_numeric_accumulations(request):
@pytest.fixture
def strict_data_files(pytestconfig):
"""
Returns the configuration for the test setting `--strict-data-files`.
Returns the configuration for the test setting `--no-strict-data-files`.
"""
return pytestconfig.getoption("--strict-data-files")
return pytestconfig.getoption("--no-strict-data-files")


@pytest.fixture
Expand All @@ -1155,7 +1155,7 @@ def datapath(strict_data_files: str) -> Callable[..., str]:
Raises
------
ValueError
If the path doesn't exist and the --strict-data-files option is set.
If the path doesn't exist and the --no-strict-data-files option is not set.
"""
BASE_PATH = os.path.join(os.path.dirname(__file__), "tests")

Expand All @@ -1164,7 +1164,7 @@ def deco(*args):
if not os.path.exists(path):
if strict_data_files:
raise ValueError(
f"Could not find file {path} and --strict-data-files is set."
f"Could not find file {path} and --no-strict-data-files is not set."
)
pytest.skip(f"Could not find {path}.")
return path
Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/io/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ def compare_element(result, expected, typ):
legacy_dirname = os.path.join(os.path.dirname(__file__), "data", "legacy_pickle")
files = glob.glob(os.path.join(legacy_dirname, "*", "*.pickle"))

if not len(files):
# Probably is a wheel build(no data files), so skip the entire module
pytest.skip(
"Could not find legacy pickle files, skipping test_pickle.py tests",
allow_module_level=True,
)


@pytest.fixture(params=files)
def legacy_pickle(request, datapath):
Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/test_common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import collections
from functools import partial
import os
import string

import numpy as np
Expand Down Expand Up @@ -174,6 +175,12 @@ def test_version_tag():
)


def test_pyproject_present():
# Check pyproject.toml is present(relevant for wheels)
pyproject_loc = os.path.join(os.path.dirname(__file__), "../../pyproject.toml")
assert os.path.exists(pyproject_loc)


@pytest.mark.parametrize(
"obj", [(obj,) for obj in pd.__dict__.values() if callable(obj)]
)
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ include-package-data = true
include = ["pandas", "pandas.*"]
namespaces = false

[tool.setuptools.package-data]
pandas = ["../pyproject.toml"]

[tool.setuptools.exclude-package-data]
"*" = ["*.c", "*.h"]

Expand Down Expand Up @@ -354,8 +357,8 @@ disable = [

[tool.pytest.ini_options]
# sync minversion with pyproject.toml & install.rst
minversion = "7.0"
addopts = "--strict-data-files --strict-markers --strict-config --capture=no --durations=30 --junitxml=test-data.xml"
minversion = "7.0"
addopts = "--strict-markers --strict-config --capture=no --durations=30 --junitxml=test-data.xml"
empty_parameter_set_mark = "fail_at_collect"
xfail_strict = true
testpaths = "pandas"
Expand All @@ -365,6 +368,7 @@ doctest_optionflags = [
"ELLIPSIS",
]
filterwarnings = [
"error:_pytest.warning_types.PytestUnknownMarkWarning",
# Will be fixed in numba 0.56: https://github.com/numba/numba/issues/7758
"ignore:`np.MachAr` is deprecated:DeprecationWarning:numba",
"ignore:.*urllib3:DeprecationWarning:botocore",
Expand Down