Skip to content

Commit 5afac86

Browse files
committed
Merge branch 'main' into nano-astype
2 parents 678b3a7 + 98323ee commit 5afac86

File tree

314 files changed

+7070
-3819
lines changed

Some content is hidden

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

314 files changed

+7070
-3819
lines changed

.github/ISSUE_TEMPLATE/feature_request.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ body:
6868
attributes:
6969
label: Additional Context
7070
description: >
71-
Please provide any relevant Github issues, code examples or references that help describe and support
71+
Please provide any relevant GitHub issues, code examples or references that help describe and support
7272
the feature request.

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- [ ] closes #xxxx (Replace xxxx with the Github issue number)
1+
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
22
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
33
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
44
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.

.github/workflows/macos-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Windows-MacOS
1+
name: Windows-macOS
22

33
on:
44
push:

.github/workflows/python-dev.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# In general, this file will remain frozen(present, but not running) until:
55
# - The next unreleased Python version has released beta 1
6-
# - This version should be available on Github Actions.
6+
# - This version should be available on GitHub Actions.
77
# - Our required build/runtime dependencies(numpy, pytz, Cython, python-dateutil)
88
# support that unreleased Python version.
99
# To unfreeze, comment out the ``if: false`` condition, and make sure you update
@@ -54,7 +54,7 @@ jobs:
5454
os: [ubuntu-latest, macOS-latest, windows-latest]
5555

5656
name: actions-311-dev
57-
timeout-minutes: 80
57+
timeout-minutes: 120
5858

5959
concurrency:
6060
#https://github.community/t/concurrecy-not-work-for-push/183068/7
@@ -75,7 +75,7 @@ jobs:
7575
run: |
7676
python --version
7777
python -m pip install --upgrade pip setuptools wheel
78-
python -m pip install git+https://github.com/numpy/numpy.git
78+
python -m pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy
7979
python -m pip install git+https://github.com/nedbat/coveragepy.git
8080
python -m pip install python-dateutil pytz cython hypothesis==6.52.1 pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio>=0.17
8181
python -m pip list
@@ -84,7 +84,7 @@ jobs:
8484
- name: Build Pandas
8585
run: |
8686
python setup.py build_ext -q -j1
87-
python -m pip install -e . --no-build-isolation --no-use-pep517
87+
python -m pip install -e . --no-build-isolation --no-use-pep517 --no-index
8888
8989
- name: Build Version
9090
run: |

.github/workflows/scorecards.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
persist-credentials: false
3030

3131
- name: "Run analysis"
32-
uses: ossf/scorecard-action@v2
32+
uses: ossf/scorecard-action@v2.0.3
3333
with:
3434
results_file: results.sarif
3535
results_format: sarif

