Skip to content

Update numpy -> 2.0 and remove deprecated scipy #1197

Update numpy -> 2.0 and remove deprecated scipy

Update numpy -> 2.0 and remove deprecated scipy #1197

Workflow file for this run

name: Tests
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
linters:
uses: ./.github/workflows/linters.yml
docs:
name: build documentation
timeout-minutes: 10
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
#
# Don't run this job unless the linters have succeeded.
# It's wasteful to test code that failed to lint, because it'll get
# re-tested once the lint errors are fixed.
#
needs: [linters]
steps:
- uses: actions/checkout@v4
- name: Setup up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
#
# We use Py3.8 here for historical reasons.
#
python-version: "3.9"
- name: Update pip
run: python -m pip install -U pip
- name: Install apt packages for LaTeX rendering
run: |
sudo apt-get -yq update
sudo apt-get -yq remove texlive-binaries --purge
sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install dvipng texlive-latex-base texlive-latex-extra texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended latexmk
sudo apt-get -yq install build-essential python3.9-dev
- name: Install gensim and its dependencies
run: pip install -e .[docs]
- name: Build documentation
run: |
python setup.py build_ext --inplace
make -C docs/src clean html
tests:
name: test ${{ matrix.os }} python ${{ matrix.python }}
timeout-minutes: 20
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- {python: '3.9', os: ubuntu-20.04}
- {python: '3.10', os: ubuntu-20.04}
- {python: '3.11', os: ubuntu-20.04}
- {python: '3.12', os: ubuntu-20.04}
- {python: '3.9', os: windows-2019}
- {python: '3.10', os: windows-2019}
- {python: '3.11', os: windows-2019}
- {python: '3.12', os: windows-2019}
#
# Don't run this job unless the linters have succeeded.
# It's wasteful to test code that failed to lint, because it'll get
# re-tested once the lint errors are fixed.
#
needs: [linters]
steps:
- uses: actions/checkout@v4
- name: Setup up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Update pip
run: python -m pip install -U pip
#
# Work-around mysterious build problem
# https://github.com/RaRe-Technologies/gensim/pull/3078/checks?check_run_id=2117914443
# https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html
#
- name: Update sbt
if: matrix.os == 'ubuntu-20.04'
run: |
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update -y
sudo apt-get install -y sbt
- name: Install GDB & enable core dumps
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update -y
sudo apt-get install -y gdb
ulimit -c unlimited -S # enable core dumps
- name: Install gensim and its dependencies
if: matrix.os != 'windows'
run: pip install -e .[test]
- name: Install gensim and its dependencies (Windows)
if: matrix.os == 'windows'
run: pip install -e .[test-win]
- run: pip freeze
- name: Show numpy configuration
run: python -c 'import numpy;numpy.show_config()'
- name: Show libraries packaged by numpy
run: |
python -c 'import numpy;import os;print(os.listdir(os.path.join(os.path.dirname(numpy.__file__),"..","numpy.libs")))' || echo
python -c 'import numpy;import os;print(os.listdir(os.path.join(os.path.dirname(numpy.__file__),"/.libs")))' || echo
python -c 'import numpy;import os;print(os.listdir(os.path.join(os.path.dirname(numpy.__file__),"/.dylibs")))' || echo
#
# Nb. pip 23.2.1 and newer will quietly run build_ext using the Cython
# version specified in pyproject.toml, so we don't need to run build_ext
# ourselves.
#
# It's helpful to know what cython version was actually used to build the
# extensions: it'll be in the file headers.
#
#
- name: Examine build output
run: |
ls gensim/models/*.so gensim/models/*.dylib gensim/models/*.dll || true
head gensim/models/*.c gensim/models/*.cpp || true
- name: Output FAST_VERSION
run: python -c 'from gensim import models;print(models.FAST_VERSION)'
#
# Some of our tests are hanging, and I strongly suspect it's because of the coverage plugin.
#
- name: Run tests (without coverage)
if: matrix.coverage != true
run: pytest -v gensim/test --durations 0
- name: Run tests (with coverage)
if: matrix.coverage == true
run: pytest -v gensim/test --cov=gensim/ --cov-report=xml --durations 0
- name: Upload coverage to Codecov
if: matrix.coverage == true
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage.xml
verbose: true
- name: Collect corefile
if: ${{ failure() }} && matrix.os == 'ubuntu-20.04'
run: |
pwd
COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1)
if [[ -f "$COREFILE" ]]; then EXECFILE=$(gdb -c "$COREFILE" -batch | grep "Core was generated" | tr -d "\`" | cut -d' ' -f5); file "$COREFILE"; gdb -c "$COREFILE" "$EXECFILE" -x continuous_integration/debug.gdb -batch; fi