Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81ac863

Browse files
authored
BLD: update requirements to use cython>3.0 (#24236)
Cython3.0 has been released. Let's update to use it everywhere. Signed-off-by: Matti Picus <[email protected]>
1 parent b1c0fbf commit 81ac863

9 files changed

Lines changed: 21 additions & 47 deletions

.github/workflows/build_test.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,12 @@ jobs:
181181
python-version: ${{ env.PYTHON_VERSION }}
182182
- uses: ./.github/actions
183183

184-
debug_and_cython3:
184+
debug:
185185
needs: [smoke_test]
186186
runs-on: ubuntu-latest
187187
if: github.event_name != 'push'
188188
env:
189189
USE_DEBUG: 1
190-
USE_CYTHON3: 1
191190
steps:
192191
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
193192
with:
@@ -343,11 +342,10 @@ jobs:
343342
sudo apt update
344343
sudo apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf gfortran-arm-linux-gnueabihf
345344
346-
# Keep the `test_requirements.txt` dependency-subset synced
347-
docker run --name the_container --interactive -v /:/host arm32v7/ubuntu:22.04 /bin/bash -c "
345+
docker run --name the_container --interactive -v /:/host -v $(pwd):/numpy arm32v7/ubuntu:22.04 /bin/bash -c "
348346
apt update &&
349347
apt install -y git python3 python3-dev python3-pip &&
350-
python3 -m pip install cython==0.29.34 setuptools\<49.2.0 hypothesis==6.23.3 pytest==6.2.5 'typing_extensions>=4.2.0' &&
348+
python3 -m pip install -r /numpy/test_requirements.txt
351349
ln -s /host/lib64 /lib64 &&
352350
ln -s /host/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu &&
353351
ln -s /host/usr/arm-linux-gnueabihf /usr/arm-linux-gnueabihf &&

INSTALL.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Building NumPy requires the following installed software:
2020
e.g., on Debian/Ubuntu one needs to install both `python3` and
2121
`python3-dev`. On Windows and macOS this is normally not an issue.
2222

23-
2) Cython >= 0.29.30 but < 3.0
23+
2) Cython >= 0.29.35
2424

2525
3) pytest__ (optional)
2626

build_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
meson-python>=0.10.0
2-
Cython>=0.29.34,<3.0
2+
Cython
33
wheel==0.38.1
44
ninja
55
spin==0.4

environment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ channels:
88
- conda-forge
99
dependencies:
1010
- python=3.9 #need to pin to avoid issues with builds
11-
- cython>=0.29.30
11+
- cython>=3.0
1212
- compilers
1313
- openblas
1414
- nomkl
1515
- setuptools=59.2.0
16-
- meson >= 0.64.0
1716
- ninja
1817
- pkg-config
1918
- meson-python
20-
- pip # so you can use pip to install spin
19+
- pip
20+
- spin
2121
# For testing
2222
- pytest
2323
- pytest-cov

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[build-system]
22
build-backend = "mesonpy"
33
requires = [
4-
"Cython>=0.29.34",
4+
"Cython>=3.0",
55
"meson-python>=0.13.1",
66
]
77

pyproject.toml.setuppy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
requires = [
66
"setuptools==59.2.0",
77
"wheel==0.38.1",
8-
"Cython>=0.29.34,<3.0",
8+
"Cython>=0.29.34,<3.1",
99
]

test_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cython>=0.29.34,<3.0
1+
Cython
22
wheel==0.38.1
33
setuptools==59.2.0 ; python_version < '3.12'
44
setuptools ; python_version >= '3.12'

tools/travis-before-install.sh

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,11 @@ gcc --version
3636

3737
popd
3838

