Skip to content

Commit 3565309

Browse files
authored
BLD: Shrink sdist/wheel sizes (#54052)
* BLD: Shrink sdist/wheel sizes * build wheel from sdist * try building from sdist again * change to no-strict-data-files? * remove marker * use datapath * fix windows * no quotes needed? * try again * Update wheels.yml
1 parent f3c9b37 commit 3565309

File tree

5 files changed

+96
-26
lines changed

5 files changed

+96
-26
lines changed

.gitattributes

+68
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,71 @@
1414
*.xls binary
1515
*.xlsx binary
1616
pandas/_version.py export-subst
17+
18+
19+
*.bz2 export-ignore
20+
*.csv export-ignore
21+
*.data export-ignore
22+
*.dta export-ignore
23+
*.feather export-ignore
24+
*.tar export-ignore
25+
*.gz export-ignore
26+
*.h5 export-ignore
27+
*.html export-ignore
28+
*.json export-ignore
29+
*.jsonl export-ignore
30+
*.kml export-ignore
31+
*.msgpack export-ignore
32+
*.pdf export-ignore
33+
*.parquet export-ignore
34+
*.pickle export-ignore
35+
*.pkl export-ignore
36+
*.png export-ignore
37+
*.pptx export-ignore
38+
*.ods export-ignore
39+
*.odt export-ignore
40+
*.orc export-ignore
41+
*.sas7bdat export-ignore
42+
*.sav export-ignore
43+
*.so export-ignore
44+
*.txt export-ignore
45+
*.xls export-ignore
46+
*.xlsb export-ignore
47+
*.xlsm export-ignore
48+
*.xlsx export-ignore
49+
*.xpt export-ignore
50+
*.cpt export-ignore
51+
*.xml export-ignore
52+
*.xsl export-ignore
53+
*.xz export-ignore
54+
*.zip export-ignore
55+
*.zst export-ignore
56+
*~ export-ignore
57+
.DS_Store export-ignore
58+
.git* export-ignore
59+
60+
*.py[ocd] export-ignore
61+
*.pxi export-ignore
62+
63+
# Ignoring stuff from the top level
64+
.circleci export-ignore
65+
.github export-ignore
66+
asv_bench export-ignore
67+
ci export-ignore
68+
doc export-ignore
69+
gitpod export-ignore
70+
MANIFEST.in export-ignore
71+
scripts export-ignore
72+
typings export-ignore
73+
web export-ignore
74+
CITATION.cff export-ignore
75+
codecov.yml export-ignore
76+
Dockerfile export-ignore
77+
environment.yml export-ignore
78+
setup.py export-ignore
79+
80+
81+
# GH 39321
82+
# csv_dir_path fixture checks the existence of the directory
83+
# exclude the whole directory to avoid running related tests in sdist
84+
pandas/tests/io/parser/data export-ignore

.github/workflows/wheels.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ jobs:
104104
with:
105105
fetch-depth: 0
106106

107+
# We need to build wheels from the sdist since the sdist
108+
# removes unnecessary files from the release
107109
- name: Download sdist
108110
uses: actions/download-artifact@v3
109111
with:
@@ -115,8 +117,8 @@ jobs:
115117
# TODO: Build wheels from sdist again
116118
# There's some sort of weird race condition?
117119
# within Github that makes the sdist be missing files
118-
#with:
119-
# package-dir: ./dist/${{ needs.build_sdist.outputs.sdist_file }}
120+
with:
121+
package-dir: ./dist/${{ needs.build_sdist.outputs.sdist_file }}
120122
env:
121123
CIBW_PRERELEASE_PYTHONS: True
122124
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
@@ -144,7 +146,7 @@ jobs:
144146
$TST_CMD = @"
145147
python -m pip install pytz six numpy python-dateutil tzdata>=2022.1 hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17;
146148
python -m pip install --find-links=pandas\wheelhouse --no-index pandas;
147-
python -c `'import pandas as pd; pd.test()`';
149+
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`\"\"])`';
148150
"@
149151
docker pull python:${{ matrix.python[1] }}-windowsservercore
150152
docker run --env PANDAS_CI='1' -v ${PWD}:C:\pandas python:${{ matrix.python[1] }}-windowsservercore powershell -Command $TST_CMD

pandas/conftest.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@
102102

103103
def pytest_addoption(parser) -> None:
104104
parser.addoption(
105-
"--strict-data-files",
106-
action="store_true",
107-
help="Fail if a test is skipped for missing data file.",
105+
"--no-strict-data-files",
106+
action="store_false",
107+
help="Don't fail if a test is skipped for missing data file.",
108108
)
109109

110110

@@ -1172,9 +1172,9 @@ def all_numeric_accumulations(request):
11721172
@pytest.fixture
11731173
def strict_data_files(pytestconfig):
11741174
"""
1175-
Returns the configuration for the test setting `--strict-data-files`.
1175+
Returns the configuration for the test setting `--no-strict-data-files`.
11761176
"""
1177-
return pytestconfig.getoption("--strict-data-files")
1177+
return pytestconfig.getoption("--no-strict-data-files")
11781178

11791179

11801180
@pytest.fixture
@@ -1204,7 +1204,7 @@ def datapath(strict_data_files: str) -> Callable[..., str]:
12041204
Raises
12051205
------
12061206
ValueError
1207-
If the path doesn't exist and the --strict-data-files option is set.
1207+
If the path doesn't exist and the --no-strict-data-files option is not set.
12081208
"""
12091209
BASE_PATH = os.path.join(os.path.dirname(__file__), "tests")
12101210

@@ -1213,7 +1213,7 @@ def deco(*args):
12131213
if not os.path.exists(path):
12141214
if strict_data_files:
12151215
raise ValueError(
1216-
f"Could not find file {path} and --strict-data-files is set."
1216+
f"Could not find file {path} and --no-strict-data-files is not set."
12171217
)
12181218
pytest.skip(f"Could not find {path}.")
12191219
return path

pandas/tests/io/xml/conftest.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@
22

33

44
@pytest.fixture
5-
def xml_data_path(tests_io_data_path):
5+
def xml_data_path(tests_io_data_path, datapath):
66
return tests_io_data_path / "xml"
77

88

99
@pytest.fixture
10-
def xml_books(xml_data_path):
11-
return xml_data_path / "books.xml"
10+
def xml_books(xml_data_path, datapath):
11+
return datapath(xml_data_path / "books.xml")
1212

1313

1414
@pytest.fixture
15-
def xml_doc_ch_utf(xml_data_path):
16-
return xml_data_path / "doc_ch_utf.xml"
15+
def xml_doc_ch_utf(xml_data_path, datapath):
16+
return datapath(xml_data_path / "doc_ch_utf.xml")
1717

1818

1919
@pytest.fixture
20-
def xml_baby_names(xml_data_path):
21-
return xml_data_path / "baby_names.xml"
20+
def xml_baby_names(xml_data_path, datapath):
21+
return datapath(xml_data_path / "baby_names.xml")
2222

2323

2424
@pytest.fixture
25-
def kml_cta_rail_lines(xml_data_path):
26-
return xml_data_path / "cta_rail_lines.kml"
25+
def kml_cta_rail_lines(xml_data_path, datapath):
26+
return datapath(xml_data_path / "cta_rail_lines.kml")
2727

2828

2929
@pytest.fixture
30-
def xsl_flatten_doc(xml_data_path):
31-
return xml_data_path / "flatten_doc.xsl"
30+
def xsl_flatten_doc(xml_data_path, datapath):
31+
return datapath(xml_data_path / "flatten_doc.xsl")
3232

3333

3434
@pytest.fixture
35-
def xsl_row_field_output(xml_data_path):
36-
return xml_data_path / "row_field_output.xsl"
35+
def xsl_row_field_output(xml_data_path, datapath):
36+
return datapath(xml_data_path / "row_field_output.xsl")

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ environment = {LDFLAGS="-Wl,--strip-all"}
153153
test-requires = "hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17"
154154
test-command = """
155155
PANDAS_CI='1' python -c 'import pandas as pd; \
156-
pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db", "-n 2"]); \
157-
pd.test(extra_args=["-m not clipboard and single_cpu and not slow and not network and not db"]);' \
156+
pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db", "-n 2", "--no-strict-data-files"]); \
157+
pd.test(extra_args=["-m not clipboard and single_cpu and not slow and not network and not db", "--no-strict-data-files"]);' \
158158
"""
159159

160160
[tool.cibuildwheel.macos]
@@ -471,7 +471,7 @@ disable = [
471471
[tool.pytest.ini_options]
472472
# sync minversion with pyproject.toml & install.rst
473473
minversion = "7.3.2"
474-
addopts = "--strict-data-files --strict-markers --strict-config --capture=no --durations=30 --junitxml=test-data.xml"
474+
addopts = "--strict-markers --strict-config --capture=no --durations=30 --junitxml=test-data.xml"
475475
empty_parameter_set_mark = "fail_at_collect"
476476
xfail_strict = true
477477
testpaths = "pandas"

0 commit comments

Comments
 (0)