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 7 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
36 changes: 25 additions & 11 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.7', '3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]
platform: [x64]
include:
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- os: ubuntu-latest
manylinux-version: 2010
python-version: 3.8
build-depends: numpy==1.17.3
build-depends: numpy==1.18.5
acul3 marked this conversation as resolved.
Show resolved Hide resolved

- os: ubuntu-latest
manylinux-version: 2010
Expand All @@ -93,6 +93,11 @@ jobs:
manylinux-version: 2014
python-version: "3.10"
build-depends: numpy==1.22.2 scipy==1.8.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,6 +122,12 @@ jobs:
manylinux-version: 1
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.11"
build-depends: numpy==1.23.2 scipy==1.9.2

- os: windows-latest
manylinux-version: 2010
Expand All @@ -137,6 +148,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 +171,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 +184,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 +218,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 +252,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 +271,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 All @@ -278,4 +292,4 @@ jobs:
run: |
pip install wheelhouse-uploader
ls wheelhouse/*.whl
python -m wheelhouse_uploader upload --local-folder wheelhouse/ --no-ssl-check gensim-wheels --provider S3 --no-enable-cdn
python -m wheelhouse_uploader upload --local-folder wheelhouse/ --no-ssl-check gensim-wheels --provider S3 --no-enable-cdn
19 changes: 8 additions & 11 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 @@ -94,11 +92,13 @@ jobs:
- {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 +108,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 +129,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 +148,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
9 changes: 4 additions & 5 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