Skip to content

Commit ca80a87

Browse files
committed
Fixed #259 Adopt NEP 29
1 parent 79786a8 commit ca80a87

File tree

9 files changed

+125
-12
lines changed

9 files changed

+125
-12
lines changed

.github/workflows/github-actions.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,39 @@ on:
55
pull_request:
66
branches: master
77
jobs:
8+
minimum-version-testing:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
python-version: ['3.6']
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set Up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Display Python Version
21+
run: python -c "import sys; print(sys.version)"
22+
shell: bash
23+
- name: Generate Minimum Requirements File
24+
run: sed 's/>/=/g' requirements.txt | sed 's/$/\.*/g' > requirements.min.txt
25+
shell: bash
26+
- name: Install Minimum Requirements
27+
run: pip install --upgrade -r requirements.min.txt
28+
shell: bash
29+
- name: Install STUMPY And Other Dependencies
30+
run: pip install --editable .[ci]
31+
shell: bash
32+
- name: Run Black
33+
run: black --check --diff ./
34+
shell: bash
35+
- name: Run Flake8
36+
run: flake8 ./
37+
shell: bash
38+
- name: Run Unit Tests
39+
run: ./test.sh unit
40+
shell: bash
841
unit-testing:
942
runs-on: ${{ matrix.os }}
1043
strategy:

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ Semantic Segmentation with `Fast Low-cost Unipotent Semantic Segmentation (FLUSS
179179
Dependencies
180180
------------
181181

182+
Supported Python and NumPy versions are determined according to the `NEP 29 deprecation policy <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__.
183+
182184
* `NumPy <http://www.numpy.org/>`__
183185
* `Numba <http://numba.pydata.org/>`__
184186
* `SciPy <https://www.scipy.org/>`__
@@ -313,7 +315,7 @@ Tests are written in the ``tests`` directory and processed using `PyTest <https:
313315
Python Version
314316
--------------
315317

316-
STUMPY supports `Python 3.6+ <https://python3statement.org/>`__ and, due to the use of unicode variable names/identifiers, is not compatible with Python 2.x. Given the small dependencies, STUMPY may work on older versions of Python but this is beyond the scope of our support and we strongly recommend that you upgrade to the most recent version of Python.
318+
STUMPY supports `Python 3.7+ <https://python3statement.org/>`__ and, due to the use of unicode variable names/identifiers, is not compatible with Python 2.x. Given the small dependencies, STUMPY may work on older versions of Python but this is beyond the scope of our support and we strongly recommend that you upgrade to the most recent version of Python.
317319

318320
------------
319321
Getting Help

conda.sh

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,74 @@
11
#!/bin/bash
22

