Skip to content

Commit 09e6773

Browse files
Merge branch 'pandas-dev:main' into raise-on-parse-int-overflow
2 parents 8d782fb + 55dc324 commit 09e6773

File tree

236 files changed

+4678
-2568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+4678
-2568
lines changed

.github/workflows/wheels.yml

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ jobs:
5454
# TODO: support PyPy?
5555
python: [["cp38", "3.8"], ["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11-dev"]]# "pp38", "pp39"]
5656
env:
57-
IS_32_BIT: ${{ matrix.buildplat[1] == 'win32' }}
5857
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
5958
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
6059
steps:
@@ -72,17 +71,8 @@ jobs:
7271
uses: pypa/cibuildwheel@v2.9.0
7372
env:
7473
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
75-
CIBW_ENVIRONMENT: IS_32_BIT='${{ env.IS_32_BIT }}'
76-
# We can't test directly with cibuildwheel, since we need to have to wheel location
77-
# to mount into the docker image
78-
CIBW_TEST_COMMAND_LINUX: "python {project}/ci/test_wheels.py"
79-
CIBW_TEST_COMMAND_MACOS: "python {project}/ci/test_wheels.py"
80-
CIBW_TEST_REQUIRES: hypothesis==6.52.1 pytest>=6.2.5 pytest-xdist pytest-asyncio>=0.17
81-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "python ci/fix_wheels.py {wheel} {dest_dir}"
82-
CIBW_ARCHS_MACOS: x86_64 universal2
83-
CIBW_BUILD_VERBOSITY: 3
8474

