Skip to content

Commit ceee136

Browse files
committed
Merge branch 'main' of https://github.com/pandas-dev/pandas into object_reduction_axis_1_attempt_2
� Conflicts: � doc/source/whatsnew/v2.0.0.rst
2 parents 9de5b27 + 3d0d197 commit ceee136

File tree

226 files changed

+3714
-4620
lines changed

Some content is hidden

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

226 files changed

+3714
-4620
lines changed

.devcontainer.json

Lines changed: 1 addition & 2 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ jobs:
3636

3737
- name: Run pre-commit
3838
uses: pre-commit/action@v2.0.3
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/action@v2.0.3
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

Lines changed: 0 additions & 5 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
- name: Install required dependencies
4444
run: |
4545
python -m pip install --upgrade pip setuptools wheel python-dateutil pytz numpy cython
46+
python -m pip install versioneer[toml]
4647
shell: bash -el {0}
4748

4849
- name: Pip install with extra

.github/workflows/python-dev.yml

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
# add or remove what you think is generally useful to most contributors
36+
# avoid adding too many. they each open a pop-up window
37+
38+
# --------------------------------------------------------
39+
# using prebuilds for the container
40+
# With this configuration the prebuild will happen on push to main
41+
github:
42+
prebuilds:
43+
# enable for main/default branch
44+
main: true
45+
# enable for other branches (defaults to false)
46+
branches: false
47+
# enable for pull requests coming from this repo (defaults to true)
48+
pullRequests: false
49+
# enable for pull requests coming from forks (defaults to false)
50+
pullRequestsFromForks: false
51+
# add a check to pull requests (defaults to true)
52+
addCheck: false
53+
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
54+
addComment: false
55+
# add a "Review in Gitpod" button to the pull request's description (defaults to false)
56+
addBadge: false
57+
# add a label once the prebuild is ready to pull requests (defaults to false)
58+
addLabel: false

.pre-commit-config.yaml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@ 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
3330
- repo: https://github.com/pre-commit/pre-commit-hooks
34-
rev: v4.3.0
31+
rev: v4.4.0
3532
hooks:
3633
- id: debug-statements
3734
- id: end-of-file-fixer
@@ -50,26 +47,43 @@ repos:
5047
exclude: ^pandas/_libs/src/(klib|headers)/
5148
args: [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir']
5249
- repo: https://github.com/PyCQA/flake8
53-
rev: 5.0.4
50+
rev: 6.0.0
5451
hooks:
5552
- id: flake8
5653
# Need to patch os.remove rule in pandas-dev-flaker
5754
exclude: ^ci/fix_wheels.py
5855
additional_dependencies: &flake8_dependencies
59-
- flake8==5.0.4
56+
- flake8==6.0.0
6057
- flake8-bugbear==22.7.1
6158
- pandas-dev-flaker==0.5.0
6259
- repo: https://github.com/pycqa/pylint
63-
rev: v2.15.5
60+
rev: v2.15.6
61+
hooks:
62+
- id: pylint
63+
stages: [manual]
64+
- repo: https://github.com/pycqa/pylint
65+
rev: v2.15.6
6466
hooks:
6567
- id: pylint
68+
alias: redefined-outer-name
69+
name: Redefining name from outer scope
70+
files: ^pandas/
71+
exclude: |
72+
(?x)
73+
^pandas/tests # keep excluded
74+
|/_testing/ # keep excluded
75+
|^pandas/util/_test_decorators\.py # keep excluded
76+
|^pandas/_version\.py # keep excluded
77+
|^pandas/conftest\.py # keep excluded
78+
|^pandas/core/generic\.py
79+
args: [--disable=all, --enable=redefined-outer-name]
6680
stages: [manual]
6781
- repo: https://github.com/PyCQA/isort
6882
rev: 5.10.1
6983
hooks:
7084
- id: isort
7185
- repo: https://github.com/asottile/pyupgrade
72-
rev: v3.2.0
86+
rev: v3.2.2
7387
hooks:
7488
- id: pyupgrade
7589
args: [--py38-plus]
@@ -94,6 +108,16 @@ repos:
94108
additional_dependencies: *flake8_dependencies
95109
- repo: local
96110
hooks:
111+
# NOTE: we make `black` a local hook because if it's installed from
112+
# PyPI (rather than from source) then it'll run twice as fast thanks to mypyc
113+
- id: black
114+
name: black
115+
description: "Black: The uncompromising Python code formatter"
116+
entry: black
117+
language: python
118+
require_serial: true
119+
types_or: [python, pyi]
120+
additional_dependencies: [black==22.10.0]
97121
- id: pyright
98122
# note: assumes python env is setup and activated
99123
name: pyright
@@ -201,7 +225,7 @@ repos:
201225
entry: python scripts/sync_flake8_versions.py
202226
files: ^(\.pre-commit-config\.yaml|environment\.yml)$
203227
pass_filenames: false
204-
additional_dependencies: [pyyaml]
228+
additional_dependencies: [pyyaml, toml]
205229
- id: title-capitalization
206230
name: Validate correct capitalization among titles in documentation
207231
entry: python scripts/validate_rst_title_capitalization.py
@@ -250,6 +274,7 @@ repos:
250274
entry: python scripts/validate_min_versions_in_sync.py
251275
language: python
252276
files: ^(ci/deps/actions-.*-minimum_versions\.yaml|pandas/compat/_optional\.py)$
277+
additional_dependencies: [tomli]
253278
- id: validate-errors-locations
254279
name: Validate errors locations
255280
description: Validate errors are in appropriate locations.

Dockerfile

Lines changed: 10 additions & 39 deletions
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"]

0 commit comments

Comments
 (0)