Skip to content

Commit a911138

Browse files
author
MarcoGorelli
committed
Merge remote-tracking branch 'upstream/main' into pdep5
2 parents 5ec1e77 + 8da8743 commit a911138

File tree

308 files changed

+5641
-6066
lines changed

Some content is hidden

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

308 files changed

+5641
-6066
lines changed

.devcontainer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
// You can edit these settings after create using File > Preferences > Settings > Remote.
1010
"settings": {
1111
"terminal.integrated.shell.linux": "/bin/bash",
12-
"python.condaPath": "/opt/conda/bin/conda",
13-
"python.pythonPath": "/opt/conda/bin/python",
12+
"python.pythonPath": "/usr/local/bin/python",
1413
"python.formatting.provider": "black",
1514
"python.linting.enabled": true,
1615
"python.linting.flake8Enabled": true,

.github/workflows/32-bit-linux.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ jobs:
3838
/opt/python/cp38-cp38/bin/python -m venv ~/virtualenvs/pandas-dev && \
3939
. ~/virtualenvs/pandas-dev/bin/activate && \
4040
python -m pip install --no-deps -U pip wheel 'setuptools<60.0.0' && \
41-
pip install cython numpy python-dateutil pytz pytest pytest-xdist pytest-asyncio>=0.17 hypothesis && \
41+
python -m pip install versioneer[toml] && \
42+
python -m pip install cython numpy python-dateutil pytz pytest pytest-xdist pytest-asyncio>=0.17 hypothesis && \
4243
python setup.py build_ext -q -j1 && \
4344
python -m pip install --no-build-isolation --no-use-pep517 -e . && \
4445
python -m pip list && \

.github/workflows/code-checks.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ jobs:
3636

3737
- name: Run pre-commit
3838
uses: pre-commit/[email protected]
39+
with:
40+
extra_args: --verbose --all-files
3941

40-
typing_and_docstring_validation:
41-
name: Docstring and typing validation
42+
docstring_typing_pylint:
43+
name: Docstring validation, typing, and pylint
4244
runs-on: ubuntu-latest
4345
defaults:
4446
run:
@@ -79,6 +81,10 @@ jobs:
7981
run: ci/code_checks.sh docstrings
8082
if: ${{ steps.build.outcome == 'success' && always() }}
8183

84+
- name: Run check of documentation notebooks
85+
run: ci/code_checks.sh notebooks
86+
if: ${{ steps.build.outcome == 'success' && always() }}
87+
8288
- name: Use existing environment for type checking
8389
run: |
8490
echo $PATH >> $GITHUB_PATH
@@ -89,7 +95,7 @@ jobs:
8995
- name: Typing + pylint
9096
uses: pre-commit/[email protected]
9197
with:
92-
extra_args: --hook-stage manual --all-files
98+
extra_args: --verbose --hook-stage manual --all-files
9399
if: ${{ steps.build.outcome == 'success' && always() }}
94100

95101
- name: Run docstring validation script tests
@@ -152,7 +158,7 @@ jobs:
152158
run: docker build --pull --no-cache --tag pandas-dev-env .
153159

154160
- name: Show environment
155-
run: docker run -w /home/pandas pandas-dev-env mamba run -n pandas-dev python -c "import pandas as pd; print(pd.show_versions())"
161+
run: docker run --rm pandas-dev-env python -c "import pandas as pd; print(pd.show_versions())"
156162

157163
requirements-dev-text-installable:
158164
name: Test install requirements-dev.txt

.github/workflows/docbuild-and-upload.yml

-5
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ jobs:
5454
- name: Build documentation zip
5555
run: doc/make.py zip_html
5656

57-
- name: Build the interactive terminal
58-
run: |
59-
cd web/interactive_terminal
60-
jupyter lite build
61-
6257
- name: Install ssh key
6358
run: |
6459
mkdir -m 700 -p ~/.ssh

.github/workflows/package-checks.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ on:
99
branches:
1010
- main
1111
- 1.5.x
12+
types: [ labeled, opened, synchronize, reopened ]
1213

1314
permissions:
1415
contents: read
1516

1617
jobs:
1718
pip:
19+
if: ${{ github.event.label.name == 'Build' || contains(github.event.pull_request.labels.*.name, 'Build') || github.event_name == 'push'}}
1820
runs-on: ubuntu-latest
1921
strategy:
2022
matrix:
@@ -38,16 +40,10 @@ jobs:
3840
with:
3941
python-version: '3.8'
4042

41-
# Hacky patch to disable building cython extensions.
42-
# This job should only check that the extras successfully install.
43-
- name: Disable building ext_modules
44-
run: |
45-
sed -i '/ext_modules=/d' setup.py
46-
shell: bash -el {0}
47-
4843
- name: Install required dependencies
4944
run: |
5045
python -m pip install --upgrade pip setuptools wheel python-dateutil pytz numpy cython
46+
python -m pip install versioneer[toml]
5147
shell: bash -el {0}
5248

5349
- name: Pip install with extra

.github/workflows/python-dev.yml

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
python -m pip install --upgrade pip setuptools wheel
7676
python -m pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy
7777
python -m pip install git+https://github.com/nedbat/coveragepy.git
78+
python -m pip install versioneer[toml]
7879
python -m pip install python-dateutil pytz cython hypothesis==6.52.1 pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio>=0.17
7980
python -m pip list
8081

.github/workflows/sdist.yml

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
- name: Install dependencies
4848
run: |
4949
python -m pip install --upgrade pip setuptools wheel
50+
python -m pip install versioneer[toml]
5051
5152
# GH 39416
5253
pip install numpy

.gitpod.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Building pandas on init
2+
# Might delegate this later to prebuild with Q2 improvements on gitpod
3+
# https://www.gitpod.io/docs/config-start-tasks/#configuring-the-terminal
4+
# -------------------------------------------------------------------------
5+
6+
# assuming we use dockerhub: name of the docker user, docker image, tag, e.g. https://hub.docker.com/r/pandas/pandas-gitpod/tags
7+
image: pythonpandas/pandas-gitpod:latest
8+
tasks:
9+
- name: Prepare development environment
10+
init: |
11+
mkdir -p .vscode
12+
cp gitpod/settings.json .vscode/settings.json
13+
conda activate pandas-dev
14+
git pull --unshallow # need to force this else the prebuild fails
15+
git fetch --tags
16+
python setup.py build_ext -j 4
17+
python -m pip install -e . --no-build-isolation
18+
echo "🛠 Completed rebuilding Pandas!! 🛠 "
19+
echo "✨ Pre-build complete! You can close this terminal ✨ "
20+
21+
# --------------------------------------------------------
22+
# exposing ports for liveserve
23+
ports:
24+
- port: 5500
25+
onOpen: notify
26+
27+
# --------------------------------------------------------
28+
# some useful extensions to have
29+
vscode:
30+
extensions:
31+
- ms-python.python
32+
- yzhang.markdown-all-in-one
33+
- eamodio.gitlens
34+
- lextudio.restructuredtext
35+
- ritwickdey.liveserver
36+
# add or remove what you think is generally useful to most contributors
37+
# avoid adding too many. they each open a pop-up window
38+
39+
# --------------------------------------------------------
40+
# using prebuilds for the container
41+
# With this configuration the prebuild will happen on push to main
42+
github:
43+
prebuilds:
44+
# enable for main/default branch
45+
main: true
46+
# enable for other branches (defaults to false)
47+
branches: false
48+
# enable for pull requests coming from this repo (defaults to true)
49+
pullRequests: false
50+
# enable for pull requests coming from forks (defaults to false)
51+
pullRequestsFromForks: false
52+
# add a check to pull requests (defaults to true)
53+
addCheck: false
54+
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
55+
addComment: false
56+
# add a "Review in Gitpod" button to the pull request's description (defaults to false)
57+
addBadge: false
58+
# add a label once the prebuild is ready to pull requests (defaults to false)
59+
addLabel: false

.pre-commit-config.yaml

+37-12
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,19 @@ repos:
1717
entry: python scripts/run_vulture.py
1818
pass_filenames: true
1919
require_serial: false
20-
- repo: https://github.com/python/black
21-
rev: 22.10.0
22-
hooks:
23-
- id: black
2420
- repo: https://github.com/codespell-project/codespell
2521
rev: v2.2.2
2622
hooks:
2723
- id: codespell
2824
types_or: [python, rst, markdown]
25+
additional_dependencies: [tomli]
2926
- repo: https://github.com/MarcoGorelli/cython-lint
30-
rev: v0.2.1
27+
rev: v0.9.1
3128
hooks:
3229
- id: cython-lint
30+
- id: double-quote-cython-strings
3331
- repo: https://github.com/pre-commit/pre-commit-hooks
34-
rev: v4.3.0
32+
rev: v4.4.0
3533
hooks:
3634
- id: debug-statements
3735
- id: end-of-file-fixer
@@ -50,26 +48,43 @@ repos:
5048
exclude: ^pandas/_libs/src/(klib|headers)/
5149
args: [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir']
5250
- repo: https://github.com/PyCQA/flake8
53-
rev: 5.0.4
51+
rev: 6.0.0
5452
hooks:
5553
- id: flake8
5654
# Need to patch os.remove rule in pandas-dev-flaker
5755
exclude: ^ci/fix_wheels.py
5856
additional_dependencies: &flake8_dependencies
59-
- flake8==5.0.4
57+
- flake8==6.0.0
6058
- flake8-bugbear==22.7.1
6159
- pandas-dev-flaker==0.5.0
6260
- repo: https://github.com/pycqa/pylint
63-
rev: v2.15.5
61+
rev: v2.15.6
62+
hooks:
63+
- id: pylint
64+
stages: [manual]
65+
- repo: https://github.com/pycqa/pylint
66+
rev: v2.15.6
6467
hooks:
6568
- id: pylint
69+
alias: redefined-outer-name
70+
name: Redefining name from outer scope
71+
files: ^pandas/
72+
exclude: |
73+
(?x)
74+
^pandas/tests # keep excluded
75+
|/_testing/ # keep excluded
76+
|^pandas/util/_test_decorators\.py # keep excluded
77+
|^pandas/_version\.py # keep excluded
78+
|^pandas/conftest\.py # keep excluded
79+
|^pandas/core/generic\.py
80+
args: [--disable=all, --enable=redefined-outer-name]
6681
stages: [manual]
6782
- repo: https://github.com/PyCQA/isort
6883
rev: 5.10.1
6984
hooks:
7085
- id: isort
7186
- repo: https://github.com/asottile/pyupgrade
72-
rev: v3.2.0
87+
rev: v3.2.2
7388
hooks:
7489
- id: pyupgrade
7590
args: [--py38-plus]
@@ -94,6 +109,16 @@ repos:
94109
additional_dependencies: *flake8_dependencies
95110
- repo: local
96111
hooks:
112+
# NOTE: we make `black` a local hook because if it's installed from
113+
# PyPI (rather than from source) then it'll run twice as fast thanks to mypyc
114+
- id: black
115+
name: black
116+
description: "Black: The uncompromising Python code formatter"
117+
entry: black
118+
language: python
119+
require_serial: true
120+
types_or: [python, pyi]
121+
additional_dependencies: [black==22.10.0]
97122
- id: pyright
98123
# note: assumes python env is setup and activated
99124
name: pyright
@@ -201,7 +226,7 @@ repos:
201226
entry: python scripts/sync_flake8_versions.py
202227
files: ^(\.pre-commit-config\.yaml|environment\.yml)$
203228
pass_filenames: false
204-
additional_dependencies: [pyyaml]
229+
additional_dependencies: [pyyaml, toml]
205230
- id: title-capitalization
206231
name: Validate correct capitalization among titles in documentation
207232
entry: python scripts/validate_rst_title_capitalization.py
@@ -250,6 +275,7 @@ repos:
250275
entry: python scripts/validate_min_versions_in_sync.py
251276
language: python
252277
files: ^(ci/deps/actions-.*-minimum_versions\.yaml|pandas/compat/_optional\.py)$
278+
additional_dependencies: [tomli]
253279
- id: validate-errors-locations
254280
name: Validate errors locations
255281
description: Validate errors are in appropriate locations.
@@ -287,5 +313,4 @@ repos:
287313
language: python
288314
additional_dependencies:
289315
- autotyping==22.9.0
290-
- black==22.6.0
291316
- libcst==0.4.7

Dockerfile

+10-39
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,13 @@
1-
FROM quay.io/condaforge/mambaforge
1+
FROM python:3.10.8
2+
WORKDIR /home/pandas
23

3-
# if you forked pandas, you can pass in your own GitHub username to use your fork
4-
# i.e. gh_username=myname
5-
ARG gh_username=pandas-dev
6-
ARG pandas_home="/home/pandas"
4+
RUN apt-get update && apt-get -y upgrade
5+
RUN apt-get install -y build-essential
76

8-
# Avoid warnings by switching to noninteractive
9-
ENV DEBIAN_FRONTEND=noninteractive
7+
# hdf5 needed for pytables installation
8+
RUN apt-get install -y libhdf5-dev
109

11-
# Configure apt and install packages
12-
RUN apt-get update \
13-
&& apt-get -y install --no-install-recommends apt-utils git tzdata dialog 2>&1 \
14-
#
15-
# Configure timezone (fix for tests which try to read from "/etc/localtime")
16-
&& ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime \
17-
&& dpkg-reconfigure -f noninteractive tzdata \
18-
#
19-
# cleanup
20-
&& apt-get autoremove -y \
21-
&& apt-get clean -y \
22-
&& rm -rf /var/lib/apt/lists/*
23-
24-
# Switch back to dialog for any ad-hoc use of apt-get
25-
ENV DEBIAN_FRONTEND=dialog
26-
27-
# Clone pandas repo
28-
RUN mkdir "$pandas_home" \
29-
&& git clone "https://github.com/$gh_username/pandas.git" "$pandas_home" \
30-
&& cd "$pandas_home" \
31-
&& git remote add upstream "https://github.com/pandas-dev/pandas.git" \
32-
&& git pull upstream main
33-
34-
# Set up environment
35-
RUN mamba env create -f "$pandas_home/environment.yml"
36-
37-
# Build C extensions and pandas
38-
SHELL ["mamba", "run", "--no-capture-output", "-n", "pandas-dev", "/bin/bash", "-c"]
39-
RUN cd "$pandas_home" \
40-
&& export \
41-
&& python setup.py build_ext -j 4 \
42-
&& python -m pip install --no-build-isolation -e .
10+
RUN python -m pip install --upgrade pip
11+
RUN python -m pip install --use-deprecated=legacy-resolver \
12+
-r https://raw.githubusercontent.com/pandas-dev/pandas/main/requirements-dev.txt
13+
CMD ["/bin/bash"]

asv_bench/asv.conf.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"odfpy": [],
5858
"jinja2": [],
5959
},
60-
"conda_channels": ["defaults", "conda-forge"],
60+
"conda_channels": ["conda-forge"],
6161
// Combinations of libraries/python versions can be excluded/included
6262
// from the set to test. Each entry is a dictionary containing additional
6363
// key-value pairs to include/exclude.
@@ -125,6 +125,7 @@
125125
"regression_thresholds": {
126126
},
127127
"build_command":
128-
["python setup.py build -j4",
128+
["python -m pip install versioneer[toml]",
129+
"python setup.py build -j4",
129130
"PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"],
130131
}

asv_bench/benchmarks/arithmetic.py

+4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ def time_frame_op_with_series_axis0(self, opname):
106106
def time_frame_op_with_series_axis1(self, opname):
107107
getattr(operator, opname)(self.df, self.ser)
108108

109+
# exclude comparisons from the params for time_frame_op_with_series_axis1
110+
# since they do not do alignment so raise
111+
time_frame_op_with_series_axis1.params = [params[0][6:]]
112+
109113

110114
class FrameWithFrameWide:
111115
# Many-columns, mixed dtypes

0 commit comments

Comments
 (0)