39-
pip install --upgrade pip 'setuptools<49.2.0' wheel
40-
41-
# 'setuptools', 'wheel' and 'cython' are build dependencies. This information
42-
# is stored in pyproject.toml, but there is not yet a standard way to install
43-
# those dependencies with, say, a pip command, so we'll just hard-code their
44-
# installation here. We only need to install them separately for the cases
45-
# where numpy is installed with setup.py, which is the case for the Travis jobs
46-
# where the environment variables USE_DEBUG or USE_WHEEL are set. When pip is
47-
# used to install numpy, pip gets the build dependencies from pyproject.toml.
48-
# A specific version of cython is required, so we read the cython package
49-
# requirement using `grep cython test_requirements.txt` instead of simply
50-
# writing 'pip install setuptools wheel cython'.
51-
if [ -n "$USE_CYTHON3" ]
52-
then
53-
pip install --pre --force-reinstall cython
54-
else
55-
pip install `grep cython test_requirements.txt`
56-
fi
57-
5839
if [ -n "$DOWNLOAD_OPENBLAS" ]; then
59-
pwd
6040
target=$(python tools/openblas_support.py)
6141
sudo cp -r $target/lib/* /usr/lib
6242
sudo cp $target/include/* /usr/include
6343
fi
6444

6545

66-
if [ -n "$USE_ASV" ]; then pip install asv; fi
46+

tools/travis-test.sh

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ fi
1616

1717
source builds/venv/bin/activate
1818

19+
pip install --upgrade pip 'setuptools<49.2.0'
20+
21+
pip install -r build_requirements.txt
22+
23+
if [ -n "$USE_ASV" ]; then pip install asv; fi
1924
# travis venv tests override python
2025
PYTHON=${PYTHON:-python}
2126
PIP=${PIP:-pip}
@@ -35,7 +40,8 @@ setup_base()
3540
# use default python flags but remove sign-compare
3641
sysflags="$($PYTHON -c "import sysconfig; \
3742
print (sysconfig.get_config_var('CFLAGS'))")"
38-
export CFLAGS="$sysflags $werrors -Wlogical-op -Wno-sign-compare"
43+
# For cython3.0 add -Wno-error=undef, see cython/cython#5557
44+
export CFLAGS="$sysflags $werrors -Wlogical-op -Wno-sign-compare -Wno-error=undef"
3945

4046
build_args=()
4147
# Strictly disable all kinds of optimizations
@@ -54,13 +60,6 @@ setup_base()
5460
build_args+=("--simd-test=\$werror BASELINE SSE2 SSE42 XOP FMA4 (FMA3 AVX2) AVX512F AVX512_SKX VSX VSX2 VSX3 NEON ASIMD VX VXE VXE2")
5561
fi
5662
if [ -z "$USE_DEBUG" ]; then
57-
# activates '-Werror=undef' when DEBUG isn't enabled since _cffi_backend'
58-
# extension breaks the build due to the following error:
59-
#
60-
# error: "HAVE_FFI_PREP_CIF_VAR" is not defined, evaluates to 0 [-Werror=undef]
61-
# #if !HAVE_FFI_PREP_CIF_VAR && defined(__arm64__) && defined(__APPLE__)
62-
#
63-
export CFLAGS="$CFLAGS -Werror=undef"
6463
$PYTHON setup.py build "${build_args[@]}" install 2>&1 | tee log
6564
else
6665
# The job run with USE_DEBUG=1 on travis needs this.
@@ -90,9 +89,6 @@ run_test()
9089
# file does not install correctly when Python's optimization level is set
9190
# to strip docstrings (see https://github.com/eliben/pycparser/issues/291).
9291
PYTHONOPTIMIZE="" $PIP install -r test_requirements.txt pyinstaller
93-
if [ -n "$USE_CYTHON3" ] ; then
94-
$PIP install --pre --force-reinstall cython
95-
fi
9692
DURATIONS_FLAG="--durations 10"
9793

9894
if [ -n "$USE_DEBUG" ]; then
@@ -202,7 +198,7 @@ export PIP
202198

203199
if [ -n "$USE_WHEEL" ] && [ $# -eq 0 ]; then
204200
# ensure some warnings are not issued
205-
export CFLAGS=$CFLAGS" -Wno-sign-compare -Wno-unused-result"
201+
export CFLAGS=$CFLAGS" -Wno-sign-compare -Wno-unused-result -Wno-error=undef"
206202
# adjust gcc flags if C coverage requested
207203
if [ -n "$RUN_COVERAGE" ]; then
208204
export NPY_DISTUTILS_APPEND_FLAGS=1
@@ -226,7 +222,7 @@ elif [ -n "$USE_SDIST" ] && [ $# -eq 0 ]; then
226222
# temporary workaround for sdist failures.
227223
$PYTHON -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
228224
# ensure some warnings are not issued
229-
export CFLAGS=$CFLAGS" -Wno-sign-compare -Wno-unused-result"
225+
export CFLAGS=$CFLAGS" -Wno-sign-compare -Wno-unused-result -Wno-error=undef"
230226
$PYTHON setup.py sdist
231227
# Make another virtualenv to install into
232228
$PYTHON -m venv venv-for-wheel

0 commit comments

Comments
 (0)