Skip to content

Commit

Permalink
build: Limit Cython 0.29.x and support Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed Oct 4, 2023
1 parent 108e49a commit c673d3a
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ install:
- "%PYTHON%\\python.exe -m pip install --upgrade wheel"
- "%PYTHON%\\python.exe -m wheel version"
# Cython
- "%PYTHON%\\python.exe -m pip install Cython"
- "%PYTHON%\\python.exe -m pip install -r conf\\requirements-build-cython.txt"
- "%PYTHON%\\python.exe -m cython --version"
# Microsoft MPI
- "powershell .azure\\install-msmpi.ps1"
Expand Down
55 changes: 22 additions & 33 deletions .azure/pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ jobs:
Python310_OpenMPI:
PYTHON_VERSION: '3.10'
MPI: 'openmpi'
variables:
PYTHON_ARCH: x64
Python311_MPICH:
PYTHON_VERSION: '3.11'
MPI: 'mpich'
Python311_OpenMPI:
PYTHON_VERSION: '3.11'
MPI: 'openmpi'
steps:
- bash: echo 127.0.0.1 `hostname` | sudo tee -a /etc/hosts > /dev/null
displayName: 'Configure hostname'
- template: steps.yml

- job: macOS
pool:
vmImage: 'macOS-10.15'
vmImage: 'macOS-11'
strategy:
matrix:
Python35_MPICH:
Expand Down Expand Up @@ -98,8 +102,12 @@ jobs:
Python310_OpenMPI:
PYTHON_VERSION: '3.10'
MPI: 'openmpi'
variables:
PYTHON_ARCH: x64
Python311_MPICH:
PYTHON_VERSION: '3.11'
MPI: 'mpich'
Python311_OpenMPI:
PYTHON_VERSION: '3.11'
MPI: 'openmpi'
steps:
- bash: echo 127.0.0.1 `hostname` | sudo tee -a /etc/hosts > /dev/null
displayName: 'Configure hostname'
Expand All @@ -110,44 +118,25 @@ jobs:
vmImage: 'windows-2019'
strategy:
matrix:
Python35_32bit:
PYTHON_VERSION: '3.5'
PYTHON_ARCH: 'x86'
Python36_32bit:
PYTHON_VERSION: '3.6'
PYTHON_ARCH: 'x86'
Python37_32bit:
PYTHON_VERSION: '3.7'
PYTHON_ARCH: 'x86'
Python38_32bit:
PYTHON_VERSION: '3.8'
PYTHON_ARCH: 'x86'
Python39_32bit:
PYTHON_VERSION: '3.9'
PYTHON_ARCH: 'x86'
Python35_64bit:
Python35_MSMPI:
PYTHON_VERSION: '3.5'
PYTHON_ARCH: 'x64'
Python36_64bit:
Python36_MSMPI:
PYTHON_VERSION: '3.6'
PYTHON_ARCH: 'x64'
Python37_64bit:
Python37_MSMPI:
PYTHON_VERSION: '3.7'
PYTHON_ARCH: 'x64'
Python38_64bit:
Python38_MSMPI:
PYTHON_VERSION: '3.8'
PYTHON_ARCH: 'x64'
Python39_64bit:
Python39_MSMPI:
PYTHON_VERSION: '3.9'
PYTHON_ARCH: 'x64'
Python310_64bit:
Python310_MSMPI:
PYTHON_VERSION: '3.10'
PYTHON_ARCH: 'x64'
Python311_MSMPI:
PYTHON_VERSION: '3.11'
variables:
MPI: 'msmpi'
steps:
- template: steps.yml
- publish: dist
artifact: 'Windows-py$(PYTHON_VERSION)-$(PYTHON_ARCH)'
artifact: 'Windows-py$(PYTHON_VERSION)'
displayName: 'Publish package artifacts'
condition: eq( variables['Agent.OS'], 'Windows_NT' )
4 changes: 2 additions & 2 deletions .azure/steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION)
architecture: $(PYTHON_ARCH)
architecture: x64
displayName: 'Use Python $(PYTHON_VERSION)'
- script: python -m pip install --upgrade setuptools pip wheel
displayName: 'Install packaging tools'

- script: python -m pip install --upgrade cython
- script: python -m pip install -r conf/requirements-build-cython.txt
displayName: 'Install build dependencies'
- script: python -m pip wheel -vvv --wheel-dir=dist .
displayName: 'Build package'
Expand Down
43 changes: 18 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,54 +21,47 @@ jobs:
fail-fast: false
matrix:
py-version:
- "2.7"
#- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "pypy-2.7"
- "3.11"
- "3.12"
#- "pypy-2.7"
- "pypy-3.6"
- "pypy-3.7"
- "pypy-3.8"
- "pypy-3.9"
py-arch:
- x86
- x64
mpi:
- mpich
- openmpi
- msmpi
os:
- ubuntu-18.04
- macos-10.15
- ubuntu-20.04
- macos-11
- windows-2019
exclude:
- os: ubuntu-18.04
py-arch: x86
- os: ubuntu-18.04
- os: ubuntu-20.04
mpi: msmpi
- os: macos-10.15
- os: macos-11
py-version: pypy-2.7
- os: macos-10.15
- os: macos-11
py-version: pypy-3.6
- os: macos-10.15
- os: macos-11
py-version: pypy-3.7
- os: macos-10.15
py-arch: x86
- os: macos-10.15
- os: macos-11
mpi: msmpi
- os: windows-2019
mpi: mpich
- os: windows-2019
mpi: openmpi
- os: windows-2019
py-version: pypy-2.7
- os: windows-2019
py-version: pypy-3.6
py-arch: x86
- os: windows-2019
py-version: pypy-3.7
py-arch: x86

