diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index fad08d2e5feee..a16e38586406b 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -40,11 +40,11 @@ jobs: - name: Set up Conda uses: ./.github/actions/setup-conda - - name: Build Pandas - id: build + - name: Install pandas in editable mode + id: build-editable uses: ./.github/actions/build_pandas with: - editable: false + editable: true # The following checks are independent of each other and should still be run if one fails @@ -58,47 +58,40 @@ jobs: - name: Run doctests run: cd ci && ./code_checks.sh doctests - if: ${{ steps.build.outcome == 'success' && always() }} - - - name: Install pandas in editable mode - id: build-editable - if: ${{ steps.build.outcome == 'success' && always() }} - uses: ./.github/actions/build_pandas - with: - editable: true + if: ${{ steps.build-editable.outcome == 'success' && always() }} - name: Check for no warnings when building single-page docs run: ci/code_checks.sh single-docs - if: ${{ steps.build.outcome == 'success' && always() }} + if: ${{ steps.build-editable.outcome == 'success' && always() }} - name: Run checks on imported code run: ci/code_checks.sh code - if: ${{ steps.build.outcome == 'success' && always() }} + if: ${{ steps.build-editable.outcome == 'success' && always() }} - name: Run docstring validation run: ci/code_checks.sh docstrings - if: ${{ steps.build.outcome == 'success' && always() }} + if: ${{ steps.build-editable.outcome == 'success' && always() }} - name: Run check of documentation notebooks run: ci/code_checks.sh notebooks - if: ${{ steps.build.outcome == 'success' && always() }} + if: ${{ steps.build-editable.outcome == 'success' && always() }} - name: Use existing environment for type checking run: | echo $PATH >> $GITHUB_PATH echo "PYTHONHOME=$PYTHONHOME" >> $GITHUB_ENV echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV - if: ${{ steps.build.outcome == 'success' && always() }} + if: ${{ steps.build-editable.outcome == 'success' && always() }} - name: Typing uses: pre-commit/action@v3.0.1 with: extra_args: --verbose --hook-stage manual --all-files - if: ${{ steps.build.outcome == 'success' && always() }} + if: ${{ steps.build-editable.outcome == 'success' && always() }} - name: Run docstring validation script tests run: pytest scripts - if: ${{ steps.build.outcome == 'success' && always() }} + if: ${{ steps.build-editable.outcome == 'success' && always() }} asv-benchmarks: name: ASV Benchmarks diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index 155a0eb9b9ea5..39b92870fc205 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -1,118 +1,118 @@ -name: Doc Build and Upload - -on: - push: - branches: - - main - - 3.0.x - tags: - - '*' - pull_request: - branches: - - main - - 3.0.x - workflow_dispatch: - inputs: - version: - description: 'The pandas version to override' - required: false - type: string - -env: - ENV_FILE: environment.yml - PANDAS_CI: 1 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PANDAS_VERSION: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || '' }}" - PANDAS_VERSION_OVERRIDE: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || '' }}" - -permissions: - contents: read - -jobs: - web_and_docs: - name: Doc Build and Upload - runs-on: ubuntu-24.04 - - concurrency: - # https://github.community/t/concurrecy-not-work-for-push/183068/7 - group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-web-docs - cancel-in-progress: true - - defaults: - run: - shell: bash -el {0} - - steps: - - name: Set pandas version - run: | - echo "PANDAS_VERSION=${GITHUB_REF_NAME:1}" >> "$GITHUB_ENV" - if: github.event_name != 'workflow_dispatch' - - - name: Show environment variables - run: | - echo "PANDAS_VERSION=${{ env.PANDAS_VERSION }}" - echo "PANDAS_VERSION_OVERRIDE=${{ env.PANDAS_VERSION_OVERRIDE }}" - - - name: Checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Conda - uses: ./.github/actions/setup-conda - - - name: Build Pandas - uses: ./.github/actions/build_pandas - - - name: Extra installs - # https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions-azure-pipelines-travis-ci-and-gitlab-ci-cd - run: sudo apt-get update && sudo apt-get install -y libegl1 libopengl0 - - - name: Test website - run: python -m pytest web/ - - - name: Build website - run: python web/pandas_web.py web/pandas --target-path=web/build - - - name: Build documentation - run: doc/make.py --warnings-are-errors - - - name: Build the interactive terminal - working-directory: web/interactive_terminal - run: jupyter lite build - - - name: Build documentation zip - run: doc/make.py zip_html - - - name: Install ssh key - run: | - mkdir -m 700 -p ~/.ssh - echo "${{ secrets.server_ssh_key }}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - echo "${{ secrets.server_ip }} ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFjYkJBk7sos+r7yATODogQc3jUdW1aascGpyOD4bohj8dWjzwLJv/OJ/fyOQ5lmj81WKDk67tGtqNJYGL9acII=" > ~/.ssh/known_hosts - if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))) || github.event_name == 'workflow_dispatch' - - - name: Copy cheatsheets into site directory - run: cp doc/cheatsheet/Pandas_Cheat_Sheet* web/build/ - - - name: Upload web - run: rsync -az --delete --exclude='pandas-docs' --exclude='docs' --exclude='benchmarks' web/build/ web@${{ secrets.server_ip }}:/var/www/html - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - - - name: Upload dev docs - run: rsync -az --delete doc/build/html/ web@${{ secrets.server_ip }}:/var/www/html/pandas-docs/dev - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - - - name: Upload prod docs - run: rsync -az --delete doc/build/html/ web@${{ secrets.server_ip }}:/var/www/html/pandas-docs/version/${{ env.PANDAS_VERSION }} - if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && env.PANDAS_VERSION_OVERRIDE != '') - - - name: Move docs into site directory - run: mv doc/build/html web/build/docs - - - name: Save website as an artifact - uses: actions/upload-artifact@v6 - with: - name: website - path: web/build - retention-days: 14 +#name: Doc Build and Upload +# +#on: +# push: +# branches: +# - main +# - 3.0.x +# tags: +# - '*' +# pull_request: +# branches: +# - main +# - 3.0.x +# workflow_dispatch: +# inputs: +# version: +# description: 'The pandas version to override' +# required: false +# type: string +# +#env: +# ENV_FILE: environment.yml +# PANDAS_CI: 1 +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# PANDAS_VERSION: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || '' }}" +# PANDAS_VERSION_OVERRIDE: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || '' }}" +# +#permissions: +# contents: read +# +#jobs: +# web_and_docs: +# name: Doc Build and Upload +# runs-on: ubuntu-24.04 +# +# concurrency: +# # https://github.community/t/concurrecy-not-work-for-push/183068/7 +# group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-web-docs +# cancel-in-progress: true +# +# defaults: +# run: +# shell: bash -el {0} +# +# steps: +# - name: Set pandas version +# run: | +# echo "PANDAS_VERSION=${GITHUB_REF_NAME:1}" >> "$GITHUB_ENV" +# if: github.event_name != 'workflow_dispatch' +# +# - name: Show environment variables +# run: | +# echo "PANDAS_VERSION=${{ env.PANDAS_VERSION }}" +# echo "PANDAS_VERSION_OVERRIDE=${{ env.PANDAS_VERSION_OVERRIDE }}" +# +# - name: Checkout +# uses: actions/checkout@v6 +# with: +# fetch-depth: 0 +# +# - name: Set up Conda +# uses: ./.github/actions/setup-conda +# +# - name: Build Pandas +# uses: ./.github/actions/build_pandas +# +# - name: Extra installs +# # https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions-azure-pipelines-travis-ci-and-gitlab-ci-cd +# run: sudo apt-get update && sudo apt-get install -y libegl1 libopengl0 +# +# - name: Test website +# run: python -m pytest web/ +# +# - name: Build website +# run: python web/pandas_web.py web/pandas --target-path=web/build +# +# - name: Build documentation +# run: doc/make.py --warnings-are-errors +# +# - name: Build the interactive terminal +# working-directory: web/interactive_terminal +# run: jupyter lite build +# +# - name: Build documentation zip +# run: doc/make.py zip_html +# +# - name: Install ssh key +# run: | +# mkdir -m 700 -p ~/.ssh +# echo "${{ secrets.server_ssh_key }}" > ~/.ssh/id_rsa +# chmod 600 ~/.ssh/id_rsa +# echo "${{ secrets.server_ip }} ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFjYkJBk7sos+r7yATODogQc3jUdW1aascGpyOD4bohj8dWjzwLJv/OJ/fyOQ5lmj81WKDk67tGtqNJYGL9acII=" > ~/.ssh/known_hosts +# if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))) || github.event_name == 'workflow_dispatch' +# +# - name: Copy cheatsheets into site directory +# run: cp doc/cheatsheet/Pandas_Cheat_Sheet* web/build/ +# +# - name: Upload web +# run: rsync -az --delete --exclude='pandas-docs' --exclude='docs' --exclude='benchmarks' web/build/ web@${{ secrets.server_ip }}:/var/www/html +# if: github.event_name == 'push' && github.ref == 'refs/heads/main' +# +# - name: Upload dev docs +# run: rsync -az --delete doc/build/html/ web@${{ secrets.server_ip }}:/var/www/html/pandas-docs/dev +# if: github.event_name == 'push' && github.ref == 'refs/heads/main' +# +# - name: Upload prod docs +# run: rsync -az --delete doc/build/html/ web@${{ secrets.server_ip }}:/var/www/html/pandas-docs/version/${{ env.PANDAS_VERSION }} +# if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && env.PANDAS_VERSION_OVERRIDE != '') +# +# - name: Move docs into site directory +# run: mv doc/build/html web/build/docs +# +# - name: Save website as an artifact +# uses: actions/upload-artifact@v6 +# with: +# name: website +# path: web/build +# retention-days: 14 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 521cf84764dba..ecc7748f91265 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,427 +1,427 @@ -name: Unit Tests - -on: - push: - branches: - - main - - 3.0.x - pull_request: - branches: - - main - - 3.0.x - paths-ignore: - - "doc/**" - - "web/**" - -permissions: - contents: read - -defaults: - run: - shell: bash -el {0} - -jobs: - ubuntu: - runs-on: ${{ matrix.platform }} - timeout-minutes: 90 - strategy: - matrix: - platform: [ubuntu-24.04, ubuntu-24.04-arm] - env_file: [actions-311.yaml, actions-312.yaml, actions-313.yaml] - # Prevent the include jobs from overriding other jobs - pattern: [""] - pandas_future_infer_string: ["1"] - pandas_future_python_scalars: ["0"] - include: - - name: "Downstream Compat" - env_file: actions-313-downstream_compat.yaml - pattern: "not slow and not network and not single_cpu" - pytest_target: "pandas/tests/test_downstream.py" - platform: ubuntu-24.04 - - name: "Minimum Versions" - env_file: actions-311-minimum_versions.yaml - pattern: "not slow and not network and not single_cpu" - platform: ubuntu-24.04 - - name: "Freethreading" - env_file: actions-313-freethreading.yaml - pattern: "not slow and not network and not single_cpu" - platform: ubuntu-24.04 - - name: "Without PyArrow" - env_file: actions-312.yaml - pattern: "not slow and not network and not single_cpu" - platform: ubuntu-24.04 - - name: "Locale: it_IT" - env_file: actions-313.yaml - pattern: "not slow and not network and not single_cpu" - extra_apt: "language-pack-it" - # Use the utf8 version as the default, it has no bad side-effect. - lang: "it_IT.utf8" - lc_all: "it_IT.utf8" - # Also install it_IT (its encoding is ISO8859-1) but do not activate it. - # It will be temporarily activated during tests with locale.setlocale - extra_loc: "it_IT" - platform: ubuntu-24.04 - - name: "Locale: zh_CN" - env_file: actions-313.yaml - pattern: "not slow and not network and not single_cpu" - extra_apt: "language-pack-zh-hans" - # Use the utf8 version as the default, it has no bad side-effect. - lang: "zh_CN.utf8" - lc_all: "zh_CN.utf8" - # Also install zh_CN (its encoding is gb2312) but do not activate it. - # It will be temporarily activated during tests with locale.setlocale - extra_loc: "zh_CN" - platform: ubuntu-24.04 - - name: "PANDAS_FUTURE_INFER_STRING=0" - env_file: actions-313.yaml - pandas_future_infer_string: "0" - platform: ubuntu-24.04 - - name: "PANDAS_FUTURE_PYTHON_SCALARS=1" - env_file: actions-313.yaml - pandas_future_python_scalars: "1" - platform: ubuntu-24.04 - - name: "Numpy Dev" - env_file: actions-313-numpydev.yaml - pattern: "not slow and not network and not single_cpu" - test_args: "-W error::DeprecationWarning -W error::FutureWarning" - platform: ubuntu-24.04 - - name: "Pyarrow Nightly" - env_file: actions-313-pyarrownightly.yaml - pattern: "not slow and not network and not single_cpu" - platform: ubuntu-24.04 - fail-fast: false - name: ${{ matrix.name || format('{0} {1}', matrix.platform, matrix.env_file) }} - env: - PATTERN: ${{ matrix.pattern }} - LANG: ${{ matrix.lang || 'C.UTF-8' }} - LC_ALL: ${{ matrix.lc_all || '' }} - PANDAS_CI: '1' - PANDAS_FUTURE_INFER_STRING: ${{ matrix.pandas_future_infer_string || '1' }} - PANDAS_FUTURE_PYTHON_SCALARS: ${{ matrix.pandas_future_python_scalars || '0' }} - TEST_ARGS: ${{ matrix.test_args || '' }} - PYTEST_WORKERS: 'auto' - PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }} - # Clipboard tests - QT_QPA_PLATFORM: offscreen - REMOVE_PYARROW: ${{ matrix.name == 'Without PyArrow' && '1' || '0' }} - concurrency: - # https://github.community/t/concurrecy-not-work-for-push/183068/7 - group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-${{ matrix.pattern }}-${{ matrix.extra_apt || '' }}-${{ matrix.pandas_future_infer_string }}-${{ matrix.platform }} - cancel-in-progress: true - - services: - mysql: - image: mysql:9 - env: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_DATABASE: pandas - options: >- - --health-cmd "mysqladmin ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 3306:3306 - - postgres: - image: postgres:18 - env: - PGUSER: postgres - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: pandas - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - moto: - image: motoserver/moto:5.1.18 - ports: - - 5000:5000 - - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Extra installs - # https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions-azure-pipelines-travis-ci-and-gitlab-ci-cd - run: sudo apt-get update && sudo apt-get install -y libegl1 libopengl0 ${{ matrix.extra_apt || ''}} - - - name: Generate extra locales - # These extra locales will be available for locale.setlocale() calls in tests - run: sudo locale-gen ${{ matrix.extra_loc }} - if: ${{ matrix.extra_loc }} - - - name: Set up Conda - uses: ./.github/actions/setup-conda - with: - environment-file: ci/deps/${{ matrix.env_file }} - - - name: Build Pandas - id: build - uses: ./.github/actions/build_pandas - with: - # python3.14t/cpython/pyatomic_gcc.h:63:10: - # error: ‘__atomic_fetch_add_8’ - # writing 8 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=] - werror: ${{ matrix.name != 'Freethreading' }} - - - name: Test (not single_cpu) - uses: ./.github/actions/run-tests - env: - # Set pattern to not single_cpu if not already set - PATTERN: ${{ env.PATTERN == '' && 'not single_cpu' || matrix.pattern }} - - - name: Test (single_cpu) - uses: ./.github/actions/run-tests - env: - PATTERN: 'single_cpu' - PYTEST_WORKERS: 0 - if: ${{ matrix.pattern == '' && (always() && steps.build.outcome == 'success')}} - - macos-windows: - timeout-minutes: 90 - strategy: - matrix: - os: [macos-15-intel, macos-15, windows-2025] - env_file: [actions-311.yaml, actions-312.yaml, actions-313.yaml] - fail-fast: false - runs-on: ${{ matrix.os }} - name: ${{ format('{0} {1}', matrix.os, matrix.env_file) }} - concurrency: - # https://github.community/t/concurrecy-not-work-for-push/183068/7 - group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-${{ matrix.os }} - cancel-in-progress: true - env: - PANDAS_CI: 1 - PYTEST_TARGET: pandas - PATTERN: "not slow and not db and not network and not single_cpu" - PYTEST_WORKERS: 'auto' - - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Conda - uses: ./.github/actions/setup-conda - with: - environment-file: ci/deps/${{ matrix.env_file }} - - - name: Build Pandas - uses: ./.github/actions/build_pandas - - - name: Test - uses: ./.github/actions/run-tests - - Linux-32-bit: - runs-on: ubuntu-24.04 - container: - image: quay.io/pypa/manylinux_2_28_i686 - options: --platform linux/386 - steps: - - name: Checkout pandas Repo - # actions/checkout does not work since it requires node - run: | - git config --global --add safe.directory $PWD - - if [ $GITHUB_EVENT_NAME != pull_request ]; then - git clone --recursive --branch=$GITHUB_REF_NAME https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE - git reset --hard $GITHUB_SHA - else - git clone --recursive https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE - git fetch origin $GITHUB_REF:my_ref_name - git checkout $GITHUB_BASE_REF - git -c user.email="you@example.com" merge --no-commit my_ref_name - fi - - name: Build environment and Run Tests - # https://github.com/numpy/numpy/issues/24703#issuecomment-1722379388 - run: | - /opt/python/cp313-cp313/bin/python -m venv ~/virtualenvs/pandas-dev - . ~/virtualenvs/pandas-dev/bin/activate - python -m pip install --no-cache-dir -U pip wheel setuptools meson[ninja]==1.2.1 meson-python==0.13.1 - python -m pip install numpy -Csetup-args="-Dallow-noblas=true" - python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytest>=8.3.4 pytest-xdist>=3.6.1 hypothesis>=6.116.0 - python -m pip install --no-cache-dir --no-build-isolation -e . -Csetup-args="--werror" - python -m pip list --no-cache-dir - PANDAS_CI=1 python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml - concurrency: - # https://github.community/t/concurrecy-not-work-for-push/183068/7 - group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-32bit - cancel-in-progress: true - - Linux-Musl: - runs-on: ubuntu-24.04 - container: - image: quay.io/pypa/musllinux_1_2_x86_64 - steps: - - name: Checkout pandas Repo - # actions/checkout does not work since it requires node - run: | - git config --global --add safe.directory $PWD - - if [ $GITHUB_EVENT_NAME != pull_request ]; then - git clone --recursive --branch=$GITHUB_REF_NAME https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE - git reset --hard $GITHUB_SHA - else - git clone --recursive https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE - git fetch origin $GITHUB_REF:my_ref_name - git checkout $GITHUB_BASE_REF - git -c user.email="you@example.com" merge --no-commit my_ref_name - fi - - name: Configure System Packages - run: | - apk update - apk add musl-locales - - name: Build environment - run: | - /opt/python/cp313-cp313/bin/python -m venv ~/virtualenvs/pandas-dev - . ~/virtualenvs/pandas-dev/bin/activate - python -m pip install --no-cache-dir -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.2.1 - python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytest>=8.3.4 pytest-xdist>=3.6.1 hypothesis>=6.116.0 - python -m pip install --no-cache-dir --no-build-isolation -e . -Csetup-args="--werror" - python -m pip list --no-cache-dir - - - name: Run Tests - run: | - . ~/virtualenvs/pandas-dev/bin/activate - PANDAS_CI=1 python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml - concurrency: - # https://github.community/t/concurrecy-not-work-for-push/183068/7 - group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-musl - cancel-in-progress: true - - python-dev: - # This job may or may not run depending on the state of the next - # unreleased Python version. DO NOT DELETE IT. - # - # In general, this will remain frozen(present, but not running) until: - # - The next unreleased Python version has released beta 1 - # - This version should be available on GitHub Actions. - # - Our required build/runtime dependencies(numpy, Cython, python-dateutil) - # support that unreleased Python version. - # To unfreeze, comment out the ``if: false`` condition, and make sure you update - # the name of the workflow and Python version in actions/setup-python ``python-version:`` - # - # After it has been unfrozen, this file should remain unfrozen(present, and running) until: - # - The next Python version has been officially released. - # OR - # - Most/All of our optional dependencies support the next Python version AND - # - The next Python version has released a rc(we are guaranteed a stable ABI). - # To freeze this file, uncomment out the ``if: false`` condition, and migrate the jobs - # to the corresponding posix/windows-macos/sdist etc. workflows. - # Feel free to modify this comment as necessary. - # if: false - defaults: - run: - shell: bash -eou pipefail {0} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-24.04, macos-15-intel, macos-15, windows-2025] - - timeout-minutes: 90 - - concurrency: - # https://github.community/t/concurrecy-not-work-for-push/183068/7 - group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.os }}-python-dev - cancel-in-progress: true - - env: - PYTEST_WORKERS: "auto" - PANDAS_CI: 1 - PATTERN: "not slow and not network and not clipboard and not single_cpu" - PYTEST_TARGET: pandas - - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Python Dev Version - uses: actions/setup-python@v6 - with: - python-version: '3.14-dev' - - - name: Build Environment - run: | - python --version - python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1 - python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy - python -m pip install versioneer[toml] python-dateutil tzdata cython hypothesis>=6.116.0 pytest>=8.3.4 pytest-xdist>=3.6.1 pytest-cov - python -m pip install -ve . --no-build-isolation --no-index --no-deps -Csetup-args="--werror" - python -m pip list - - - name: Run Tests - uses: ./.github/actions/run-tests - - # NOTE: this job must be kept in sync with the Pyodide build job in wheels.yml - emscripten: - # Note: the Python version, Emscripten toolchain version are determined - # by the Pyodide version. The appropriate versions can be found in the - # Pyodide repodata.json "info" field, or in the Makefile.envs file: - # https://github.com/pyodide/pyodide/blob/stable/Makefile.envs#L2 - # The Node.js version can be determined via Pyodide: - # https://pyodide.org/en/stable/usage/index.html#node-js - name: Pyodide build - runs-on: ubuntu-24.04 - concurrency: - # https://github.community/t/concurrecy-not-work-for-push/183068/7 - group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-wasm - cancel-in-progress: true - steps: - - name: Checkout pandas Repo - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Python for pyodide-build - id: setup-python - uses: actions/setup-python@v6 - with: - python-version: '3.12' - - - name: Set up Emscripten toolchain - uses: mymindstorm/setup-emsdk@v14 - with: - version: '3.1.58' - actions-cache-folder: emsdk-cache - - - name: Install pyodide-build - run: pip install "pyodide-build>=0.29.2" - - - name: Build pandas for Pyodide - run: | - pyodide build - - - name: Set up Node.js - uses: actions/setup-node@v6 - with: - node-version: '20' - - - name: Set up Pyodide virtual environment - env: - pyodide-version: '0.27.1' - run: | - pyodide xbuildenv install ${{ env.pyodide-version }} - pyodide venv .venv-pyodide - source .venv-pyodide/bin/activate - pip install dist/*.whl - - - name: Test pandas for Pyodide - env: - PANDAS_CI: 1 - run: | - source .venv-pyodide/bin/activate - pip install pytest hypothesis - # do not import pandas from the checked out repo - cd .. - python -c 'import pandas as pd; pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db"])' +#name: Unit Tests +# +#on: +# push: +# branches: +# - main +# - 3.0.x +# pull_request: +# branches: +# - main +# - 3.0.x +# paths-ignore: +# - "doc/**" +# - "web/**" +# +#permissions: +# contents: read +# +#defaults: +# run: +# shell: bash -el {0} +# +#jobs: +# ubuntu: +# runs-on: ${{ matrix.platform }} +# timeout-minutes: 90 +# strategy: +# matrix: +# platform: [ubuntu-24.04, ubuntu-24.04-arm] +# env_file: [actions-311.yaml, actions-312.yaml, actions-313.yaml] +# # Prevent the include jobs from overriding other jobs +# pattern: [""] +# pandas_future_infer_string: ["1"] +# pandas_future_python_scalars: ["0"] +# include: +# - name: "Downstream Compat" +# env_file: actions-313-downstream_compat.yaml +# pattern: "not slow and not network and not single_cpu" +# pytest_target: "pandas/tests/test_downstream.py" +# platform: ubuntu-24.04 +# - name: "Minimum Versions" +# env_file: actions-311-minimum_versions.yaml +# pattern: "not slow and not network and not single_cpu" +# platform: ubuntu-24.04 +# - name: "Freethreading" +# env_file: actions-313-freethreading.yaml +# pattern: "not slow and not network and not single_cpu" +# platform: ubuntu-24.04 +# - name: "Without PyArrow" +# env_file: actions-312.yaml +# pattern: "not slow and not network and not single_cpu" +# platform: ubuntu-24.04 +# - name: "Locale: it_IT" +# env_file: actions-313.yaml +# pattern: "not slow and not network and not single_cpu" +# extra_apt: "language-pack-it" +# # Use the utf8 version as the default, it has no bad side-effect. +# lang: "it_IT.utf8" +# lc_all: "it_IT.utf8" +# # Also install it_IT (its encoding is ISO8859-1) but do not activate it. +# # It will be temporarily activated during tests with locale.setlocale +# extra_loc: "it_IT" +# platform: ubuntu-24.04 +# - name: "Locale: zh_CN" +# env_file: actions-313.yaml +# pattern: "not slow and not network and not single_cpu" +# extra_apt: "language-pack-zh-hans" +# # Use the utf8 version as the default, it has no bad side-effect. +# lang: "zh_CN.utf8" +# lc_all: "zh_CN.utf8" +# # Also install zh_CN (its encoding is gb2312) but do not activate it. +# # It will be temporarily activated during tests with locale.setlocale +# extra_loc: "zh_CN" +# platform: ubuntu-24.04 +# - name: "PANDAS_FUTURE_INFER_STRING=0" +# env_file: actions-313.yaml +# pandas_future_infer_string: "0" +# platform: ubuntu-24.04 +# - name: "PANDAS_FUTURE_PYTHON_SCALARS=1" +# env_file: actions-313.yaml +# pandas_future_python_scalars: "1" +# platform: ubuntu-24.04 +# - name: "Numpy Dev" +# env_file: actions-313-numpydev.yaml +# pattern: "not slow and not network and not single_cpu" +# test_args: "-W error::DeprecationWarning -W error::FutureWarning" +# platform: ubuntu-24.04 +# - name: "Pyarrow Nightly" +# env_file: actions-313-pyarrownightly.yaml +# pattern: "not slow and not network and not single_cpu" +# platform: ubuntu-24.04 +# fail-fast: false +# name: ${{ matrix.name || format('{0} {1}', matrix.platform, matrix.env_file) }} +# env: +# PATTERN: ${{ matrix.pattern }} +# LANG: ${{ matrix.lang || 'C.UTF-8' }} +# LC_ALL: ${{ matrix.lc_all || '' }} +# PANDAS_CI: '1' +# PANDAS_FUTURE_INFER_STRING: ${{ matrix.pandas_future_infer_string || '1' }} +# PANDAS_FUTURE_PYTHON_SCALARS: ${{ matrix.pandas_future_python_scalars || '0' }} +# TEST_ARGS: ${{ matrix.test_args || '' }} +# PYTEST_WORKERS: 'auto' +# PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }} +# # Clipboard tests +# QT_QPA_PLATFORM: offscreen +# REMOVE_PYARROW: ${{ matrix.name == 'Without PyArrow' && '1' || '0' }} +# concurrency: +# # https://github.community/t/concurrecy-not-work-for-push/183068/7 +# group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-${{ matrix.pattern }}-${{ matrix.extra_apt || '' }}-${{ matrix.pandas_future_infer_string }}-${{ matrix.platform }} +# cancel-in-progress: true +# +# services: +# mysql: +# image: mysql:9 +# env: +# MYSQL_ALLOW_EMPTY_PASSWORD: yes +# MYSQL_DATABASE: pandas +# options: >- +# --health-cmd "mysqladmin ping" +# --health-interval 10s +# --health-timeout 5s +# --health-retries 5 +# ports: +# - 3306:3306 +# +# postgres: +# image: postgres:18 +# env: +# PGUSER: postgres +# POSTGRES_USER: postgres +# POSTGRES_PASSWORD: postgres +# POSTGRES_DB: pandas +# options: >- +# --health-cmd pg_isready +# --health-interval 10s +# --health-timeout 5s +# --health-retries 5 +# ports: +# - 5432:5432 +# +# moto: +# image: motoserver/moto:5.1.18 +# ports: +# - 5000:5000 +# +# steps: +# - name: Checkout +# uses: actions/checkout@v6 +# with: +# fetch-depth: 0 +# +# - name: Extra installs +# # https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions-azure-pipelines-travis-ci-and-gitlab-ci-cd +# run: sudo apt-get update && sudo apt-get install -y libegl1 libopengl0 ${{ matrix.extra_apt || ''}} +# +# - name: Generate extra locales +# # These extra locales will be available for locale.setlocale() calls in tests +# run: sudo locale-gen ${{ matrix.extra_loc }} +# if: ${{ matrix.extra_loc }} +# +# - name: Set up Conda +# uses: ./.github/actions/setup-conda +# with: +# environment-file: ci/deps/${{ matrix.env_file }} +# +# - name: Build Pandas +# id: build +# uses: ./.github/actions/build_pandas +# with: +# # python3.14t/cpython/pyatomic_gcc.h:63:10: +# # error: ‘__atomic_fetch_add_8’ +# # writing 8 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=] +# werror: ${{ matrix.name != 'Freethreading' }} +# +# - name: Test (not single_cpu) +# uses: ./.github/actions/run-tests +# env: +# # Set pattern to not single_cpu if not already set +# PATTERN: ${{ env.PATTERN == '' && 'not single_cpu' || matrix.pattern }} +# +# - name: Test (single_cpu) +# uses: ./.github/actions/run-tests +# env: +# PATTERN: 'single_cpu' +# PYTEST_WORKERS: 0 +# if: ${{ matrix.pattern == '' && (always() && steps.build.outcome == 'success')}} +# +# macos-windows: +# timeout-minutes: 90 +# strategy: +# matrix: +# os: [macos-15-intel, macos-15, windows-2025] +# env_file: [actions-311.yaml, actions-312.yaml, actions-313.yaml] +# fail-fast: false +# runs-on: ${{ matrix.os }} +# name: ${{ format('{0} {1}', matrix.os, matrix.env_file) }} +# concurrency: +# # https://github.community/t/concurrecy-not-work-for-push/183068/7 +# group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-${{ matrix.os }} +# cancel-in-progress: true +# env: +# PANDAS_CI: 1 +# PYTEST_TARGET: pandas +# PATTERN: "not slow and not db and not network and not single_cpu" +# PYTEST_WORKERS: 'auto' +# +# steps: +# - name: Checkout +# uses: actions/checkout@v6 +# with: +# fetch-depth: 0 +# +# - name: Set up Conda +# uses: ./.github/actions/setup-conda +# with: +# environment-file: ci/deps/${{ matrix.env_file }} +# +# - name: Build Pandas +# uses: ./.github/actions/build_pandas +# +# - name: Test +# uses: ./.github/actions/run-tests +# +# Linux-32-bit: +# runs-on: ubuntu-24.04 +# container: +# image: quay.io/pypa/manylinux_2_28_i686 +# options: --platform linux/386 +# steps: +# - name: Checkout pandas Repo +# # actions/checkout does not work since it requires node +# run: | +# git config --global --add safe.directory $PWD +# +# if [ $GITHUB_EVENT_NAME != pull_request ]; then +# git clone --recursive --branch=$GITHUB_REF_NAME https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE +# git reset --hard $GITHUB_SHA +# else +# git clone --recursive https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE +# git fetch origin $GITHUB_REF:my_ref_name +# git checkout $GITHUB_BASE_REF +# git -c user.email="you@example.com" merge --no-commit my_ref_name +# fi +# - name: Build environment and Run Tests +# # https://github.com/numpy/numpy/issues/24703#issuecomment-1722379388 +# run: | +# /opt/python/cp313-cp313/bin/python -m venv ~/virtualenvs/pandas-dev +# . ~/virtualenvs/pandas-dev/bin/activate +# python -m pip install --no-cache-dir -U pip wheel setuptools meson[ninja]==1.2.1 meson-python==0.13.1 +# python -m pip install numpy -Csetup-args="-Dallow-noblas=true" +# python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytest>=8.3.4 pytest-xdist>=3.6.1 hypothesis>=6.116.0 +# python -m pip install --no-cache-dir --no-build-isolation -e . -Csetup-args="--werror" +# python -m pip list --no-cache-dir +# PANDAS_CI=1 python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml +# concurrency: +# # https://github.community/t/concurrecy-not-work-for-push/183068/7 +# group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-32bit +# cancel-in-progress: true +# +# Linux-Musl: +# runs-on: ubuntu-24.04 +# container: +# image: quay.io/pypa/musllinux_1_2_x86_64 +# steps: +# - name: Checkout pandas Repo +# # actions/checkout does not work since it requires node +# run: | +# git config --global --add safe.directory $PWD +# +# if [ $GITHUB_EVENT_NAME != pull_request ]; then +# git clone --recursive --branch=$GITHUB_REF_NAME https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE +# git reset --hard $GITHUB_SHA +# else +# git clone --recursive https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE +# git fetch origin $GITHUB_REF:my_ref_name +# git checkout $GITHUB_BASE_REF +# git -c user.email="you@example.com" merge --no-commit my_ref_name +# fi +# - name: Configure System Packages +# run: | +# apk update +# apk add musl-locales +# - name: Build environment +# run: | +# /opt/python/cp313-cp313/bin/python -m venv ~/virtualenvs/pandas-dev +# . ~/virtualenvs/pandas-dev/bin/activate +# python -m pip install --no-cache-dir -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.2.1 +# python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytest>=8.3.4 pytest-xdist>=3.6.1 hypothesis>=6.116.0 +# python -m pip install --no-cache-dir --no-build-isolation -e . -Csetup-args="--werror" +# python -m pip list --no-cache-dir +# +# - name: Run Tests +# run: | +# . ~/virtualenvs/pandas-dev/bin/activate +# PANDAS_CI=1 python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml +# concurrency: +# # https://github.community/t/concurrecy-not-work-for-push/183068/7 +# group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-musl +# cancel-in-progress: true +# +# python-dev: +# # This job may or may not run depending on the state of the next +# # unreleased Python version. DO NOT DELETE IT. +# # +# # In general, this will remain frozen(present, but not running) until: +# # - The next unreleased Python version has released beta 1 +# # - This version should be available on GitHub Actions. +# # - Our required build/runtime dependencies(numpy, Cython, python-dateutil) +# # support that unreleased Python version. +# # To unfreeze, comment out the ``if: false`` condition, and make sure you update +# # the name of the workflow and Python version in actions/setup-python ``python-version:`` +# # +# # After it has been unfrozen, this file should remain unfrozen(present, and running) until: +# # - The next Python version has been officially released. +# # OR +# # - Most/All of our optional dependencies support the next Python version AND +# # - The next Python version has released a rc(we are guaranteed a stable ABI). +# # To freeze this file, uncomment out the ``if: false`` condition, and migrate the jobs +# # to the corresponding posix/windows-macos/sdist etc. workflows. +# # Feel free to modify this comment as necessary. +# # if: false +# defaults: +# run: +# shell: bash -eou pipefail {0} +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# os: [ubuntu-24.04, macos-15-intel, macos-15, windows-2025] +# +# timeout-minutes: 90 +# +# concurrency: +# # https://github.community/t/concurrecy-not-work-for-push/183068/7 +# group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.os }}-python-dev +# cancel-in-progress: true +# +# env: +# PYTEST_WORKERS: "auto" +# PANDAS_CI: 1 +# PATTERN: "not slow and not network and not clipboard and not single_cpu" +# PYTEST_TARGET: pandas +# +# steps: +# - uses: actions/checkout@v6 +# with: +# fetch-depth: 0 +# +# - name: Set up Python Dev Version +# uses: actions/setup-python@v6 +# with: +# python-version: '3.14-dev' +# +# - name: Build Environment +# run: | +# python --version +# python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1 +# python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy +# python -m pip install versioneer[toml] python-dateutil tzdata cython hypothesis>=6.116.0 pytest>=8.3.4 pytest-xdist>=3.6.1 pytest-cov +# python -m pip install -ve . --no-build-isolation --no-index --no-deps -Csetup-args="--werror" +# python -m pip list +# +# - name: Run Tests +# uses: ./.github/actions/run-tests +# +# # NOTE: this job must be kept in sync with the Pyodide build job in wheels.yml +# emscripten: +# # Note: the Python version, Emscripten toolchain version are determined +# # by the Pyodide version. The appropriate versions can be found in the +# # Pyodide repodata.json "info" field, or in the Makefile.envs file: +# # https://github.com/pyodide/pyodide/blob/stable/Makefile.envs#L2 +# # The Node.js version can be determined via Pyodide: +# # https://pyodide.org/en/stable/usage/index.html#node-js +# name: Pyodide build +# runs-on: ubuntu-24.04 +# concurrency: +# # https://github.community/t/concurrecy-not-work-for-push/183068/7 +# group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-wasm +# cancel-in-progress: true +# steps: +# - name: Checkout pandas Repo +# uses: actions/checkout@v6 +# with: +# fetch-depth: 0 +# +# - name: Set up Python for pyodide-build +# id: setup-python +# uses: actions/setup-python@v6 +# with: +# python-version: '3.12' +# +# - name: Set up Emscripten toolchain +# uses: mymindstorm/setup-emsdk@v14 +# with: +# version: '3.1.58' +# actions-cache-folder: emsdk-cache +# +# - name: Install pyodide-build +# run: pip install "pyodide-build>=0.29.2" +# +# - name: Build pandas for Pyodide +# run: | +# pyodide build +# +# - name: Set up Node.js +# uses: actions/setup-node@v6 +# with: +# node-version: '20' +# +# - name: Set up Pyodide virtual environment +# env: +# pyodide-version: '0.27.1' +# run: | +# pyodide xbuildenv install ${{ env.pyodide-version }} +# pyodide venv .venv-pyodide +# source .venv-pyodide/bin/activate +# pip install dist/*.whl +# +# - name: Test pandas for Pyodide +# env: +# PANDAS_CI: 1 +# run: | +# source .venv-pyodide/bin/activate +# pip install pytest hypothesis +# # do not import pandas from the checked out repo +# cd .. +# python -c 'import pandas as pd; pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db"])' diff --git a/environment.yml b/environment.yml index d7b085d56f212..07a6a0dceeaa0 100644 --- a/environment.yml +++ b/environment.yml @@ -88,7 +88,7 @@ dependencies: - numpydoc # temporary installed with pip with custom patch until released # - pydata-sphinx-theme=0.16 - - pytest-cython # doctest + # - pytest-cython # doctest - sphinx - sphinx-design - sphinx-copybutton @@ -128,3 +128,4 @@ dependencies: - pip: - tzdata>=2023.3 - https://github.com/jorisvandenbossche/pydata-sphinx-theme/archive/refs/heads/v0.16.1+dismissable-announcement-banner.zip + - git+https://github.com/lgpage/pytest-cython.git@support_out_of_source_builds diff --git a/pandas/_libs/lib.pyx b/pandas/_libs/lib.pyx index 887e906075887..350b0c4050ee0 100644 --- a/pandas/_libs/lib.pyx +++ b/pandas/_libs/lib.pyx @@ -153,6 +153,21 @@ def memory_usage_of_objects(ndarray[object, ndim=1] arr) -> int64_t: # ---------------------------------------------------------------------- +def some_internal_function() -> bool: + """ + Some docstring + + Returns + ------- + bool + Returns True. + + Examples + -------- + >>> assert False, "Doctest failed" + """ + return True + @set_module("pandas.api.types") def is_scalar(val: object) -> bool: @@ -210,6 +225,8 @@ def is_scalar(val: object) -> bool: >>> from fractions import Fraction >>> pd.api.types.is_scalar(Fraction(3, 5)) True + + >>> assert False, "Doctest failed" """ # Start with C-optimized checks diff --git a/requirements-dev.txt b/requirements-dev.txt index 58aa0ac0f7b51..0b06950f2005d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -61,7 +61,6 @@ gitpython natsort pickleshare numpydoc -pytest-cython sphinx sphinx-design sphinx-copybutton @@ -87,3 +86,4 @@ jupyterlite-core jupyterlite-pyodide-kernel tzdata>=2023.3 https://github.com/jorisvandenbossche/pydata-sphinx-theme/archive/refs/heads/v0.16.1+dismissable-announcement-banner.zip +git+https://github.com/lgpage/pytest-cython.git@support_out_of_source_builds