Skip to content

Commit

Permalink
Bumped min numpy version to 1.18 (#324)
Browse files Browse the repository at this point in the history
* Bumped min numpy version to 1.18

* Updated numpy min version and min py version

Now minimum supported numpy is 1.18 and minimum supported python (py3) is 3.9

* Don't run numpy2 on py2.7

Probably pissed off some software gremlins by allowing that combo!

* Adding in Numpy 2 (#325)

* Fix headers and include paths for NumPy 2 (currently breaks NumPy 1 build support)

* Fix NumPy 1 build by using numpy.get_include()

---------

Co-authored-by: Lehman Garrison <[email protected]>

* No more py2

Too much hassle trying to maintain py2

* Dropping py2.7, updating to numpy 1.20 as the min tested version

* Can't run numpy1.20 with py3.12

* dropped python2

* Trying to keep the bot happy

* Reinstate py2.7 support for patch release (before completely dropping py2)

* Added change-log [ci skip]

* Ugghhh wrong date [ci skip]

---------

Co-authored-by: Lehman Garrison <[email protected]>
  • Loading branch information
manodeep and lgarrison authored Aug 6, 2024
1 parent b7350a1 commit 77dc72e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 43 deletions.
44 changes: 13 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
matrix:
os: ["ubuntu-20.04", "ubuntu-latest", "macos-latest"]
compiler: [gcc-7, gcc-9, clang]
python-version: ["2.7", "3.7", "3.8", "3.9"]
numpy-version: ["1.16", "1.18"]
python-version: ["3.9", "3.12"]
numpy-version: ["1.20", "2.0.1"]

include:
- numpy-version: "1.22"
- numpy-version: "1.23"
compiler: gcc-10
python-version: "3.10"
os: ubuntu-latest

- numpy-version: "1.22"
- numpy-version: "1.23"
compiler: gcc-11
python-version: "3.10"
os: ubuntu-latest
Expand All @@ -39,17 +39,17 @@ jobs:
python-version: "3.10"
os: ubuntu-latest

- numpy-version: "1.22"
- numpy-version: "1.23"
compiler: gcc-10
python-version: "3.11"
os: ubuntu-latest

- numpy-version: "1.22"
- numpy-version: "1.23"
compiler: gcc-11
python-version: "3.11"
os: ubuntu-latest

- numpy-version: "1.22"
- numpy-version: "1.23"
compiler: gcc-12
python-version: "3.11"
os: ubuntu-latest
Expand Down Expand Up @@ -88,39 +88,21 @@ jobs:
- os: "ubuntu-latest"
compiler: gcc-7

# Don't run numpy 1.16 on ubuntu-latest
- os: "ubuntu-latest"
numpy-version: 1.16

# Only use latest numpy on ubuntu-latest
- os: "ubuntu-latest"
numpy-version: 1.18
numpy-version: 1.20

# python3.10 only on ubuntu-latest
# - os: "ubuntu-20.04"
# python-version: "3.10"
# - os: "macos-latest"
# python-version: "3.10"

# numpy1.18 only on python3.10
# (which, in turn, is only on 'latest')
- python-version: "2.7"
numpy-version: "1.18"
- python-version: "3.9"
numpy-version: "1.18"
- python-version: "3.8"
numpy-version: "1.18"
- python-version: "3.7"
numpy-version: "1.18"

# excludes for numpy 1.22
# - python-version: "2.7"
# numpy-version: "1.22"
# - python-version: "3.9"
# numpy-version: "1.22"
# - python-version: "3.8"
# numpy-version: "1.22"
# - python-version: "3.7"
# numpy-version: "1.22"
numpy-version: "2.0.1"

- python-version: "3.12"
numpy-version: "1.20"

env:
CC: ${{ matrix.compiler }}
Expand Down
11 changes: 10 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ New features
- conda installable package
- GPU version

2.5.3 (06/08/2024)
==================
Final release of the 2.5.x series and last Corrfunc version to support ``python2``

Infrastructure
--------------
- Updated minimum numpy to ``1.20`` [#324]
- No longer testing on ``python2`` [#324]

2.5.2 (04/10/2023)
==================

Expand All @@ -23,7 +32,7 @@ Infrastructure
- Automatic uploads of new releases to PyPI [#305]
- Added @dependabot for automatic dependency updates in GitHub Actions [#306, #307, #308]


2.5.1 (28/07/2023)
==================

Expand Down
18 changes: 9 additions & 9 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ ifeq ($(DO_CHECKS), 1)
endif

# Check if using clang on Apple with M1/M1 Max/M2 etc
# if so, remove -march=native from CFLAGS and
# if so, remove -march=native from CFLAGS and
# then add -mcpu=apple-m1 -mtune=apple-m1
# ARCH := $(shell uname -m)
# $(info ARCH is $(ARCH))
Expand All @@ -400,12 +400,12 @@ ifeq ($(DO_CHECKS), 1)
#### MS: 3rd May 2023
### For reasons unknown to me, the addition to CFLAGS does not work correctly if I
### change this variable name "opt" to match the remaining names of "copt". Works fine
### for 'clang' on OSX but not for 'gcc'. Adds the -march=native but somehow that
### for 'clang' on OSX but not for 'gcc'. Adds the -march=native but somehow that
### extra flag is removed when testing the -mcpu/-mtune compiler options. For the sake
### of my sanity, I have accepted that this is how it shall work! Hopefully, in the future,
### someone will figure out/explain *why* this behaviour is expected. It
### seems more like a gcc bug to me where gcc is updating CFLAGS based on
### the options on the last compile call (since cland does not show
### someone will figure out/explain *why* this behaviour is expected. It
### seems more like a gcc bug to me where gcc is updating CFLAGS based on
### the options on the last compile call (since cland does not show
### this behaviour) - MS: 3rd May, 2023

## TLDR: Leave this variable as "opt" while the remaining are set to "copt". Otherwise,
Expand All @@ -424,7 +424,7 @@ ifeq ($(DO_CHECKS), 1)
CFLAGS += $(copt)
else
CFLAGS := $(filter-out $(copt), $(CFLAGS))
endif
endif

copt := -mtune=apple-m1
COMPILE_OPT_SUPPORTED := $(shell $(CC) $(copt) -dM -E - < /dev/null 2>&1 1>/dev/null)
Expand Down Expand Up @@ -478,7 +478,7 @@ ifeq ($(DO_CHECKS), 1)
MIN_PYTHON_MINOR := 7

MIN_NUMPY_MAJOR := 1
MIN_NUMPY_MINOR := 16
MIN_NUMPY_MINOR := 20

PYTHON_AVAIL := $(shell [ $(PYTHON_VERSION_MAJOR) -gt $(MIN_PYTHON_MAJOR) -o \( $(PYTHON_VERSION_MAJOR) -eq $(MIN_PYTHON_MAJOR) -a $(PYTHON_VERSION_MINOR) -ge $(MIN_PYTHON_MINOR) \) ] && echo true)
NUMPY_AVAIL := $(shell [ $(NUMPY_VERSION_MAJOR) -gt $(MIN_NUMPY_MAJOR) -o \( $(NUMPY_VERSION_MAJOR) -eq $(MIN_NUMPY_MAJOR) -a $(NUMPY_VERSION_MINOR) -ge $(MIN_NUMPY_MINOR) \) ] && echo true)
Expand Down Expand Up @@ -506,14 +506,14 @@ ifeq ($(DO_CHECKS), 1)
# NUMPY is available -> next step should not fail
# That's why we are not checking if the NUMPY_INCL_FLAG is defined.
ifeq ($(NUMPY_CHECKED), 0)
export NUMPY_INCL_FLAG := $(shell $(PYTHON) -c "from __future__ import print_function; import numpy; print('-isystem ' + numpy.__path__[0] + '/core/include/numpy/')")
export NUMPY_INCL_FLAG := $(shell $(PYTHON) -c "from __future__ import print_function; import numpy; print('-isystem ' + numpy.get_include())")
# Take the second word -> the path (the first word is "isystem")
NUMPY_INCL_PATH := $(word 2, ${NUMPY_INCL_FLAG})
# Now check that the 'arrayobject.h' file is present in the
# supposed numpy directory. Otherwise, compilation will fail.
# The absence of the file likely indicates a missing numpy-devel
# package (see issue #134 on github)
NUMPY_NEEDED_HEADER_FILE := ${NUMPY_INCL_PATH}arrayobject.h
NUMPY_NEEDED_HEADER_FILE := ${NUMPY_INCL_PATH}/numpy/arrayobject.h
ifeq (,$(wildcard ${NUMPY_NEEDED_HEADER_FILE}))
$(error Required $(ccred)numpy headers$(ccreset) are missing...stopping the compilation. You might be able to fix this by installing $(ccblue)numpy-devel$(ccreset))
endif
Expand Down
2 changes: 1 addition & 1 deletion mocks/python_bindings/_countpairs_mocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <Python.h>

/* Now, include the numpy header*/
#include <arrayobject.h>
#include <numpy/arrayobject.h>

//for correlation functions
#include "countpairs_rp_pi_mocks.h"
Expand Down
2 changes: 1 addition & 1 deletion theory/python_bindings/_countpairs.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <stdint.h>

/* Now, include the numpy header*/
#include <arrayobject.h>
#include <numpy/arrayobject.h>

//for correlation functions
#include "countpairs.h"
Expand Down

0 comments on commit 77dc72e

Please sign in to comment.