.github/workflows/wheels.yml

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
# Workflow to build wheels for upload to PyPI.
2+
# Inspired by numpy's cibuildwheel config https://github.com/numpy/numpy/blob/main/.github/workflows/wheels.yml
3+
#
4+
# In an attempt to save CI resources, wheel builds do
5+
# not run on each push but only weekly and for releases.
6+
# Wheel builds can be triggered from the Actions page
7+
# (if you have the perms) on a commit to master.
8+
#
9+
# Alternatively, you can add labels to the pull request in order to trigger wheel
10+
# builds.
11+
# The label(s) that trigger builds are:
12+
# - Build
13+
name: Wheel builder
14+
15+
on:
16+
schedule:
17+
# ┌───────────── minute (0 - 59)
18+
# │ ┌───────────── hour (0 - 23)
19+
# │ │ ┌───────────── day of the month (1 - 31)
20+
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
21+
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
22+
# │ │ │ │ │
23+
- cron: "27 3 */1 * *"
24+
push:
25+
pull_request:
26+
types: [labeled, opened, synchronize, reopened]
27+
workflow_dispatch:
28+
29+
concurrency:
30+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
31+
cancel-in-progress: true
32+
33+
jobs:
34+
build_wheels:
35+
name: Build wheel for ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
36+
if: >-
37+
github.event_name == 'schedule' ||
38+
github.event_name == 'workflow_dispatch' ||
39+
(github.event_name == 'pull_request' &&
40+
contains(github.event.pull_request.labels.*.name, 'Build')) ||
41+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
42+
runs-on: ${{ matrix.buildplat[0] }}
43+
strategy:
44+
# Ensure that a wheel builder finishes even if another fails
45+
fail-fast: false
46+
matrix:
47+
# GitHub Actions doesn't support pairing matrix values together, let's improvise
48+
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
49+
buildplat:
50+
- [ubuntu-20.04, manylinux_x86_64]
51+
- [macos-11, macosx_*]
52+
- [windows-2019, win_amd64]
53+
- [windows-2019, win32]
54+
# TODO: support PyPy?
55+
python: [["cp38", "3.8"], ["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11-dev"]]# "pp38", "pp39"]
56+
env:
57+
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
58+
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
59+
steps:
60+
- name: Checkout pandas
61+
uses: actions/checkout@v3
62+
with:
63+
submodules: true
64+
# versioneer.py requires the latest tag to be reachable. Here we
65+
# fetch the complete history to get access to the tags.
66+
# A shallow clone can work when the following issue is resolved:
67+
# https://github.com/actions/checkout/issues/338
68+
fetch-depth: 0
69+
70+
- name: Build wheels
71+
uses: pypa/[email protected]
72+
env:
73+
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
74+
75+
# Used to test the built wheels
76+
- uses: actions/setup-python@v3
77+
with:
78+
python-version: ${{ matrix.python[1] }}
79+
80+
- name: Test wheels (Windows 64-bit only)
81+
if: ${{ matrix.buildplat[1] == 'win_amd64' }}
82+
shell: cmd
83+
run: |
84+
python ci/test_wheels.py wheelhouse
85+
86+
- uses: actions/upload-artifact@v3
87+
with:
88+
name: ${{ matrix.python[0] }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
89+
path: ./wheelhouse/*.whl
90+
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+
109+
- name: Upload wheels
110+
if: success()
111+
shell: bash -el {0}
112+
env:
113+
PANDAS_STAGING_UPLOAD_TOKEN: ${{ secrets.PANDAS_STAGING_UPLOAD_TOKEN }}
114+
PANDAS_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.PANDAS_NIGHTLY_UPLOAD_TOKEN }}
115+
run: |
116+
source ci/upload_wheels.sh
117+
set_upload_vars
118+
# trigger an upload to
119+
# https://anaconda.org/scipy-wheels-nightly/pandas
120+
# for cron jobs or "Run workflow" (restricted to main branch).
121+
# Tags will upload to
122+
# https://anaconda.org/multibuild-wheels-staging/pandas
123+
# The tokens were originally generated at anaconda.org
124+
upload_wheels
125+
build_sdist:
126+
name: Build sdist
127+
if: >-
128+
github.event_name == 'schedule' ||
129+
github.event_name == 'workflow_dispatch' ||
130+
(github.event_name == 'pull_request' &&
131+
contains(github.event.pull_request.labels.*.name, 'Build')) ||
132+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
133+
runs-on: ubuntu-latest
134+
env:
135+
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
136+
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
137+
steps:
138+
- name: Checkout pandas
139+
uses: actions/checkout@v3
140+
with:
141+
submodules: true
142+
# versioneer.py requires the latest tag to be reachable. Here we
143+
# fetch the complete history to get access to the tags.
144+
# A shallow clone can work when the following issue is resolved:
145+
# https://github.com/actions/checkout/issues/338
146+
fetch-depth: 0
147+
148+
# Used to push the built sdist
149+
- uses: conda-incubator/setup-miniconda@v2
150+
with:
151+
auto-update-conda: true
152+
# Really doesn't matter what version we upload with
153+
# just the version we test with
154+
python-version: '3.8'
155+
channels: conda-forge
156+
channel-priority: true
157+
mamba-version: "*"
158+
159+
- name: Build sdist
160+
run: |
161+
pip install build
162+
python -m build --sdist
163+
- name: Test the sdist
164+
shell: bash -el {0}
165+
run: |
166+
# TODO: Don't run test suite, and instead build wheels from sdist
167+
# by splitting the wheel builders into a two stage job
168+
# (1. Generate sdist 2. Build wheels from sdist)
169+
# This tests the sdists, and saves some build time
170+
python -m pip install dist/*.gz
171+
pip install hypothesis==6.52.1 pytest>=6.2.5 pytest-xdist pytest-asyncio>=0.17
172+
cd .. # Not a good idea to test within the src tree
173+
python -c "import pandas; print(pandas.__version__);
174+
pandas.test(extra_args=['-m not clipboard and not single_cpu', '--skip-slow', '--skip-network', '--skip-db', '-n=2']);
175+
pandas.test(extra_args=['-m not clipboard and single_cpu', '--skip-slow', '--skip-network', '--skip-db'])"
176+
- uses: actions/upload-artifact@v3
177+
with:
178+
name: sdist
179+
path: ./dist/*
180+
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+
186+
- name: Upload sdist
187+
if: success()
188+
shell: bash -el {0}
189+
env:
190+
PANDAS_STAGING_UPLOAD_TOKEN: ${{ secrets.PANDAS_STAGING_UPLOAD_TOKEN }}
191+
PANDAS_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.PANDAS_NIGHTLY_UPLOAD_TOKEN }}
192+
run: |
193+
source ci/upload_wheels.sh
194+
set_upload_vars
195+
# trigger an upload to
196+
# https://anaconda.org/scipy-wheels-nightly/pandas
197+
# for cron jobs or "Run workflow" (restricted to main branch).
198+
# Tags will upload to
199+
# https://anaconda.org/multibuild-wheels-staging/pandas
200+
# The tokens were originally generated at anaconda.org
201+
upload_wheels

.pre-commit-config.yaml

+21-8
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
@@ -53,16 +53,22 @@ repos:
5353
rev: 5.0.4
5454
hooks:
5555
- id: flake8
56+
# Need to patch os.remove rule in pandas-dev-flaker
57+
exclude: ^ci/fix_wheels.py
5658
additional_dependencies: &flake8_dependencies
5759
- flake8==5.0.4
5860
- flake8-bugbear==22.7.1
5961
- pandas-dev-flaker==0.5.0
62+
- repo: https://github.com/pycqa/pylint
63+
rev: v2.15.3
64+
hooks:
65+
- id: pylint
6066
- repo: https://github.com/PyCQA/isort
6167
rev: 5.10.1
6268
hooks:
6369
- id: isort
6470
- repo: https://github.com/asottile/pyupgrade
65-
rev: v2.37.3
71+
rev: v2.38.2
6672
hooks:
6773
- id: pyupgrade
6874
args: [--py38-plus]
@@ -81,7 +87,7 @@ repos:
8187
hooks:
8288
- id: sphinx-lint
8389
- repo: https://github.com/asottile/yesqa
84-
rev: v1.3.0
90+
rev: v1.4.0
8591
hooks:
8692
- id: yesqa
8793
additional_dependencies: *flake8_dependencies
@@ -220,6 +226,13 @@ repos:
220226
entry: python scripts/no_bool_in_generic.py
221227
language: python
222228
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/
223236
- id: pandas-errors-documented
224237
name: Ensure pandas errors are documented in doc/source/reference/testing.rst
225238
entry: python scripts/pandas_errors_documented.py
@@ -238,7 +251,7 @@ repos:
238251
files: ^(ci/deps/actions-.*-minimum_versions\.yaml|pandas/compat/_optional\.py)$
239252
- id: validate-errors-locations
240253
name: Validate errors locations
241-
description: Validate errors are in approriate locations.
254+
description: Validate errors are in appropriate locations.
242255
entry: python scripts/validate_exception_location.py
243256
language: python
244257
files: ^pandas/
@@ -266,7 +279,7 @@ repos:
266279
|/_testing/
267280
- id: autotyping
268281
name: autotyping
269-
entry: python -m libcst.tool codemod autotyping.AutotypeCommand --none-return --scalar-return --annotate-magics --annotate-imprecise-magics --bool-param
282+
entry: python -m scripts.run_autotyping
270283
types_or: [python, pyi]
271284
files: ^pandas
272285
exclude: ^(pandas/tests|pandas/_version.py|pandas/io/clipboard)

Makefile

-30
This file was deleted.

0 commit comments

Comments
 (0)