85-
# Used to push the built wheels
75+
# Used to test the built wheels
8676
- uses: actions/setup-python@v3
8777
with:
8878
python-version: ${{ matrix.python[1] }}
@@ -98,9 +88,27 @@ jobs:
9888
name: ${{ matrix.python[0] }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
9989
path: ./wheelhouse/*.whl
10090

91+
# Used to push the built wheels
92+
# TODO: once Python 3.11 is available on conda, de-dup with
93+
# setup python above
94+
- uses: conda-incubator/setup-miniconda@v2
95+
with:
96+
auto-update-conda: true
97+
# Really doesn't matter what version we upload with
98+
# just the version we test with
99+
python-version: '3.8'
100+
channels: conda-forge
101+
channel-priority: true
102+
mamba-version: "*"
103+
104+
- name: Install anaconda client
105+
if: ${{ success() && (env.IS_SCHEDULE_DISPATCH == 'true' || env.IS_PUSH == 'true') }}
106+
run: conda install -q -y anaconda-client
107+
108+
101109
- name: Upload wheels
102110
if: success()
103-
shell: bash
111+
shell: bash -el {0}
104112
env:
105113
PANDAS_STAGING_UPLOAD_TOKEN: ${{ secrets.PANDAS_STAGING_UPLOAD_TOKEN }}
106114
PANDAS_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.PANDAS_NIGHTLY_UPLOAD_TOKEN }}
@@ -136,16 +144,24 @@ jobs:
136144
# A shallow clone can work when the following issue is resolved:
137145
# https://github.com/actions/checkout/issues/338
138146
fetch-depth: 0
139-
# Used to push the built wheels
140-
- uses: actions/setup-python@v3
147+
148+
# Used to push the built sdist
149+
- uses: conda-incubator/setup-miniconda@v2
141150
with:
142-
# Build sdist on lowest supported Python
151+
auto-update-conda: true
152+
# Really doesn't matter what version we upload with
153+
# just the version we test with
143154
python-version: '3.8'
155+
channels: conda-forge
156+
channel-priority: true
157+
mamba-version: "*"
158+
144159
- name: Build sdist
145160
run: |
146161
pip install build
147162
python -m build --sdist
148163
- name: Test the sdist
164+
shell: bash -el {0}
149165
run: |
150166
# TODO: Don't run test suite, and instead build wheels from sdist
151167
# by splitting the wheel builders into a two stage job
@@ -162,9 +178,14 @@ jobs:
162178
name: sdist
163179
path: ./dist/*
164180

181+
- name: Install anaconda client
182+
if: ${{ success() && (env.IS_SCHEDULE_DISPATCH == 'true' || env.IS_PUSH == 'true') }}
183+
run: |
184+
conda install -q -y anaconda-client
185+
165186
- name: Upload sdist
166187
if: success()
167-
shell: bash
188+
shell: bash -el {0}
168189
env:
169190
PANDAS_STAGING_UPLOAD_TOKEN: ${{ secrets.PANDAS_STAGING_UPLOAD_TOKEN }}
170191
PANDAS_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.PANDAS_NIGHTLY_UPLOAD_TOKEN }}

.pre-commit-config.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ repos:
1111
- id: absolufy-imports
1212
files: ^pandas/
1313
- repo: https://github.com/jendrikseipp/vulture
14-
rev: 'v2.5'
14+
rev: 'v2.6'
1515
hooks:
1616
- id: vulture
1717
entry: python scripts/run_vulture.py
1818
pass_filenames: true
1919
require_serial: false
2020
- repo: https://github.com/python/black
21-
rev: 22.6.0
21+
rev: 22.8.0
2222
hooks:
2323
- id: black
2424
- repo: https://github.com/codespell-project/codespell
@@ -27,7 +27,7 @@ repos:
2727
- id: codespell
2828
types_or: [python, rst, markdown]
2929
- repo: https://github.com/MarcoGorelli/cython-lint
30-
rev: v0.1.4
30+
rev: v0.1.8
3131
hooks:
3232
- id: cython-lint
3333
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -40,7 +40,7 @@ repos:
4040
- id: trailing-whitespace
4141
stages: [commit, merge-commit, push, prepare-commit-msg, commit-msg, post-checkout, post-commit, post-merge, post-rewrite]
4242
- repo: https://github.com/cpplint/cpplint
43-
rev: 1.6.0
43+
rev: 1.6.1
4444
hooks:
4545
- id: cpplint
4646
# We don't lint all C files because we don't want to lint any that are built
@@ -59,12 +59,16 @@ repos:
5959
- flake8==5.0.4
6060
- flake8-bugbear==22.7.1
6161
- pandas-dev-flaker==0.5.0
62+
- repo: https://github.com/pycqa/pylint
63+
rev: v2.15.3
64+
hooks:
65+
- id: pylint
6266
- repo: https://github.com/PyCQA/isort
6367
rev: 5.10.1
6468
hooks:
6569
- id: isort
6670
- repo: https://github.com/asottile/pyupgrade
67-
rev: v2.37.3
71+
rev: v2.38.2
6872
hooks:
6973
- id: pyupgrade
7074
args: [--py38-plus]
@@ -83,7 +87,7 @@ repos:
8387
hooks:
8488
- id: sphinx-lint
8589
- repo: https://github.com/asottile/yesqa
86-
rev: v1.3.0
90+
rev: v1.4.0
8791
hooks:
8892
- id: yesqa
8993
additional_dependencies: *flake8_dependencies
@@ -222,6 +226,13 @@ repos:
222226
entry: python scripts/no_bool_in_generic.py
223227
language: python
224228
files: ^pandas/core/generic\.py$
229+
- id: no-return-exception
230+
name: Use raise instead of return for exceptions
231+
language: pygrep
232+
entry: 'return [A-Za-z]+(Error|Exit|Interrupt|Exception|Iteration)'
233+
files: ^pandas/
234+
types: [python]
235+
exclude: ^pandas/tests/
225236
- id: pandas-errors-documented
226237
name: Ensure pandas errors are documented in doc/source/reference/testing.rst
227238
entry: python scripts/pandas_errors_documented.py
@@ -268,7 +279,7 @@ repos:
268279
|/_testing/
269280
- id: autotyping
270281
name: autotyping
271-
entry: python -m libcst.tool codemod autotyping.AutotypeCommand --none-return --scalar-return --annotate-magics --annotate-imprecise-magics --bool-param --bytes-param --str-param --float-param
282+
entry: python -m scripts.run_autotyping
272283
types_or: [python, pyi]
273284
files: ^pandas
274285
exclude: ^(pandas/tests|pandas/_version.py|pandas/io/clipboard)

Makefile

Lines changed: 0 additions & 30 deletions
This file was deleted.

asv_bench/benchmarks/index_object.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ def time_datetime_difference_disjoint(self):
6565
self.datetime_left.difference(self.datetime_right)
6666

6767

68+
class UnionWithDuplicates:
69+
def setup(self):
70+
self.left = Index(np.repeat(np.arange(1000), 100))
71+
self.right = Index(np.tile(np.arange(500, 1500), 50))
72+
73+
def time_union_with_duplicates(self):
74+
self.left.union(self.right)
75+
76+
6877
class Range:
6978
def setup(self):
7079
self.idx_inc = RangeIndex(start=0, stop=10**6, step=3)

asv_bench/benchmarks/io/sas.py

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
1-
import os
1+
from pathlib import Path
22

33
from pandas import read_sas
44

5+
ROOT = Path(__file__).parents[3] / "pandas" / "tests" / "io" / "sas" / "data"
6+
57

68
class SAS:
9+
def time_read_sas7bdat(self):
10+
read_sas(ROOT / "test1.sas7bdat")
711

8-
params = ["sas7bdat", "xport"]
9-
param_names = ["format"]
12+
def time_read_xpt(self):
13+
read_sas(ROOT / "paxraw_d_short.xpt")
1014

11-
def setup(self, format):
12-
# Read files that are located in 'pandas/tests/io/sas/data'
13-
files = {"sas7bdat": "test1.sas7bdat", "xport": "paxraw_d_short.xpt"}
14-
file = files[format]
15-
paths = [
16-
os.path.dirname(__file__),
17-
"..",
18-
"..",
19-
"..",
20-
"pandas",
21-
"tests",
22-
"io",
23-
"sas",
24-
"data",
25-
file,
26-
]
27-
self.f = os.path.join(*paths)
15+
def time_read_sas7bdat_2(self):
16+
next(read_sas(ROOT / "0x00controlbyte.sas7bdat.bz2", chunksize=11000))
2817

29-
def time_read_sas(self, format):
30-
read_sas(self.f, format=format)
18+
def time_read_sas7bdat_2_chunked(self):
19+
for i, _ in enumerate(
20+
read_sas(ROOT / "0x00controlbyte.sas7bdat.bz2", chunksize=1000)
21+
):
22+
if i == 10:
23+
break

asv_bench/benchmarks/multiindex_object.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,45 @@ def time_operation(self, index_structure, dtype, method):
276276
getattr(self.left, method)(self.right)
277277

278278

279+
class Difference:
280+
281+
params = [
282+
("datetime", "int", "string", "ea_int"),
283+
]
284+
param_names = ["dtype"]
285+
286+
def setup(self, dtype):
287+
N = 10**4 * 2
288+
level1 = range(1000)
289+
290+
level2 = date_range(start="1/1/2000", periods=N // 1000)
291+
dates_left = MultiIndex.from_product([level1, level2])
292+
293+
level2 = range(N // 1000)
294+
int_left = MultiIndex.from_product([level1, level2])
295+
296+
level2 = Series(range(N // 1000), dtype="Int64")
297+
level2[0] = NA
298+
ea_int_left = MultiIndex.from_product([level1, level2])
299+
300+
level2 = tm.makeStringIndex(N // 1000).values
301+
str_left = MultiIndex.from_product([level1, level2])
302+
303+
data = {
304+
"datetime": dates_left,
305+
"int": int_left,
306+
"ea_int": ea_int_left,
307+
"string": str_left,
308+
}
309+
310+
data = {k: {"left": mi, "right": mi[:5]} for k, mi in data.items()}
311+
self.left = data[dtype]["left"]
312+
self.right = data[dtype]["right"]
313+
314+
def time_difference(self, dtype):
315+
self.left.difference(self.right)
316+
317+
279318
class Unique:
280319
params = [
281320
(("Int64", NA), ("int64", 0)),

ci/upload_wheels.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ upload_wheels() {
2424
if [ -z ${TOKEN} ]; then
2525
echo no token set, not uploading
2626
else
27-
conda install -q -y anaconda-client
2827
# sdists are located under dist folder when built through setup.py
2928
if compgen -G "./dist/*.gz"; then
3029
echo "Found sdist"

doc/source/_static/index_api.svg

Lines changed: 5 additions & 5 deletions
Loading

doc/source/_static/index_contribute.svg

Lines changed: 2 additions & 2 deletions
Loading

doc/source/_static/index_getting_started.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)