steps:

Expand Down Expand Up @@ -105,7 +98,7 @@ jobs:
- name: Install packaging tools
run: python -m pip install --upgrade setuptools pip wheel
- name: Install build dependencies
run: python -m pip install --upgrade cython
run: python -m pip install -r conf/requirements-build-cython.txt
- name: Build package
run: python -m pip wheel -vvv --wheel-dir=dist .
- name: Upload package artifacts
Expand Down Expand Up @@ -167,10 +160,10 @@ jobs:
- name: pylint
run: pylint mpi4py

- name: mypy (stubtest)
run: stubtest mpi4py
--mypy-config-file=conf/mypy.ini
--allowlist=conf/mypy.stubtest.allow.txt
#- name: mypy (stubtest)
# run: stubtest mpi4py
# --mypy-config-file=conf/mypy.ini
# --allowlist=conf/mypy.stubtest.allow.txt

- name: mypy (typecheck)
run: mypy -p mpi4py
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ addons:
update: true

before_install:
- python -m pip install Cython
- python -m pip install -r conf/requirements-build-cython.txt
- python -m pip install numpy
- source .azure/install-$MPI.sh
- python --version
Expand Down
2 changes: 1 addition & 1 deletion conf/ci/fedoracloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ source venv-$PY-$MPI/bin/activate
pip install pip --upgrade

echo "Installing dependencies"
pip install Cython
pip install -r conf/requirements-build-cython.txt
pip install pydocstyle pylint coverage --upgrade

echo "Loading MPI module: $MPI"
Expand Down
1 change: 1 addition & 0 deletions conf/requirements-build-cython.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cython < 3.0.0
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def description():
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Scientific/Engineering
Expand Down Expand Up @@ -485,7 +487,7 @@ def run_setup():
has_git = os.path.isdir(os.path.join(topdir, '.git'))
has_hg = os.path.isdir(os.path.join(topdir, '.hg'))
if not has_src or has_git or has_hg:
setup_args['setup_requires'] += ['Cython>='+CYTHON]
setup_args['setup_requires'] += ['Cython>='+CYTHON+',<3.0.0']
#
setup(
packages = [
Expand Down
1 change: 1 addition & 0 deletions src/mpi4py/MPI.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#cython: autotestdict=False
#cython: warn.multiple_declarators=False
#cython: optimize.use_switch=False
#cython: legacy_implicit_noexcept=True
from __future__ import absolute_import
cimport cython
include "MPI/MPI.pyx"
19 changes: 14 additions & 5 deletions test/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,20 @@ def getoptionparser():
return parser

def getbuilddir():
from distutils.util import get_platform
plat_name, (x, y) = get_platform(), sys.version_info[:2]
s = os.path.join("build", "lib.%s-%d.%d" % (plat_name, x, y))
if hasattr(sys, 'gettotalrefcount'): s += '-pydebug'
return s
try:
try:
from setuptools.dist import Distribution
except ImportError:
from distutils.dist import Distribution
try:
from setuptools.command.build import build
except ImportError:
from distutils.command.build import build
cmd_obj = build(Distribution())
cmd_obj.finalize_options()
return cmd_obj.build_platlib
except Exception:
return None

def setup_python(options):
rootdir = os.path.dirname(os.path.dirname(__file__))
Expand Down
3 changes: 2 additions & 1 deletion test/test_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def using_GPU():
@unittest.skipMPI('openmpi(==4.0.0)')
@unittest.skipMPI('openmpi(==4.0.1)', sys.platform=='darwin')
@unittest.skipMPI('openmpi(==4.0.2)', sys.platform=='darwin')
@unittest.skipMPI('mpich', appnum() is None)
@unittest.skipMPI('mpich(<4.1.0)', appnum() is None)
@unittest.skipMPI('mpich(==4.1.2)', sys.platform=='darwin')
@unittest.skipMPI('mpich', badport())
@unittest.skipMPI('msmpi(<8.1.0)')
@unittest.skipMPI('msmpi', appnum() is None)
Expand Down
7 changes: 6 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ envlist =
py38,
py39,
py310,
py311,
py312,
pypy2,
pypy3,

[mpi]
mpiexec = {env:MPIEXEC:mpiexec}

[testenv]
deps = numpy
deps =
numpy; python_version < '3.12'
setuptools; python_version >= '3.12'
allowlist_externals = {[mpi]mpiexec}
whitelist_externals = {[mpi]mpiexec}
commands =
{[mpi]mpiexec} -n 1 {envpython} -m mpi4py --version
Expand Down

0 comments on commit c673d3a

Please sign in to comment.