3+
install_mode="normal"
4+
5+
# Parse first command line argument
6+
if [ $# -gt 0 ]; then
7+
if [ $1 == "min" ]; then
8+
install_mode="min"
9+
echo "Installing minimum dependencies with install_mode=\"min\""
10+
else
11+
echo "Using default install_mode=\"normal\""
12+
fi
13+
fi
14+
15+
###############
16+
# Functions #
17+
###############
18+
19+
generate_min_environment_yaml()
20+
{
21+
echo "Generating \"environment.min.yml\" File"
22+
numpy="$(grep -E "numpy" environment.yml)"
23+
scipy="$(grep -E "scipy" environment.yml)"
24+
numba="$(grep -E "numba" environment.yml)"
25+
min_numpy="$(grep -E "numpy" environment.yml | sed 's/>//')"
26+
min_scipy="$(grep -E "scipy" environment.yml | sed 's/>//')"
27+
min_numba="$(grep -E "numba" environment.yml | sed 's/>//')"
28+
29+
sed "s/${numpy}/${min_numpy}/" environment.yml | sed "s/${scipy}/${min_scipy}/" | sed "s/${numba}/${min_numba}/" > environment.min.yml
30+
}
31+
32+
fix_libopenblas()
33+
{
34+
if [ ! -f $CONDA_PREFIX/lib/libopenblas.dylib ]; then
35+
if [ -f $CONDA_PREFIX/lib/libopenblas.0.dylib ]; then
36+
ln -s $CONDA_PREFIX/lib/libopenblas.0.dylib $CONDA_PREFIX/lib/libopenblas.dylib
37+
fi
38+
fi
39+
}
40+
41+
clean_up()
42+
{
43+
echo "Cleaning Up"
44+
rm -rf "environment.min.yml"
45+
}
46+
47+
###########
48+
# Main #
49+
###########
50+
351
conda update -y conda
452
conda update -y --all
553
conda install -y -c conda-forge mamba
6-
# conda env update --file environment.yml
7-
mamba env update --file environment.yml
54+
55+
if [ $install_mode == "min" ]; then
56+
generate_min_environment_yaml
57+
# conda env update --file environment.min.yml
58+
mamba env update --file environment.min.yml
59+
else
60+
# conda env update --file environment.yml
61+
mamba env update --file environment.yml
62+
fi
63+
64+
fix_libopenblas
65+
866
if [[ `uname` == "Linux" && `which nvcc | wc -l` -lt "1" ]]; then
967
# conda install -y -c conda-forge cudatoolkit-dev
1068
mamba install -y -c conda-forge cudatoolkit-dev
1169
fi
70+
1271
#conda install -y -c conda-forge numpy scipy numba pandas flake8 flake8-docstrings black pytest-cov
1372
#conda install -y -c conda-forge dask distributed
73+
74+
clean_up

docs/install.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Installation
33
------------
44

5+
Supported Python and NumPy versions are determined according to the `NEP 29 deprecation policy <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__.
6+
57
Using conda/pip
68
===============
79

environment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ channels:
33
- defaults
44
dependencies:
55
- python>=3.6
6-
- numpy>=1.13
7-
- scipy>=1.2.1
8-
- numba>=0.42.0
6+
- numpy>=1.15
7+
- scipy>=1.5
8+
- numba>=0.48
99
- pandas>=0.20.0
1010
- flake8>=3.7.7
1111
- flake8-docstrings>=1.5.0

pypi.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
# 1. Update version number in setup.py
44
# 2. Update CHANGELOG
55
# 3. Update README with new features/functions/tutorials
6-
# 4. Commit all above changes and push
6+
# 4. Determine minimum dependencies
7+
# a) Find the minimum Python and NumPy version you want to support: https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table
8+
# b) Then find the SciPy version that has a "Python" version and "Minimum NumPy version" that is supported: https://docs.scipy.org/doc/scipy/reference/toolchain.html#numpy
9+
# c) Check Numba release notes for mimumum Python and NumPy versions supported https://numba.pydata.org/numba-doc/dev/release-notes.html
10+
# 5. Bumpy minimum dependencies
11+
# a) setup.py
12+
# b) requirements.txt
13+
# d) environment.yml
14+
# e) recipes/meta.yaml in conda-feedstock
15+
# 6. Commit all above changes and push
716
#
817
# For conda-forge
918
# 1. Fork the stumpy-feedstock: https://github.com/conda-forge/stumpy-feedstock

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
numpy>=1.13
2-
numba>=0.42.0
3-
scipy>=1.2.1
1+
numpy>=1.15
2+
scipy>=1.5
3+
numba>=0.48

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_extras_require():
5858
"maintainer_email": "[email protected]",
5959
"license": "BSD-3",
6060
"packages": ["stumpy"],
61-
"install_requires": ["numpy >= 1.19", "scipy >= 1.2.1", "numba >= 0.42.0"],
61+
"install_requires": ["numpy >= 1.15", "scipy >= 1.5", "numba >= 0.48"],
6262
"ext_modules": [],
6363
"cmdclass": {},
6464
"tests_require": ["pytest"],

stumpy/core.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,13 @@ def are_arrays_equal(a, b): # pragma: no cover
214214
if id(a) == id(b):
215215
return True
216216

217-
return np.array_equal(a, b, equal_nan=True)
217+
# For numpy >= 1.19
218+
# return np.array_equal(a, b, equal_nan=True)
219+
220+
if a.shape != b.shape:
221+
return False
222+
223+
return ((a == b) | (np.isnan(a) & np.isnan(b))).all()
218224

219225

220226
def are_distances_too_small(a, threshold=10e-6): # pragma: no cover

0 commit comments

Comments
 (0)