Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.11 and drop support for Python 3.7 #3402

Merged
merged 9 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 23 additions & 25 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]
platform: [x64]
include:
Expand All @@ -74,11 +74,6 @@ jobs:
# https://github.com/scipy/oldest-supported-numpy/blob/master/setup.cfg
# with the exception that we enforce the minimum version to be 1.17.0.
#
- os: ubuntu-latest
manylinux-version: 2010
python-version: 3.7
build-depends: numpy==1.17.0

- os: ubuntu-latest
manylinux-version: 2010
python-version: 3.8
Expand All @@ -93,12 +88,11 @@ jobs:
manylinux-version: 2014
python-version: "3.10"
build-depends: numpy==1.22.2 scipy==1.8.0

- os: macos-latest
travis-os-name: osx
manylinux-version: 1
python-version: 3.7
build-depends: numpy==1.17.0

- os: ubuntu-latest
manylinux-version: 2014
python-version: "3.11"
build-depends: numpy==1.23.2 scipy==1.9.2

- os: macos-latest
travis-os-name: osx
Expand All @@ -117,11 +111,12 @@ jobs:
manylinux-version: 1
python-version: "3.10"
build-depends: numpy==1.22.2 scipy==1.8.0

- os: windows-latest
manylinux-version: 2010
python-version: 3.7
build-depends: numpy==1.17.0

- os: macos-latest
travis-os-name: osx
manylinux-version: 1
python-version: "3.11"
build-depends: numpy==1.23.2 scipy==1.9.2

- os: windows-latest
manylinux-version: 2010
Expand All @@ -137,6 +132,11 @@ jobs:
manylinux-version: 2010
python-version: "3.10"
build-depends: numpy==1.22.2 scipy==1.8.0

- os: windows-latest
manylinux-version: 2010
python-version: "3.11"
build-depends: numpy==1.23.2 scipy==1.9.2

env:
PKG_NAME: gensim
Expand All @@ -155,7 +155,7 @@ jobs:
BUILD_DEPENDS: ${{ matrix.build-depends }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
Expand All @@ -168,7 +168,7 @@ jobs:
echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}"
echo "SKIP_NETWORK_TESTS: ${SKIP_NETWORK_TESTS}"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down Expand Up @@ -202,19 +202,15 @@ jobs:
echo ::group::Set up dependencies
python --version
python -c "import struct; print(struct.calcsize('P') * 8)"

python -m pip install -U pip setuptools wheel wheelhouse_uploader ${{ env.BUILD_DEPENDS }}
echo ::endgroup::

acul3 marked this conversation as resolved.
Show resolved Hide resolved
echo ::group::Build wheel
python setup.py bdist_wheel
echo ::endgroup

echo ::group::Install run
ls dist
python continuous_integration/install_wheel.py
echo ::endgroup::

#
# For consistency with the multibuild step.
#
Expand All @@ -240,6 +236,7 @@ jobs:
if: matrix.os != 'windows-latest'
run: |
. test_environment/bin/activate
python -m pip install --upgrade pip
pip install pytest testfixtures mock
pip install wheelhouse/*.whl
cd test_environment
Expand All @@ -258,6 +255,7 @@ jobs:
if: matrix.os == 'windows-latest'
run: |
test_environment/Scripts/activate.bat
python -m pip install --upgrade pip
pip install pytest testfixtures mock
pip install wheelhouse/*.whl
cd test_environment
Expand Down
21 changes: 8 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand Down Expand Up @@ -47,9 +47,9 @@ jobs:
needs: [linters]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
#
# We use Py3.8 here for historical reasons.
Expand All @@ -65,15 +65,13 @@ jobs:
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.8-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

#
# FIXME: do we want to store the built documentation somewhere, or is
# knowing that the docs built successfully enough?
Expand All @@ -90,15 +88,15 @@ jobs:
fail-fast: false
matrix:
include:
- {python: 3.7, os: ubuntu-20.04}
- {python: 3.8, os: ubuntu-20.04}
- {python: 3.9, os: ubuntu-20.04}
- {python: '3.10', os: ubuntu-20.04}
- {python: '3.11', os: ubuntu-20.04}

- {python: 3.7, os: windows-2019}
- {python: 3.8, os: windows-2019}
- {python: 3.9, os: windows-2019}
- {python: '3.10', os: windows-2019}
- {python: '3.11', os: windows-2019}

#
# Don't run this job unless the linters have succeeded.
Expand All @@ -108,9 +106,9 @@ jobs:
needs: [linters]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Update pip
Expand All @@ -129,14 +127,12 @@ jobs:
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]
Expand All @@ -150,7 +146,6 @@ jobs:
python --version
pip --version
python setup.py build_ext --inplace

#
# Some of our tests are hanging, and I strongly suspect it's because of the coverage plugin.
#
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "multibuild"]
path = multibuild
url = https://github.com/matthew-brett/multibuild.git
url = https://github.com/multi-build/multibuild
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ matrix:
# See .github/workflows/build-wheels.yml for a discussion of why we
# handle numpy versions explicitly.
#
- os: linux
env:
- MB_PYTHON_VERSION=3.7
- BUILD_DEPENDS="numpy==1.19.2 scipy==1.7.0"
- os: linux
env:
- MB_PYTHON_VERSION=3.8
Expand All @@ -50,6 +46,14 @@ matrix:
# this numpy release are available via PyPI.
#
- BUILD_DEPENDS="numpy==1.19.3 scipy==1.7.0"
- os: linux
env:
- MB_PYTHON_VERSION=3.10
- BUILD_DEPENDS="numpy==1.19.3 scipy==1.7.0"
- os: linux
env:
- MB_PYTHON_VERSION=3.11
- BUILD_DEPENDS="numpy==1.19.3 scipy==1.7.0"

before_install:
- source multibuild/common_utils.sh
Expand Down
16 changes: 8 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,14 @@ def run(self):
'testfixtures',
]

if not (sys.platform.lower().startswith("win") and sys.version_info[:2] >= (3, 9)):
if not sys.platform.lower().startswith("win") and sys.version_info[:2] < (3, 11):
core_testenv.extend([
'POT',
'nmslib',
])

# Add additional requirements for testing on Linux that are skipped on Windows.
linux_testenv = core_testenv[:] + visdom_req

# Skip problematic/uninstallable packages (& thus related conditional tests) in Windows builds.
# We still test them in Linux via Travis, see linux_testenv above.
# See https://github.com/RaRe-Technologies/gensim/pull/2814
Expand Down Expand Up @@ -320,20 +319,20 @@ def run(self):
'pandas',
]

NUMPY_STR = 'numpy >= 1.17.0'
NUMPY_STR = 'numpy >= 1.18.5'
#
# We pin the Cython version for reproducibility. We expect our extensions
# to build with any sane version of Cython, so we should update this pin
# periodically.
#
CYTHON_STR = 'Cython==0.29.28'
CYTHON_STR = 'Cython==0.29.32'

# Allow overriding the Cython version requirement
CYTHON_STR = os.environ.get('GENSIM_CYTHON_REQUIRES', CYTHON_STR)

install_requires = [
NUMPY_STR,
'scipy >= 0.18.1',
'scipy >= 1.7.0',
'smart_open >= 1.8.1',
]

Expand Down Expand Up @@ -378,17 +377,18 @@ def run(self):
'Environment :: Console',
'Intended Audience :: Science/Research',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Text Processing :: Linguistic',
],

test_suite="gensim.test",
python_requires='>=3.6',
python_requires='>=3.8',
setup_requires=setup_requires,
install_requires=install_requires,
tests_require=linux_testenv,
Expand Down